This is the mail archive of the gcc-patches@gcc.gnu.org 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 7/21/16, Jeff Law <law@redhat.com> wrote:
> On 07/14/2016 01:57 PM, Eric Gallager wrote:
>
>>
>> So apparently the "-f" flag properly overwrites symlinks that point to
>> regular files, but I also did this in my gcc builddir:
>>
>> $ mkdir isl-0.1.2.3
>> $ ln -s isl-0.1.2.3 isl-s
>> $ ln -sfv isl isl-s
>> isl-s/isl -> isl
>> $ ln -sfFv isl isl-s
>> isl-s/isl -> isl
>> $ ls -l isl-s
>> lrwxr-xr-x  1 root  wheel  11 Jul 14 07:03 isl-s -> isl-0.1.2.3
>> $ unlink isl-s
>> $ ln -sfFv isl isl-s
>> isl-s -> isl
>> $ ls -l isl-s
>> lrwxr-xr-x  1 root  wheel  3 Jul 14 15:51 isl-s -> isl
>>
>> ...it just doesn't overwrite symlinks that point to a directory.
> Joys :(
>
> AFAIK unlink may not necessarily be available on the various host
> systems GCC supports (solaris, aix, hpux, etc etc).
>
> So rather than relying on ln to remove the link, why don't we just
> explicitly remove it with rm -f?
>
> Jeff
>

Sure, rm -f works, too; I just went with "unlink" in my patch because
it more clearly expresses programmer intent. But I guess portability
is more important. Updated patch attached, although someone else would
have to commit it, as I don't have commit access.

Eric

Attachment: patch_contrib_download_prerequisites.diff
Description: Text document


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