config-patches
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug: shell variable quoting in config.guess


From: M. Levinson
Subject: bug: shell variable quoting in config.guess
Date: Tue, 19 Jan 2021 08:49:34 -0500

After commit 827c77253b396c07306927b2a4b794a3251c48eb in the GNU config
repository, word splitting is no longer performed on the $sysctl shell
variable in config.guess:

        sysctl="sysctl -n hw.machine_arch"
        UNAME_MACHINE_ARCH=$( (uname -p 2>/dev/null || \
            "/sbin/$sysctl" 2>/dev/null || \
            "/usr/sbin/$sysctl" 2>/dev/null || \
            echo unknown))

This would attempt to run an executable named "sysctl -n hw.machine_arch"
(instead of an executable named "sysctl").

It could be fixed by removing the quotes again, or by spelling out the full
command twice instead of using a shell variable at all. Two alternative
patches are attached.
diff --git a/config.guess b/config.guess
index f772702..aca04e8 100755
--- a/config.guess
+++ b/config.guess
@@ -190,8 +190,8 @@ case 
"$UNAME_MACHINE:$UNAME_SYSTEM:$UNAME_RELEASE:$UNAME_VERSION" in
        # portion of the name.  We always set it to "unknown".
        sysctl="sysctl -n hw.machine_arch"
        UNAME_MACHINE_ARCH=$( (uname -p 2>/dev/null || \
-           "/sbin/$sysctl" 2>/dev/null || \
-           "/usr/sbin/$sysctl" 2>/dev/null || \
+           /sbin/$sysctl 2>/dev/null || \
+           /usr/sbin/$sysctl 2>/dev/null || \
            echo unknown))
        case "$UNAME_MACHINE_ARCH" in
            aarch64eb) machine=aarch64_be-unknown ;;
diff --git a/config.guess b/config.guess
index f772702..552d639 100755
--- a/config.guess
+++ b/config.guess
@@ -188,10 +188,9 @@ case 
"$UNAME_MACHINE:$UNAME_SYSTEM:$UNAME_RELEASE:$UNAME_VERSION" in
        #
        # Note: NetBSD doesn't particularly care about the vendor
        # portion of the name.  We always set it to "unknown".
-       sysctl="sysctl -n hw.machine_arch"
        UNAME_MACHINE_ARCH=$( (uname -p 2>/dev/null || \
-           "/sbin/$sysctl" 2>/dev/null || \
-           "/usr/sbin/$sysctl" 2>/dev/null || \
+           /sbin/sysctl -n hw.machine_arch 2>/dev/null || \
+           /usr/sbin/sysctl -n hw.machine_arch 2>/dev/null || \
            echo unknown))
        case "$UNAME_MACHINE_ARCH" in
            aarch64eb) machine=aarch64_be-unknown ;;

reply via email to

[Prev in Thread] Current Thread [Next in Thread]