[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
shell portability: don't use `set --'
From: |
Ralf Wildenhues |
Subject: |
shell portability: don't use `set --' |
Date: |
Tue, 21 Dec 2004 10:20:59 +0100 |
User-agent: |
Mutt/1.5.6+20040907i |
I haven't seen a shell fail explicitly on this. Can someone assert
whether this (easy) workaround is still necessary for shells in use?
If so, OK to apply to HEAD and branch-2-0?
Regards,
Ralf
* Makefile.am, bootstrap, clcommit.m4sh, libtoolize.m4sh,
config/ltmain.m4sh: Replace `set --' with `set x [...]; shift'
for portability.
Index: Makefile.am
===================================================================
RCS file: /cvsroot/libtool/libtool/Makefile.am,v
retrieving revision 1.137
diff -u -r1.137 Makefile.am
--- Makefile.am 20 Dec 2004 13:08:33 -0000 1.137
+++ Makefile.am 21 Dec 2004 07:07:24 -0000
@@ -46,9 +46,9 @@
-e 's,@prefix\@,$(prefix),g' \
-e "s,@configure_input\@,Generated from $$input; do not edit by hand,g"
-timestamp = set -- `$(MKSTAMP) < $(top_srcdir)/ChangeLog`; \
+timestamp = set x `$(MKSTAMP) < $(top_srcdir)/ChangeLog`; \
case $(VERSION) in \
- *[acegikmoqsuwy]) TIMESTAMP=" $$1 $$2 $$3" ;; \
+ *[acegikmoqsuwy]) TIMESTAMP=" $$2 $$3 $$4" ;; \
*) TIMESTAMP="" ;; \
esac
@@ -101,8 +101,8 @@
MKSTAMP = $(SHELL) $(top_srcdir)/config/mkstamp
$(top_srcdir)/stamp-vcl: vcl-tmp clean-ltmain-sh ChangeLog
vcl-tmp:
- @set -- `$(MKSTAMP) < $(top_srcdir)/ChangeLog`; \
- echo "$$1" > vcl.tmp; \
+ @set x `$(MKSTAMP) < $(top_srcdir)/ChangeLog`; \
+ echo "$$2" > vcl.tmp; \
cmp -s vcl.tmp $(top_srcdir)/stamp-vcl \
|| (echo "Updating stamp-vcl"; cp vcl.tmp $(top_srcdir)/stamp-vcl)
address@hidden -f vcl.tmp
@@ -124,12 +124,12 @@
# how ltversion.m4 appears in our dependencies.
EXTRA_DIST += m4/ltversion.in m4/ltversion.m4
$(top_srcdir)/m4/ltversion.m4: m4/ltversion.in configure.ac
$(top_srcdir)/stamp-vcl
- set -- `$(MKSTAMP) < $(top_srcdir)/ChangeLog`; \
+ set x `$(MKSTAMP) < $(top_srcdir)/ChangeLog`; \
cd $(top_srcdir); \
rm -f m4/ltversion.tmp; \
- serial=`echo $$1 | sed 's,^1[.],,g'`; \
+ serial=`echo $$2 | sed 's,^1[.],,g'`; \
input="ltversion.in"; \
- $(edit) -e "s,@MACRO_REVISION\@,$$1,g" \
+ $(edit) -e "s,@MACRO_REVISION\@,$$2,g" \
-e "s,@MACRO_SERIAL\@,$$serial,g" \
m4/ltversion.in > m4/ltversion.tmp; \
chmod a-w m4/ltversion.tmp; \
Index: bootstrap
===================================================================
RCS file: /cvsroot/libtool/libtool/bootstrap,v
retrieving revision 1.55
diff -u -r1.55 bootstrap
--- bootstrap 24 Nov 2004 14:55:54 -0000 1.55
+++ bootstrap 21 Dec 2004 07:07:26 -0000
@@ -49,7 +49,8 @@
fi
# Extract the package name and version number from configure.ac:
-set -- `sed '/AC_INIT/{s/[][,()]/ /g; p;};d' configure.ac`
+set x `sed '/AC_INIT/{s/[][,()]/ /g; p;};d' configure.ac`
+shift
# Whip up some dirty Makefiles:
makefiles=
Index: clcommit.m4sh
===================================================================
RCS file: /cvsroot/libtool/libtool/clcommit.m4sh,v
retrieving revision 1.6
diff -u -r1.6 clcommit.m4sh
--- clcommit.m4sh 19 Nov 2004 17:04:22 -0000 1.6
+++ clcommit.m4sh 21 Dec 2004 07:07:26 -0000
@@ -130,7 +130,7 @@
set -x
;;
- --fast) set -- --force --first ${1+"$@"} ;;
+ --fast) set x --force --first ${1+"$@"}; shift ;;
-f|--force) opt_update=false; PAGER=cat ;;
@@ -200,7 +200,8 @@
fi
# The funny quoting allows keeping one option per
# line in $rc_file:
- eval set -- `echo \`cat $rc_file\`
\\\${1+\"address@hidden"}`
+ eval set x `echo \`cat $rc_file\`
\\\${1+\"address@hidden"}`
+ shift
;;
-s|--sendmail) test $# = 0 && func_missing_arg $opt && break
@@ -246,21 +247,24 @@
--*=*)
arg=`echo "$opt" | $SED "$my_sed_long_arg"`
opt=`echo "$opt" | $SED "$my_sed_long_opt"`
- set -- "$opt" "$arg" ${1+"$@"}
+ set x "$opt" "$arg" ${1+"$@"}
+ shift
;;
# Separate optargs to short options:
-m*|-F*|-C*|-S*|-s*|-z*)
arg=`echo "$opt" |$SED "$my_sed_single_rest"`
opt=`echo "$opt" |$SED "$my_sed_single_opt"`
- set -- "$opt" "$arg" ${1+"$@"}
+ set x "$opt" "$arg" ${1+"$@"}
+ shift
;;
# Separate non-argument short options:
-f*|-1*|-n*|-q*)
rest=`echo "$opt" |$SED "$my_sed_single_rest"`
opt=`echo "$opt" |$SED "$my_sed_single_opt"`
- set -- "$opt" "-$rest" ${1+"$@"}
+ set x "$opt" "-$rest" ${1+"$@"}
+ shift
;;
-\?|-h) func_usage ;;
@@ -268,7 +272,7 @@
--version) func_version ;;
--) break ;;
-*) func_fatal_help "unrecognized option \`$opt'" ;;
- *) set -- "$opt" ${1+"$@"}; break ;;
+ *) set x "$opt" ${1+"$@"}; shift; break ;;
esac
done
Index: libtoolize.m4sh
===================================================================
RCS file: /cvsroot/libtool/libtool/libtoolize.m4sh,v
retrieving revision 1.6
diff -u -r1.6 libtoolize.m4sh
--- libtoolize.m4sh 20 Dec 2004 13:08:34 -0000 1.6
+++ libtoolize.m4sh 21 Dec 2004 07:07:27 -0000
@@ -159,14 +159,16 @@
--*=*)
arg=`$ECHO "X$opt" | $Xsed -e "$my_sed_long_arg"`
opt=`$ECHO "X$opt" | $Xsed -e "$my_sed_long_opt"`
- set -- "$opt" "$arg" ${1+"$@"}
+ set x "$opt" "$arg" ${1+"$@"}
+ shift
;;
# Separate non-argument short options:
-c*|-i*|-f*|-n*|-q*|-v*)
rest=`$ECHO "X$opt" | $Xsed -e "$my_sed_single_rest"`
opt=`$ECHO "X$opt" | $Xsed -e "$my_sed_single_opt"`
- set -- "$opt" "-$rest" ${1+"$@"}
+ set x "$opt" "-$rest" ${1+"$@"}
+ shift
;;
-\?|-h) func_usage ;;
Index: config/ltmain.m4sh
===================================================================
RCS file: /cvsroot/libtool/libtool/config/ltmain.m4sh,v
retrieving revision 1.36
diff -u -r1.36 ltmain.m4sh
--- config/ltmain.m4sh 20 Dec 2004 15:03:39 -0000 1.36
+++ config/ltmain.m4sh 21 Dec 2004 07:07:33 -0000
@@ -406,25 +406,25 @@
# Shorthand for --mode=foo, only valid as the first argument
case $1 in
clean|clea|cle|cl)
- shift; set -- --mode clean ${1+"$@"}
+ shift; set x --mode clean ${1+"$@"}; shift
;;
compile|compil|compi|comp|com|co|c)
- shift; set -- --mode compile ${1+"$@"}
+ shift; set x --mode compile ${1+"$@"}; shift
;;
execute|execut|execu|exec|exe|ex|e)
- shift; set -- --mode execute ${1+"$@"}
+ shift; set x --mode execute ${1+"$@"}; shift
;;
finish|finis|fini|fin|fi|f)
- shift; set -- --mode finish ${1+"$@"}
+ shift; set x --mode finish ${1+"$@"}; shift
;;
install|instal|insta|inst|ins|in|i)
- shift; set -- --mode install ${1+"$@"}
+ shift; set x --mode install ${1+"$@"}; shift
;;
link|lin|li|l)
- shift; set -- --mode link ${1+"$@"}
+ shift; set x --mode link ${1+"$@"}; shift
;;
uninstall|uninstal|uninsta|uninst|unins|unin|uni|un|u)
- shift; set -- --mode uninstall ${1+"$@"}
+ shift; set x --mode uninstall ${1+"$@"}; shift
;;
esac
@@ -490,21 +490,24 @@
-dlopen=*|--mode=*|--tag=*)
arg=`$ECHO "X$opt" | $Xsed -e "$my_sed_long_arg"`
opt=`$ECHO "X$opt" | $Xsed -e "$my_sed_long_opt"`
- set -- "$opt" "$arg" ${1+"$@"}
+ set x "$opt" "$arg" ${1+"$@"}
+ shift
;;
# Separate optargs to short options:
# -x*|-y*)
# arg=`$ECHO "X$opt" |$Xsed -e "$my_sed_single_rest"`
# opt=`$ECHO "X$opt" |$Xsed -e "$my_sed_single_opt"`
-# set -- "$opt" "$arg" ${1+"$@"}
+# set x "$opt" "$arg" ${1+"$@"}
+# shift
# ;;
# Separate non-argument short options:
# -z*|-z*|-y*)
# rest=`$ECHO "X$opt" |$Xsed -e "$my_sed_single_rest"`
# opt=`$ECHO "X$opt" |$Xsed -e "$my_sed_single_opt"`
-# set -- "$opt" "-$rest" ${1+"$@"}
+# set x "$opt" "-$rest" ${1+"$@"}
+# shift
# ;;
-\?|-h) func_usage ;;
- shell portability: don't use `set --',
Ralf Wildenhues <=