[PATCH 3/4] {minor} install-sh: assume that "set -f" and "set +f" work...

Stefano Lattarini <[email protected]>
Newsgroups gmane.comp.sysutils.automake.patches
Message-ID <006ca8d920f41c9bcc157e53e92b420d7a8f162e.1383264207.git.stefano.lattarini@gmail.com>
... and disable/enable shell globbing, respectively.  This is
mandated by POSIX, and supported even by Solaris 9 /bin/sh (one
of the most braindead shells we still support).

* lib/install.sh: Adjust.
* NEWS: Update.

Signed-off-by: Stefano Lattarini <[email protected]>
---
 NEWS           |  4 +++-
 lib/install-sh | 24 ++++--------------------
 2 files changed, 7 insertions(+), 21 deletions(-)

diff --git a/NEWS b/NEWS
index 37f513b..da41307 100644
--- a/NEWS
+++ b/NEWS
@@ -109,9 +109,11 @@ New in 1.15:
 * Cleanups and modernizations:
 
   - The install-sh script has been modernized, and now makes the following
-    assumptions unconditionally:
+    assumptions *unconditionally*:
     (1) a working 'dirname' program is available;
     (2) the ${var:-value} shell parameters substitution works;
+    (3) the "set -f" and "set +f" shell commands work, and, respectively,
+        disable and enable shell globbing.
 
 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 
diff --git a/lib/install-sh b/lib/install-sh
index 9a7bad8..be3c5d9 100755
--- a/lib/install-sh
+++ b/lib/install-sh
@@ -63,17 +63,6 @@ mvprog=${MVPROG-mv}
 rmprog=${RMPROG-rm}
 stripprog=${STRIPPROG-strip}
 
-posix_glob='?'
-initialize_posix_glob='
-  test "$posix_glob" != "?" || {
-    if (set -f) 2>/dev/null; then
-      posix_glob=
-    else
-      posix_glob=:
-    fi
-  }
-'
-
 posix_mkdir=
 
 # Desired mode of installed file.
@@ -365,14 +354,12 @@ do
 	*)  prefix='';;
       esac
 
-      eval "$initialize_posix_glob"
-
       oIFS=$IFS
       IFS=/
-      $posix_glob set -f
+      set -f
       set fnord $dstdir
       shift
-      $posix_glob set +f
+      set +f
       IFS=$oIFS
 
       prefixes=
@@ -443,13 +430,10 @@ do
     if $copy_on_change &&
        old=`LC_ALL=C ls -dlL "$dst"	2>/dev/null` &&
        new=`LC_ALL=C ls -dlL "$dsttmp"	2>/dev/null` &&
-
-       eval "$initialize_posix_glob" &&
-       $posix_glob set -f &&
+       set -f &&
        set X $old && old=:$2:$4:$5:$6 &&
        set X $new && new=:$2:$4:$5:$6 &&
-       $posix_glob set +f &&
-
+       set +f &&
        test "$old" = "$new" &&
        $cmpprog "$dst" "$dsttmp" >/dev/null 2>&1
     then
-- 
1.8.3.1.605.g85318f5
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.