From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 96321 invoked by alias); 21 Jul 2016 17:10:05 -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 96311 invoked by uid 89); 21 Jul 2016 17:10:04 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-3.2 required=5.0 tests=BAYES_00,RP_MATCHES_RCVD,SPF_HELO_PASS autolearn=ham version=3.3.2 spammy=sffv, 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; Thu, 21 Jul 2016 17:10:03 +0000 Received: from int-mx13.intmail.prod.int.phx2.redhat.com (int-mx13.intmail.prod.int.phx2.redhat.com [10.5.11.26]) (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 6FE85C05AA5B; Thu, 21 Jul 2016 17:10:02 +0000 (UTC) Received: from localhost.localdomain (ovpn-116-70.phx2.redhat.com [10.3.116.70]) by int-mx13.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id u6LHA17O012026; Thu, 21 Jul 2016 13:10:01 -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> Cc: gcc-patches@gcc.gnu.org From: Jeff Law Message-ID: <5c5a9b7f-f8cb-ce72-489f-3fad441c494c@redhat.com> Date: Thu, 21 Jul 2016 17:10:00 -0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.1.1 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit X-IsSubscribed: yes X-SW-Source: 2016-07/txt/msg01406.txt.bz2 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