public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Eric Gallager <egall@gwmail.gwu.edu>
To: Jeff Law <law@redhat.com>
Cc: gcc-patches@gcc.gnu.org
Subject: Re: [PATCH, contrib] download_prerequisites: check for existing symlinks before making new ones
Date: Thu, 14 Jul 2016 10:57:00 -0000	[thread overview]
Message-ID: <CAMfHzOtJ1b15fKnfsjoDiMHyAWnoSJc32Xf8zz7pnrvdz7p8Vg@mail.gmail.com> (raw)
In-Reply-To: <6d8cc2be-c68d-81f9-2274-6a12628b8caa@redhat.com>

On 7/13/16, Jeff Law <law@redhat.com> wrote:
> On 06/27/2016 08:10 PM, Eric Gallager wrote:
>> The last time I ran ./contrib/download_prerequisites, I already had
>> previous symlinks set up from a previous run of the script, so `ln`
>> followed the existing symlinks and created the new ones in the
>> directories to which the symlinks pointed. This patch should fix that
>> by removing the old symlinks before creating new ones. (For some
>> reason the `-f` flag to `ln` that was already there wasn't enough for
>> me.) Tested by running the script and ensuring that the new isl
>> symlink pointed to the correct directory, and that there were no bad
>> symlinks in the old isl directory. Could someone commit this trivial
>> patch for me, or something like it? I don't have write access.
> I'd really rather know why the "-f" flag didn't work for you.  The whole
> point of -f is to remove the destination file first.
>
> Jeff
>

Reading my ln manpage, it describes the "-f" flag like this:


     -f    If the target file already exists, then unlink it so that the
           link may occur.  (The -f option overrides any previous -i
           options.)

Okay, so that seems like it should do what you say, but the manpage
also describes a separate uppercase "-F" option:

     -F    If the target file already exists and is a directory, then
           remove it so that the link may occur.  The -F option should be
           used with either -f or -i options.  If none is specified, -f is
           implied.  The -F option is a no-op unless -s option is speci-
           fied.

So it seems to imply that "-f" will only remove the destination file
if it's a regular file, while "-F" is needed if the destination file
is a directory. The page also has this to say about "-F" later:

     The -F option is FreeBSD extention and should not be used in portable
     scripts.

So this could be a BSD vs. GNU thing.

  reply	other threads:[~2016-07-14 10:57 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-06-28  2:38 Eric Gallager
2016-07-13 21:36 ` Jeff Law
2016-07-14 10:57   ` Eric Gallager [this message]
2016-07-14 13:54     ` NightStrike
2016-07-14 17:24     ` Jeff Law
2016-07-14 19:57       ` Eric Gallager
2016-07-21 17:10         ` Jeff Law
2016-07-21 19:39           ` Eric Gallager
2016-08-03 16:12             ` Jeff Law
2016-07-14 13:53   ` NightStrike
2016-07-21 18:15 Bernd Edlinger
2016-07-22 22:28 ` Jeff Law

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAMfHzOtJ1b15fKnfsjoDiMHyAWnoSJc32Xf8zz7pnrvdz7p8Vg@mail.gmail.com \
    --to=egall@gwmail.gwu.edu \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=law@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).