From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 15130 invoked by alias); 3 Aug 2016 16:12:21 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Received: (qmail 15107 invoked by uid 89); 3 Aug 2016 16:12:19 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-3.1 required=5.0 tests=BAYES_00,RP_MATCHES_RCVD,SPF_HELO_PASS autolearn=ham version=3.3.2 spammy=wheel, Hx-languages-length:1408, aix, sfv X-HELO: mx1.redhat.com Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-GCM-SHA384 encrypted) ESMTPS; Wed, 03 Aug 2016 16:12:18 +0000 Received: from int-mx11.intmail.prod.int.phx2.redhat.com (int-mx11.intmail.prod.int.phx2.redhat.com [10.5.11.24]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 219568E251; Wed, 3 Aug 2016 16:12:17 +0000 (UTC) Received: from localhost.localdomain (ovpn-116-194.phx2.redhat.com [10.3.116.194]) by int-mx11.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id u73GCG4Y023743; Wed, 3 Aug 2016 12:12:16 -0400 Subject: Re: [PATCH, contrib] download_prerequisites: check for existing symlinks before making new ones To: Eric Gallager References: <6d8cc2be-c68d-81f9-2274-6a12628b8caa@redhat.com> <218664c9-aeec-c213-eba3-570ba8879516@redhat.com> <5c5a9b7f-f8cb-ce72-489f-3fad441c494c@redhat.com> Cc: gcc-patches@gcc.gnu.org, bernd.edlinger@hotmail.de From: Jeff Law Message-ID: Date: Wed, 03 Aug 2016 16:12:00 -0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.2.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit X-IsSubscribed: yes X-SW-Source: 2016-08/txt/msg00216.txt.bz2 On 07/21/2016 01:39 PM, Eric Gallager wrote: > On 7/21/16, Jeff Law 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