aboutsummaryrefslogtreecommitdiffstats
path: root/admin
diff options
context:
space:
mode:
authorPaul Eggert2015-10-10 18:03:49 -0700
committerPaul Eggert2015-10-10 18:11:27 -0700
commit29dfca23553b9995a8ec3b50090a652a6a0ecb01 (patch)
treea5d968df7cadd8259e029d89e6150dfe6762cb96 /admin
parentec0d4d24fd11b5040de9f7657b486c3b1e743071 (diff)
downloademacs-29dfca23553b9995a8ec3b50090a652a6a0ecb01.tar.gz
emacs-29dfca23553b9995a8ec3b50090a652a6a0ecb01.zip
Use ‘echo’ safely with ‘\’ or leading ‘-’
POSIX says that ‘echo FOO’ produces implementation-defined output if FOO contains leading ‘-’, or ‘\’ anywhere, so don’t assume GNU behavior in that case. * Makefile.in (removenullpaths): Remove. (epaths-force): Rewrite to avoid the need for ‘echo’. (install-etc): Be clearer about escaping the shell metacharacters ‘\’ and ‘$’. * Makefile.in (install-arch-indep, install-etcdoc): * admin/charsets/mapconv, admin/merge-gnulib, admin/merge-pkg-config: * admin/quick-install-emacs, build-aux/gitlog-to-emacslog: * configure.ac, lib-src/rcs2log, make-dist: * src/Makefile.in (lisp.mk): Don’t assume ‘echo’ outputs ‘\’ and leading ‘-’ unscathed. For example, use ‘printf '%s\n' "$foo"’ rather than ‘echo "$foo"’ if $foo can contain arbitrary characters. * lisp/Makefile.in (TAGS): Use ‘ls’, not ‘echo’, to avoid ‘\’ issues. * doc/lispref/two-volume.make (vol1.pdf): * test/etags/make-src/Makefile (web ftp publish): Use ‘printf’ rather than ‘echo -e’.
Diffstat (limited to 'admin')
-rwxr-xr-xadmin/charsets/mapconv5
-rwxr-xr-xadmin/merge-gnulib6
-rwxr-xr-xadmin/merge-pkg-config6
-rwxr-xr-xadmin/quick-install-emacs34
4 files changed, 26 insertions, 25 deletions
diff --git a/admin/charsets/mapconv b/admin/charsets/mapconv
index 32ba6421a86..3747ae2ad77 100755
--- a/admin/charsets/mapconv
+++ b/admin/charsets/mapconv
@@ -64,7 +64,7 @@ case "$3" in
64 KANJI-DATABASE) 64 KANJI-DATABASE)
65 SOURCE="http://kanji-database.cvs.sourceforge.net/viewvc/*checkout*/kanji-database/kanji-database/data/cns2ucsdkw.txt?revision=1.4";; 65 SOURCE="http://kanji-database.cvs.sourceforge.net/viewvc/*checkout*/kanji-database/kanji-database/data/cns2ucsdkw.txt?revision=1.4";;
66 *) 66 *)
67 echo "Unknown file type: $3"; 67 printf 'Unknown file type: %s\n' "$3"
68 exit 1;; 68 exit 1;;
69esac 69esac
70 70
@@ -147,7 +147,6 @@ elif [ "$3" = "KANJI-DATABASE" ] ; then
147 | sed -e 's/...\(....\) U+\([0-9A-F]*\).*/0x\1 0x\2/' \ 147 | sed -e 's/...\(....\) U+\([0-9A-F]*\).*/0x\1 0x\2/' \
148 | sort | ${AWKPROG} 148 | sort | ${AWKPROG}
149else 149else
150 echo "Invalid arguments: $3" 150 printf 'Invalid arguments: %s\n' "$3"
151 exit 1 151 exit 1
152fi 152fi
153
diff --git a/admin/merge-gnulib b/admin/merge-gnulib
index 963c3a06e1a..818dc1afce9 100755
--- a/admin/merge-gnulib
+++ b/admin/merge-gnulib
@@ -71,7 +71,7 @@ case $gnulib_srcdir in
71esac 71esac
72case $src in 72case $src in
73 -*) 73 -*)
74 echo >&2 "$0: usage: $0 [GNULIB_SRCDIR [SRCDIR]] 74 printf '%s\n' >&2 "$0: usage: $0 [GNULIB_SRCDIR [SRCDIR]]
75 75
76 SRCDIR is the Emacs source directory (default: working directory). 76 SRCDIR is the Emacs source directory (default: working directory).
77 GNULIB_SRCDIR is the Gnulib source directory (default: SRCDIR/../gnulib)." 77 GNULIB_SRCDIR is the Gnulib source directory (default: SRCDIR/../gnulib)."
@@ -79,7 +79,7 @@ case $src in
79esac 79esac
80 80
81test -x "$src"autogen.sh || { 81test -x "$src"autogen.sh || {
82 echo >&2 "$0: '${src:-.}' is not an Emacs source directory." 82 printf '%s\n' >&2 "$0: '${src:-.}' is not an Emacs source directory."
83 exit 1 83 exit 1
84} 84}
85 85
@@ -88,7 +88,7 @@ git clone -- "$GNULIB_URL" "$gnulib_srcdir" ||
88exit 88exit
89 89
90test -x "$gnulib_srcdir"/gnulib-tool || { 90test -x "$gnulib_srcdir"/gnulib-tool || {
91 echo >&2 "$0: '$gnulib_srcdir' is not a Gnulib source directory." 91 printf '%s\n' >&2 "$0: '$gnulib_srcdir' is not a Gnulib source directory."
92 exit 1 92 exit 1
93} 93}
94 94
diff --git a/admin/merge-pkg-config b/admin/merge-pkg-config
index 2ee633d36c1..302937269df 100755
--- a/admin/merge-pkg-config
+++ b/admin/merge-pkg-config
@@ -49,15 +49,15 @@
49 49
50 test -n "$dir" 50 test -n "$dir"
51} || { 51} || {
52 echo >&2 "$0: cannot find pkg.m4" 52 printf >&2 '%s\n' "$0: cannot find pkg.m4"
53 exit 1 53 exit 1
54} 54}
55 55
56test -d m4 || { 56test -d m4 || {
57 echo >&2 "$0: please run this command in the main source directory" 57 printf >&2 '%s\n' "$0: please run this command in the main source directory"
58 exit 1 58 exit 1
59} 59}
60 60
61echo >&2 "$0: copying $dir/pkg.m4 to m4/pkg.m4" 61printf >&2 '%s\n' "$0: copying $dir/pkg.m4 to m4/pkg.m4"
62 62
63cp $dir/pkg.m4 m4 63cp $dir/pkg.m4 m4
diff --git a/admin/quick-install-emacs b/admin/quick-install-emacs
index 55510fb0252..4de7416e3d6 100755
--- a/admin/quick-install-emacs
+++ b/admin/quick-install-emacs
@@ -121,11 +121,11 @@ EOF
121 -[!-]?*) 121 -[!-]?*)
122 # split concatenated single-letter options apart 122 # split concatenated single-letter options apart
123 FIRST="$1"; shift 123 FIRST="$1"; shift
124 set -- `echo $FIRST | sed 's/-\(.\)\(.*\)/-\1 -\2/'` "$@" 124 set -- `printf '%s\n' "$FIRST" | sed 's/-\(.\)\(.*\)/-\1 -\2/'` "$@"
125 ;; 125 ;;
126 -*) 126 -*)
127 echo 1>&2 "$me: unrecognized option '$1'" 127 printf '%s\n' >&2 "$me: unrecognized option '$1'"
128 echo 1>&2 "$TRY" 128 printf '%s\n' >&2 "$TRY"
129 exit 1 129 exit 1
130 ;; 130 ;;
131 *) 131 *)
@@ -140,17 +140,18 @@ case $# in
140 1) BUILD="$1";; 140 1) BUILD="$1";;
141 2) BUILD="$1"; prefix="$2";; 141 2) BUILD="$1"; prefix="$2";;
142 *) 142 *)
143 echo 1>&2 "$USAGE" 143 printf '%s\n' >&2 "$USAGE"
144 echo 1>&2 "$TRY" 144 printf '%s\n' >&2 "$TRY"
145 exit 1 145 exit 1
146 ;; 146 ;;
147esac 147esac
148 148
149if test ! -d "$BUILD"; then 149if test ! -d "$BUILD"; then
150 echo 1>&2 "$me: $BUILD: Build tree not found" 150 printf '%s\n' >&2 "$me: $BUILD: Build tree not found"
151 exit 2 151 exit 2
152elif test ! -r "$BUILD/config.status"; then 152elif test ! -r "$BUILD/config.status"; then
153 echo 1>&2 "$me: $BUILD: Not a proper build tree, config.status not found" 153 printf '%s\n' >&2 \
154 "$me: $BUILD: Not a proper build tree, config.status not found"
154 exit 2 155 exit 2
155fi 156fi
156 157
@@ -160,7 +161,8 @@ get_config_var ()
160 { sed -n "s/^S[[]\"$1\"[]]=\"\([^\"]*\)\"/\1/p" $CONFIG_STATUS | sed q | grep ''; } || 161 { sed -n "s/^S[[]\"$1\"[]]=\"\([^\"]*\)\"/\1/p" $CONFIG_STATUS | sed q | grep ''; } ||
161 { sed -n "s/^s\(.\)@$1@\1\(|#_!!_#|\)*\(.*\)\1.*$/\3/p" $CONFIG_STATUS | sed q | grep ''; } || 162 { sed -n "s/^s\(.\)@$1@\1\(|#_!!_#|\)*\(.*\)\1.*$/\3/p" $CONFIG_STATUS | sed q | grep ''; } ||
162 { 163 {
163 echo 1>&2 "$me: $1: Configuration variable not found in $CONFIG_STATUS" 164 printf '%s\n' >&2 \
165 "$me: $1: Configuration variable not found in $CONFIG_STATUS"
164 exit 4 166 exit 4
165 } 167 }
166} 168}
@@ -172,7 +174,7 @@ test x"$ARCH" = x && { ARCH="`get_config_var host`" || exit 4 ; }
172VERSION=` 174VERSION=`
173 sed -n 's/^AC_INIT(emacs,[ ]*\([^ )]*\).*/\1/p' <$SRC/configure.ac 175 sed -n 's/^AC_INIT(emacs,[ ]*\([^ )]*\).*/\1/p' <$SRC/configure.ac
174` || exit 4 176` || exit 4
175test -n "$VERSION" || { echo >&2 "$me: no version in configure.ac"; exit 4; } 177test -n "$VERSION" || { printf '%s\n' >&2 "$me: no version in configure.ac"; exit 4; }
176 178
177DST_SHARE="$prefix/share/emacs/$VERSION" 179DST_SHARE="$prefix/share/emacs/$VERSION"
178DST_BIN="$prefix/bin" 180DST_BIN="$prefix/bin"
@@ -209,7 +211,7 @@ maybe_mkdir "$DST_INFO"
209PRUNED="" 211PRUNED=""
210if test x"$PRUNE" != xno; then 212if test x"$PRUNE" != xno; then
211 for D in `ls -1t $BUILD/src/emacs-$VERSION.* | sed 1d`; do 213 for D in `ls -1t $BUILD/src/emacs-$VERSION.* | sed 1d`; do
212 echo $REMOVE_CMD $D 214 printf '%s\n' "$REMOVE_CMD $D"
213 PRUNED="$PRUNED $D" 215 PRUNED="$PRUNED $D"
214 done 216 done
215fi 217fi
@@ -219,7 +221,7 @@ test x"$PRUNE" = xonly && exit 0
219maybe_emit_copy () 221maybe_emit_copy ()
220{ 222{
221 if test "$FORCE" = yes || ! cmp -s $1 $2; then 223 if test "$FORCE" = yes || ! cmp -s $1 $2; then
222 echo $LINK_CMD $1 $2 224 printf '%s\n' "$LINK_CMD $1 $2"
223 fi 225 fi
224} 226}
225 227
@@ -240,7 +242,7 @@ for SUBDIR in lisp leim etc lib-src info; do
240 # defaults 242 # defaults
241 SHARED=no 243 SHARED=no
242 FORCED='' 244 FORCED=''
243 AVOID_PAT="`echo "($AVOID)" | tr ' ' '|'`" 245 AVOID_PAT="`printf '%s\n' "($AVOID)" | tr ' ' '|'`"
244 246
245 # Set subdir-specific values 247 # Set subdir-specific values
246 case $SUBDIR in 248 case $SUBDIR in
@@ -255,7 +257,7 @@ for SUBDIR in lisp leim etc lib-src info; do
255 ;; 257 ;;
256 lib-src) 258 lib-src)
257 DST="$DST_LIBEXEC" 259 DST="$DST_LIBEXEC"
258 AVOID_PAT="`echo "($AVOID ($PUBLIC_LIBSRC_BINARIES)\$)" | tr ' ' '|'`" 260 AVOID_PAT="`printf '%s\n' "($AVOID ($PUBLIC_LIBSRC_BINARIES)\$)" | tr ' ' '|'`"
259 ;; 261 ;;
260 info) 262 info)
261 DST="$DST_INFO" 263 DST="$DST_INFO"
@@ -267,10 +269,10 @@ for SUBDIR in lisp leim etc lib-src info; do
267 if [ -d $PFX/$SUBDIR ]; then 269 if [ -d $PFX/$SUBDIR ]; then
268 for DIR in `(cd $PFX/$SUBDIR; find . -type d -print | sed 's@^./@@')`; do 270 for DIR in `(cd $PFX/$SUBDIR; find . -type d -print | sed 's@^./@@')`; do
269 if [ -d $DST/$DIR ]; then 271 if [ -d $DST/$DIR ]; then
270 echo Directory $DST/$DIR exists 272 printf '%s\n' "Directory $DST/$DIR exists"
271 else 273 else
272 echo Directory $DST/$DIR non-existent 274 printf '%s\n' "Directory $DST/$DIR non-existent"
273 if [ "`echo $DIR | egrep -v "$AVOID_PAT"`" ]; then 275 if [ "`printf '%s\n' "$DIR" | grep -Ev "$AVOID_PAT"`" ]; then
274 maybe_mkdir $DST/$DIR 276 maybe_mkdir $DST/$DIR
275 fi 277 fi
276 fi 278 fi