From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 111798 invoked by alias); 22 Jul 2016 22:28:22 -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 111784 invoked by uid 89); 22 Jul 2016 22:28:22 -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= 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; Fri, 22 Jul 2016 22:28:21 +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 C3D2863E23; Fri, 22 Jul 2016 22:28:19 +0000 (UTC) Received: from localhost.localdomain (ovpn-116-70.phx2.redhat.com [10.3.116.70]) by int-mx11.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id u6MMSIOT002404; Fri, 22 Jul 2016 18:28:19 -0400 Subject: Re: [PATCH, contrib] download_prerequisites: check for existing symlinks before making new ones To: Bernd Edlinger , Eric Gallager References: Cc: "gcc-patches@gcc.gnu.org" From: Jeff Law Message-ID: <11f60f61-1905-ef48-b2fd-e7c78ea7d628@redhat.com> Date: Fri, 22 Jul 2016 22:28: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/msg01519.txt.bz2 On 07/21/2016 12:15 PM, Bernd Edlinger wrote: > Hi, > > > So rather than relying on ln to remove the link, why don't we just > > explicitly remove it with rm -f? > > sounds good, I ran into similar issues already. > > ln -nfs does not follow the target if it is a symlink > > -n, --no-dereference > treat LINK_NAME as a normal file if it is a symbolic > link to a > directory > > > but I think a simple rm -f will do as well, and avoid potential > interoperability issues. > > However wget has a similar issue, if the $MPFR.tar.gz file is already > there, maybe incomplete, the wget chooses a new name, so I'd suggest > to rm -f that file as well, and the whole $MPFR subtree while you are > already there. Agreed. And naturally the question is do we bother to check the return code from the rm -f? I think we should and exit with an error if it fails. jeff