[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 3/4] {minor} install-sh: assume that "set -f" and "set +f" work..
From: |
Stefano Lattarini |
Subject: |
[PATCH 3/4] {minor} install-sh: assume that "set -f" and "set +f" work... |
Date: |
Fri, 1 Nov 2013 00:09:35 +0000 |
... 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 <address@hidden>
---
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
- [PATCH] test-driver: optionally run in test directory, Philipp A. Hartmann, 2013/10/25
- Re: [PATCH] test-driver: optionally run in test directory, Stefano Lattarini, 2013/10/28
- Re: [PATCH] test-driver: optionally run in test directory, Philipp A. Hartmann, 2013/10/29
- Re: [PATCH] test-driver: optionally run in test directory, Stefano Lattarini, 2013/10/30
- [PATCH 0/4] {minor} Modernize the install-sh script, Stefano Lattarini, 2013/10/31
- [PATCH 1/4] {minor} install-sh: assume 'dirname' is available and working correctly, Stefano Lattarini, 2013/10/31
- [PATCH 2/4] {minor} install-sh: assume ${var:-value} works as expected, Stefano Lattarini, 2013/10/31
- [PATCH 3/4] {minor} install-sh: assume that "set -f" and "set +f" work...,
Stefano Lattarini <=
- [PATCH 4/4] {minor} cosmetics: untabify the install-sh script, Stefano Lattarini, 2013/10/31