diff options
author | Paul Eggert <eggert@cs.ucla.edu> | 2015-10-10 18:03:49 -0700 |
---|---|---|
committer | Paul Eggert <eggert@cs.ucla.edu> | 2015-10-10 18:11:27 -0700 |
commit | 29dfca23553b9995a8ec3b50090a652a6a0ecb01 (patch) | |
tree | a5d968df7cadd8259e029d89e6150dfe6762cb96 /lib-src/rcs2log | |
parent | ec0d4d24fd11b5040de9f7657b486c3b1e743071 (diff) | |
download | emacs-29dfca23553b9995a8ec3b50090a652a6a0ecb01.tar.gz |
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 'lib-src/rcs2log')
-rwxr-xr-x | lib-src/rcs2log | 20 |
1 files changed, 11 insertions, 9 deletions
diff --git a/lib-src/rcs2log b/lib-src/rcs2log index d1bd3693183..4ee303d03a1 100755 --- a/lib-src/rcs2log +++ b/lib-src/rcs2log @@ -130,7 +130,8 @@ do case $1 in -n) case ${2?}${3?}${4?} in *"$tab"* | *"$nl"*) - echo >&2 "$0: -n '$2' '$3' '$4': tabs, newlines not allowed" + printf '%s\n' >&2 \ + "$0: -n '$2' '$3' '$4': tabs, newlines not allowed" exit 1;; esac login=$2 @@ -140,7 +141,7 @@ do # If $2 is not tab-separated, use colon for separator. case ${2?} in *"$nl"*) - echo >&2 "$0: -u '$2': newlines not allowed" + printf '%s\n' >&2 "$0: -u '$2': newlines not allowed" exit 1;; *"$tab"*) t=$tab;; @@ -149,7 +150,7 @@ do esac case $2 in *"$t"*"$t"*"$t"*) - echo >&2 "$0: -u '$2': too many fields" + printf '%s\n' >&2 "$0: -u '$2': too many fields" exit 1;; *"$t"*"$t"*) uf="[^$t]*$t" # An unselected field, followed by a separator. @@ -161,7 +162,7 @@ do expr "X$2" : "$uf$uf$sf" `;; *) - echo >&2 "$0: -u '$2': not enough fields" + printf '%s\n' >&2 "$0: -u '$2': not enough fields" exit 1;; esac shift;; @@ -186,9 +187,9 @@ do --version) set $Id rcs2logVersion=$3 - echo >&2 "rcs2log (GNU Emacs) $rcs2logVersion$nl$Copyright" + printf '%s\n' >&2 "rcs2log (GNU Emacs) $rcs2logVersion$nl$Copyright" exit 0;; - -*) echo >&2 "Usage: $0 [OPTION]... [FILE ...]$nl$Help" + -*) printf '%s\n' >&2 "Usage: $0 [OPTION]... [FILE ...]$nl$Help" case $1 in --help) exit 0;; *) exit 1;; @@ -303,7 +304,8 @@ case $rlogfile in esac if test ! -d "$repository" then - echo >&2 "$0: $repository: bad repository (see CVS/Repository)" + printf '%s\n' >&2 \ + "$0: $repository: bad repository (see CVS/Repository)" exit 1 fi pository=$repository;; @@ -330,7 +332,7 @@ case $rlogfile in T?*) rlog_options=-r`expr "$CVSTAG" : 'T\(.*\)'`;; *) - echo >&2 "$0: invalid CVS/Tag"; exit 1;; + printf '%s\n' >&2 "$0: invalid CVS/Tag"; exit 1;; esac fi;; esac @@ -595,7 +597,7 @@ case $hostname in hostname=`( hostname || uname -n || uuname -l || cat /etc/whoami ) 2>/dev/null` || { - echo >&2 "$0: cannot deduce hostname" + printf '%s\n' >&2 "$0: cannot deduce hostname" exit 1 } |