From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 106672 invoked by alias); 14 Jul 2016 13:54:17 -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 106663 invoked by uid 89); 14 Jul 2016 13:54:16 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.5 required=5.0 tests=AWL,BAYES_00,FREEMAIL_FROM,RCVD_IN_DNSWL_NONE,SPF_PASS autolearn=ham version=3.3.2 spammy=Reading, superuser X-HELO: mail-yw0-f194.google.com Received: from mail-yw0-f194.google.com (HELO mail-yw0-f194.google.com) (209.85.161.194) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-GCM-SHA256 encrypted) ESMTPS; Thu, 14 Jul 2016 13:54:06 +0000 Received: by mail-yw0-f194.google.com with SMTP id c13so4970202ywh.2 for ; Thu, 14 Jul 2016 06:54:06 -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=AKUjSgJEX99hLRzyoCmJb4Ff4JSy9D7RhiN/ggEgBvc=; b=bTUJFeiF072vOKwKaWC1XIUdaF3eZvQ8b+IaSXenGju6lDEuk1JHKmRItwQws6eODF Gn0Njc7aUcArvwRQatyu0Tc2y7YrNczzezzsxBiZZoTk9brQdq1bD4utFCv1bzqczeYY 9IM9IK46wX53mlONeS6kAqcuTJD7LkzG+szo5h1Twem/ruL8PmNjsYGL869hsNcGovmQ fZr7xpaNe8BL+LsVW5SrLsWFvBqQwoSdWPNWymI4qVORRxI0Npvtmk3QDagcZZmgCJyE cHMCSvf3DmkY78ydJYgqr/C7gl1tpi8WPMOEWn8JU6pH1CsLsx1w7SMxB6BWk+nNLLuR D2vw== X-Gm-Message-State: ALyK8tKD/d0iRka8QOkCyqtuTiOrgnGok2Zy+vfyumkhWJRffZ21po9IwrAjJiYXKEMpJ8V5eETPPFE5T1kAlg== X-Received: by 10.37.209.5 with SMTP id i5mr9253346ybg.146.1468504444911; Thu, 14 Jul 2016 06:54:04 -0700 (PDT) MIME-Version: 1.0 Received: by 10.37.13.23 with HTTP; Thu, 14 Jul 2016 06:53:45 -0700 (PDT) In-Reply-To: References: <6d8cc2be-c68d-81f9-2274-6a12628b8caa@redhat.com> From: NightStrike Date: Thu, 14 Jul 2016 13:54:00 -0000 Message-ID: Subject: Re: [PATCH, contrib] download_prerequisites: check for existing symlinks before making new ones To: Eric Gallager Cc: Jeff Law , GCC Patches Content-Type: text/plain; charset=UTF-8 X-IsSubscribed: yes X-SW-Source: 2016-07/txt/msg00830.txt.bz2 On Thu, Jul 14, 2016 at 6:57 AM, Eric Gallager wrote: > On 7/13/16, Jeff Law wrote: >> On 06/27/2016 08:10 PM, Eric Gallager wrote: >>> The last time I ran ./contrib/download_prerequisites, I already had >>> previous symlinks set up from a previous run of the script, so `ln` >>> followed the existing symlinks and created the new ones in the >>> directories to which the symlinks pointed. This patch should fix that >>> by removing the old symlinks before creating new ones. (For some >>> reason the `-f` flag to `ln` that was already there wasn't enough for >>> me.) Tested by running the script and ensuring that the new isl >>> symlink pointed to the correct directory, and that there were no bad >>> symlinks in the old isl directory. Could someone commit this trivial >>> patch for me, or something like it? I don't have write access. >> I'd really rather know why the "-f" flag didn't work for you. The whole >> point of -f is to remove the destination file first. >> >> Jeff >> > > Reading my ln manpage, it describes the "-f" flag like this: > > > -f If the target file already exists, then unlink it so that the > link may occur. (The -f option overrides any previous -i > options.) > > Okay, so that seems like it should do what you say, but the manpage > also describes a separate uppercase "-F" option: > > -F If the target file already exists and is a directory, then > remove it so that the link may occur. The -F option should be > used with either -f or -i options. If none is specified, -f is > implied. The -F option is a no-op unless -s option is speci- > fied. > > So it seems to imply that "-f" will only remove the destination file > if it's a regular file, while "-F" is needed if the destination file > is a directory. The page also has this to say about "-F" later: > > The -F option is FreeBSD extention and should not be used in portable > scripts. > > So this could be a BSD vs. GNU thing. On GNU, -F means: -d, -F, --directory allow the superuser to attempt to hard link directories (note: will probably fail due to system restrictions, even for the superuser)