From patchwork Thu Jul 21 19:39:12 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eric Gallager X-Patchwork-Id: 651429 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3rwPHW4jDrz9t0h for ; Fri, 22 Jul 2016 05:39:35 +1000 (AEST) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b=vT+9H4k9; dkim-atps=neutral DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender :mime-version:in-reply-to:references:from:date:message-id :subject:to:cc:content-type; q=dns; s=default; b=lDMabQiK4/Q3Pq5 PeoFWkXWLZSALce9MtWt7qH00Mfvf4nA2fPIDX45fg3/+OBX5R7RvMulj63nJRGa HwC7rd+szJK8ke8hJ9R9J8g0KerjcFWEU6A3Zlc+N0Zk5tHn0VesBWVhe68LEUPe m6D3kk8HWZRfA9a6cSzbtdvtM+J8= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender :mime-version:in-reply-to:references:from:date:message-id :subject:to:cc:content-type; s=default; bh=XCXRd0Ze51VqFEuWit73d 8Ey7Rg=; b=vT+9H4k9GeWRrtHoGH+E4G39CwagEzMvrQGhPUB8EkCq4j7EP3BFh Rp0dLAGg73l02uhgb1V42bR3FrOs+NtUg5tPbrP/6GUq4LDJqXcOSYI6IkqqtdTI +aCQ1MmpvVzJSm9ldm/ht35t/vWA5m2XiSHf4vSYG/H8U+pSi0hHTg= Received: (qmail 43257 invoked by alias); 21 Jul 2016 19:39:27 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org Received: (qmail 43227 invoked by uid 89); 21 Jul 2016 19:39:26 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.6 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_LOW, SPF_PASS autolearn=ham version=3.3.2 spammy=Hx-languages-length:2348, ISL, H*RU:209.85.220.196, Hx-spam-relays-external:209.85.220.196 X-HELO: mail-qk0-f196.google.com Received: from mail-qk0-f196.google.com (HELO mail-qk0-f196.google.com) (209.85.220.196) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-GCM-SHA256 encrypted) ESMTPS; Thu, 21 Jul 2016 19:39:15 +0000 Received: by mail-qk0-f196.google.com with SMTP id p126so7114631qke.1 for ; Thu, 21 Jul 2016 12:39:15 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=D+sn0V/VXZla7x6A0fDq6in3hfPQ8P/4D3qsQxPdOk4=; b=SrHbWLtLxOaraxZ7fhDer/jLNet7o0I+4wgWDswnoJ0QnlHCMOG6G37nDQu1xjzdKk HtFQvsBJFPGzbFoVgJDAP9KwC7XNxb6x5unbMmYlP8Pg95Edbzp5neOBdG1rP1e6AdYA YrrrlRukwjt5+G+lIKVL7paTEWbaQ188mTSihOdkMHdEpDW2zAdKYQYG4sT3nuvSF+wa ODZfbfz7062NT8bwIz9V8lbSapEGHM/HiqKClMvEVuZLeY1ceOCJ+NmE4x8mhN+Yvs17 7CL+uxKUu6AKm1VPxEBfPkECEHBF+kyWx17edT+WbojPK4/2P8MayMvjcrreSZ3oiFdY xfaQ== X-Gm-Message-State: ALyK8tJmLS5812D0nFRREr0rNqHe9Do7EsUGIqiwTx8kMO7CeFeK4L3T4ZphJYbMWcz3bBvYxp6vW+Hfp0zzmd71 X-Received: by 10.55.126.7 with SMTP id z7mr67938532qkc.172.1469129953427; Thu, 21 Jul 2016 12:39:13 -0700 (PDT) MIME-Version: 1.0 Received: by 10.55.201.208 with HTTP; Thu, 21 Jul 2016 12:39:12 -0700 (PDT) In-Reply-To: <5c5a9b7f-f8cb-ce72-489f-3fad441c494c@redhat.com> References: <6d8cc2be-c68d-81f9-2274-6a12628b8caa@redhat.com> <218664c9-aeec-c213-eba3-570ba8879516@redhat.com> <5c5a9b7f-f8cb-ce72-489f-3fad441c494c@redhat.com> From: Eric Gallager Date: Thu, 21 Jul 2016 15:39:12 -0400 Message-ID: Subject: Re: [PATCH, contrib] download_prerequisites: check for existing symlinks before making new ones To: Jeff Law Cc: gcc-patches@gcc.gnu.org, bernd.edlinger@hotmail.de 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. Eric contrib/download_prerequisites | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/contrib/download_prerequisites b/contrib/download_prerequisites index 917ee23..2c963f2 100755 --- a/contrib/download_prerequisites +++ b/contrib/download_prerequisites @@ -36,14 +36,17 @@ MPC=mpc-1.0.3 wget ftp://gcc.gnu.org/pub/gcc/infrastructure/$MPFR.tar.bz2 || exit 1 tar xjf $MPFR.tar.bz2 || exit 1 +if test -L mpfr; then rm -f mpfr; fi ln -sf $MPFR mpfr || exit 1 wget ftp://gcc.gnu.org/pub/gcc/infrastructure/$GMP.tar.bz2 || exit 1 tar xjf $GMP.tar.bz2 || exit 1 +if test -L gmp; then rm -f gmp; fi ln -sf $GMP gmp || exit 1 wget ftp://gcc.gnu.org/pub/gcc/infrastructure/$MPC.tar.gz || exit 1 tar xzf $MPC.tar.gz || exit 1 +if test -L mpc; then rm -f mpc; fi ln -sf $MPC mpc || exit 1 # Necessary to build GCC with the Graphite loop optimizations. @@ -52,5 +55,6 @@ if [ "$GRAPHITE_LOOP_OPT" = "yes" ] ; then wget ftp://gcc.gnu.org/pub/gcc/infrastructure/$ISL.tar.bz2 || exit 1 tar xjf $ISL.tar.bz2 || exit 1 + if test -L isl; then rm -f isl; fi ln -sf $ISL isl || exit 1 fi