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

Jeff Law law@redhat.com
Wed Aug 3 16:12:00 GMT 2016


On 07/21/2016 01:39 PM, Eric Gallager wrote:
> 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.
Thanks for your patience.  I've installed your patch.

Jeff



More information about the Gcc-patches mailing list