This is the mail archive of the mailing list for the GCC project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH, contrib] download_prerequisites: check for existing symlinks before making new ones

On Thu, Jul 14, 2016 at 6:57 AM, Eric Gallager <> wrote:
> On 7/13/16, Jeff Law <> 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.

On GNU, -F means:

       -d, -F, --directory
              allow the superuser to attempt to hard link directories
(note: will probably fail due to system restrictions, even for the

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]