From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by sourceware.org (Postfix) with ESMTP id 9D0EF3858C20 for ; Thu, 10 Mar 2022 11:43:55 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 9D0EF3858C20 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id CCC191691; Thu, 10 Mar 2022 03:43:54 -0800 (PST) Received: from [10.57.21.174] (unknown [10.57.21.174]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 4C6523F7D8; Thu, 10 Mar 2022 03:43:54 -0800 (PST) Message-ID: <71ea13bf-ae8a-7458-ec2d-5a1c2d2018c2@foss.arm.com> Date: Thu, 10 Mar 2022 11:43:52 +0000 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.5.0 Subject: Re: [PATCH] contrib: Avoid use of "echo -n" in git customization [PR102664] Content-Language: en-GB To: Jonathan Wakely Cc: "gcc-patches@gcc.gnu.org" References: From: Richard Earnshaw In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-3495.6 required=5.0 tests=BAYES_00, BODY_8BITS, GIT_PATCH_0, KAM_DMARC_STATUS, KAM_LAZY_DOMAIN_SECURITY, NICE_REPLY_A, SPF_HELO_NONE, SPF_NONE, TXREP, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 10 Mar 2022 11:43:56 -0000 On 09/03/2022 15:05, Jonathan Wakely via Gcc-patches wrote: > On 09/03/22 12:15 +0000, Richard Earnshaw wrote: >> The -n option to echo is non-portable.  The generally recommended >> alternative is to use the shell printf command. >> >> contrib/ChangeLog: >> >>     PR other/102664 >>     * gcc-git-customization.sh (ask): Use printf instead of echo -n. >> >> diff --git a/contrib/gcc-git-customization.sh >> b/contrib/gcc-git-customization.sh >> index b24948d9874..cf46c494a6a 100755 >> --- a/contrib/gcc-git-customization.sh >> +++ b/contrib/gcc-git-customization.sh >> @@ -7,7 +7,7 @@ ask () { >>     question=$1 >>     default=$2 >>     var=$3 >> -    echo -n $question "["$default"]? " >> +    printf "%s" "$question [$default]? " >>     read answer >>     if [ "x$answer" = "x" ] >>     then > > This isn't enough to get the script working on AIX and Solaris. The > attached patch has been tested on Fedora Linux, NetBSD 9.2, AIX 7 and > Solaris 11. > > The part checking the result of `git rev-parse --git-path hooks` was > needed to work around Git 2.4.0 on gcc211 in the compile farm, which > is a Solaris 11 sparc box. That's a truly ancient version, but > handling the error (and just skipping installation of the hook) isn't > difficult, so seems worthwhile. I can revert that part if preferred. > > OK for trunk? > > OK.