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.

Reply via email to