[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
FYI: fix sed syntax
From: |
Ralf Wildenhues |
Subject: |
FYI: fix sed syntax |
Date: |
Sat, 21 Jan 2006 17:45:44 +0100 |
User-agent: |
Mutt/1.5.9i |
See here for the rationale to this largish patch:
http://article.gmane.org/gmane.comp.sysutils.autoconf.patches/2649
Applied to HEAD (the corresponding branch-1-5 patch will appear in a
followup post). Gary, could you push the mailnotify/clcommit changes
upstream? Thank you.
Cheers,
Ralf
* bootstrap: Don't use semicolons inside { } in sed scripts, as
Posix says it's not portable.
* Makefile.am (libltdl/Makefile.am): Likewise.
* libtoolize.m4sh (all over the map): Likewise.
* libltdl/config/getopt.m4sh (func_version, func_usage)
(func_help): Likewise.
* libltdl/config/ltmain.m4sh (func_win32_libid): Likewise.
* libltdl/m4/libtool.m4 (_LT_SYS_MODULE_PATH_AIX): Likewise.
* clcommit.m4sh, libltdl/config/mailnotify.m4sh: Likewise.
* tests/sh.test, tests/testsuite.at (LT_AT_TAG): Likewise.
Noted by Paul Eggert <address@hidden>.
Index: bootstrap
===================================================================
RCS file: /cvsroot/libtool/libtool/bootstrap,v
retrieving revision 1.74
diff -u -r1.74 bootstrap
--- bootstrap 7 Dec 2005 20:46:54 -0000 1.74
+++ bootstrap 21 Jan 2006 10:31:34 -0000
@@ -99,7 +99,11 @@
fi
# Extract the package name and version number from configure.ac:
-set dummy `$SED -n '/AC_INIT/{s/[][,()]/ /g; p;}' configure.ac`
+set dummy `$SED -n '
+ /AC_INIT/{
+ s/[][,()]/ /g
+ p
+ }' configure.ac`
shift
# Whip up a dirty Makefile:
Index: Makefile.am
===================================================================
RCS file: /cvsroot/libtool/libtool/Makefile.am,v
retrieving revision 1.185
diff -u -r1.185 Makefile.am
--- Makefile.am 3 Jan 2006 14:02:19 -0000 1.185
+++ Makefile.am 21 Jan 2006 10:31:34 -0000
@@ -214,9 +214,9 @@
echo 'CLEANFILES ='; \
echo 'MOSTLYCLEANFILES ='; \
} >> $$out; \
- $(SED) -n '/^.. DO NOT REMOVE THIS LINE -- /,$$ \
- { s,libltdl_,,; s,libltdl/,,; s,: libltdl/,: ,; \
- s,\$$(libltdl_,$$(,; p; }' $$in >> $$out;
+ $(SED) -n '/^.. DO NOT REMOVE THIS LINE -- /,$$p' | \
+ $(SED) -e 's,libltdl_,,; s,libltdl/,,; s,: libltdl/,: ,' \
+ -e 's,\$$(libltdl_,$$(,' $$in >> $$out;
chmod a-w $(srcdir)/libltdl/Makefile.am
$(srcdir)/libltdl/Makefile.in: $(srcdir)/libltdl/Makefile.am \
Index: libtoolize.m4sh
===================================================================
RCS file: /cvsroot/libtool/libtool/libtoolize.m4sh,v
retrieving revision 1.52
diff -u -r1.52 libtoolize.m4sh
--- libtoolize.m4sh 11 Jan 2006 17:24:56 -0000 1.52
+++ libtoolize.m4sh 21 Jan 2006 10:31:34 -0000
@@ -339,7 +339,10 @@
# Set local variables to reflect contents of configure.ac
my_sed_scan_configure_ac='s,#.*$,,; s,^dnl .*$,,; s, dnl .*$,,;
- /AC_INIT/ { s,^.*$,seen_autoconf=:,; p; };
+ /AC_INIT/ {
+ s,^.*$,seen_autoconf=:,
+ p
+ }
d'
test -z "$configure_ac" \
|| eval `$SED "$my_sed_scan_configure_ac" "$configure_ac"`
@@ -358,27 +361,48 @@
# Probe macro usage in configure.ac and/or aclocal.m4. #
# ---------------------------------------------------- #
- my_sed_traces='s,#.*$,,; s,^dnl .*$,,; s, dnl .*$,,;
- s,^.*AC_REQUIRE(.*$,,; s,^.*m4[]_require(.*$,,; s,^.*m4[]_define(.*$,,;
- s,^.*A[[CU]]_DEFUN(.*$,,; s,^.*m4[]_defun(.*$,,;
+ my_sed_traces='s,#.*$,,; s,^dnl .*$,,; s, dnl .*$,,
+ s,^.*AC_REQUIRE(.*$,,; s,^.*m4[]_require(.*$,,; s,^.*m4[]_define(.*$,,
+ s,^.*A[[CU]]_DEFUN(.*$,,; s,^.*m4[]_defun(.*$,,
/AC_CONFIG_AUX_DIR(/ {
- s,^.*AC_CONFIG_AUX_DIR([[[ ]*\([^])]]*\).*$,auxdir=\1,; p;
- };
+ s,^.*AC_CONFIG_AUX_DIR([[[ ]*\([^])]]*\).*$,auxdir=\1,
+ p
+ }
/AC_CONFIG_MACRO_DIR(/ {
- s,^.*AC_CONFIG_MACRO_DIR([[[ ]*\([^])]]*\).*$,macrodir=\1,;
p;
- };
- /_LT_CONFIG_LTDL_DIR(/d;
+ s,^.*AC_CONFIG_MACRO_DIR([[[ ]*\([^])]]*\).*$,macrodir=\1,
+ p
+ }
+ /_LT_CONFIG_LTDL_DIR(/d
/LT_CONFIG_LTDL_DIR(/ {
- s/^.*LT_CONFIG_LTDL_DIR([[[ ]*\([^]),]*\)[^,]]*/ac_ltdldir=\1%%/;
- s/%%[[[, ]*\([^])]]*\).*$/ ac_ltdl_mode=\1%%/;
- s/%%.*$//; p;
- };
- /A[[CM]]_PROG_LIBTOOL/ { s,^.*$,seen_libtool=:,; p; };
- /LT_INIT/ { s,^.*$,seen_libtool=:,; p; };
- /LTDL_INIT/ { s,^.*$,seen_ltdl=:,; p; };
- /LT_WITH_LTDL/ { s,^.*$,seen_ltdl=:,; p; };
- /AC_LIB_LTDL/ { s,^.*$,seen_ltdl=:,; p; };
- /AC_WITH_LTDL/ { s,^.*$,seen_ltdl=:,; p; };
+ s/^.*LT_CONFIG_LTDL_DIR([[[ ]*\([^]),]*\)[^,]]*/ac_ltdldir=\1%%/
+ s/%%[[[, ]*\([^])]]*\).*$/ ac_ltdl_mode=\1%%/
+ s/%%.*$//
+ p
+ }
+ /A[[CM]]_PROG_LIBTOOL/ {
+ s,^.*$,seen_libtool=:,
+ p
+ }
+ /LT_INIT/ {
+ s,^.*$,seen_libtool=:,
+ p
+ }
+ /LTDL_INIT/ {
+ s,^.*$,seen_ltdl=:,
+ p
+ }
+ /LT_WITH_LTDL/ {
+ s,^.*$,seen_ltdl=:,
+ p
+ }
+ /AC_LIB_LTDL/ {
+ s,^.*$,seen_ltdl=:,
+ p
+ }
+ /AC_WITH_LTDL/ {
+ s,^.*$,seen_ltdl=:,
+ p
+ }
d'
eval `cat aclocal.m4 "$configure_ac" 2>/dev/null | $SED "$my_sed_traces"`
@@ -470,8 +494,11 @@
# If AC_CONFIG_MACRO_DIR turned nothing up, we hunt for ACLOCAL_AMFLAGS
# in `Makefile.am' for a `-I' argument.
- my_sed_aclocal_flags='/^[[ ]]*ACLOCAL_[[A-Z_]]*FLAGS[[ ]]*=/ {
- s,^[[^=]]*=[[ ]]*\(.*\), \1,; q; };
+ my_sed_aclocal_flags='
+ /^[[ ]]*ACLOCAL_[[A-Z_]]*FLAGS[[ ]]*=/ {
+ s,^[[^=]]*=[[ ]]*\(.*\), \1,
+ q
+ }
d'
m4dir="$macrodir"
if test ! -n "$m4dir" && test -f Makefile.am; then
@@ -500,7 +527,10 @@
my_include_regex=
my_sed_include='
- /^[m4]_include(\[[.*\]])$/ { s,^[m4]_include(\[[\(.*\)\]])$,\1,; p; };
+ /^[m4]_include(\[[.*\]])$/ {
+ s,^[m4]_include(\[[\(.*\)\]])$,\1,
+ p
+ }
d'
if test -f "$my_searchfile"; then
@@ -523,9 +553,11 @@
$opt_debug
my_filename="$1"
my_macro_regex="$2"
- my_sed_serial=['/^# serial [1-9][0-9.]*[ ]*'"$my_macro_regex"'[ ]*$/ {
- s,^# serial \([1-9][0-9.]*\).*$,\1,; q;
- };
+ my_sed_serial=['
+ /^# serial [1-9][0-9.]*[ ]*'"$my_macro_regex"'[ ]*$/ {
+ s,^# serial \([1-9][0-9.]*\).*$,\1,
+ q
+ }
d']
# Search FILENAME and all the files it m4_includes for a serial number
@@ -755,10 +787,12 @@
func_ltmain_update ()
{
$opt_debug
- my_sed_ltmain=['/^package_revision='\''*[0-9][1-9.]*'\''*/ {
- s,^package_revision='\''*\([0-9.]*\)'\''*[ ]*$,\1,; p;
- };
- d']
+ my_sed_ltmain=['
+ /^package_revision='\''*[0-9][1-9.]*'\''*/ {
+ s,^package_revision='\''*\([0-9.]*\)'\''*[ ]*$,\1,
+ p
+ }
+ d']
func_keyword_update "$1" "$2" "$3" "$my_sed_ltmain"
@@ -773,10 +807,13 @@
func_config_update ()
{
$opt_debug
- my_sed_config=['/^timestamp='\''*[0-9][1-9-]*'\''*/ {
- s,^timestamp='\''*\([0-9-]*\)'\''*,\1,; s/-/./g; p;
- };
- d']
+ my_sed_config=['
+ /^timestamp='\''*[0-9][1-9-]*'\''*/ {
+ s,^timestamp='\''*\([0-9-]*\)'\''*,\1,
+ s/-/./g
+ p
+ }
+ d']
func_keyword_update "$1" "$2" "$3" "$my_sed_config"
@@ -791,10 +828,13 @@
func_install_update ()
{
$opt_debug
- my_sed_install=['/^scriptversion='\''*[0-9][1-9.-]*'\''*/ {
- s,^scriptversion='\''*\([0-9.-]*\)'\''*,\1,; s/-/./g; p;
- };
- d']
+ my_sed_install=['
+ /^scriptversion='\''*[0-9][1-9.-]*'\''*/ {
+ s,^scriptversion='\''*\([0-9.-]*\)'\''*,\1,
+ s/-/./g
+ p
+ }
+ d']
func_keyword_update "$1" "$2" "$3" "$my_sed_install"
Index: libltdl/config/getopt.m4sh
===================================================================
RCS file: /cvsroot/libtool/libtool/libltdl/config/getopt.m4sh,v
retrieving revision 1.2
diff -u -r1.2 getopt.m4sh
--- libltdl/config/getopt.m4sh 11 Jan 2006 17:24:56 -0000 1.2
+++ libltdl/config/getopt.m4sh 21 Jan 2006 10:31:34 -0000
@@ -32,9 +32,10 @@
func_version ()
{
$SED -n '/^# '$PROGRAM' (GNU /,/# warranty; / {
- s/^# //; s/^# *$//;
- s/\((C)\)[[ 0-9,-]]*\( [[1-9]][[0-9]]*\)/\1\2/;
- p;
+ s/^# //
+ s/^# *$//
+ s/\((C)\)[[ 0-9,-]]*\( [[1-9]][[0-9]]*\)/\1\2/
+ p
}' < "$progpath"
exit $?
}
@@ -44,9 +45,10 @@
func_usage ()
{
$SED -n '/^# Usage:/,/# -h/ {
- s/^# //; s/^# *$//;
- s/\$progname/'$progname'/;
- p;
+ s/^# //
+ s/^# *$//
+ s/\$progname/'$progname'/
+ p
}' < "$progpath"
$ECHO
$ECHO "run \`$progname --help | more' for full usage"
@@ -58,16 +60,17 @@
func_help ()
{
$SED -n '/^# Usage:/,/# Report bugs to/ {
- s/^# //; s/^# *$//;
- s*\$progname*'$progname'*;
- s*\$SHELL*'"$SHELL"'*;
- s*\$LTCC*'"$LTCC"'*;
- s*\$LTCFLAGS*'"$LTCFLAGS"'*;
- s*\$LD*'"$LD"'*;
- s/\$with_gnu_ld/'"$with_gnu_ld"'/;
- s/\$automake_version/'"`(automake --version) 2>/dev/null |$SED 1q`"'/;
- s/\$autoconf_version/'"`(autoconf --version) 2>/dev/null |$SED 1q`"'/;
- p;
+ s/^# //
+ s/^# *$//
+ s*\$progname*'$progname'*
+ s*\$SHELL*'"$SHELL"'*
+ s*\$LTCC*'"$LTCC"'*
+ s*\$LTCFLAGS*'"$LTCFLAGS"'*
+ s*\$LD*'"$LD"'*
+ s/\$with_gnu_ld/'"$with_gnu_ld"'/
+ s/\$automake_version/'"`(automake --version) 2>/dev/null |$SED 1q`"'/
+ s/\$autoconf_version/'"`(autoconf --version) 2>/dev/null |$SED 1q`"'/
+ p
}' < "$progpath"
exit $?
}
Index: libltdl/config/ltmain.m4sh
===================================================================
RCS file: /cvsroot/libtool/libtool/libltdl/config/ltmain.m4sh,v
retrieving revision 1.29
diff -u -r1.29 ltmain.m4sh
--- libltdl/config/ltmain.m4sh 21 Jan 2006 08:56:43 -0000 1.29
+++ libltdl/config/ltmain.m4sh 21 Jan 2006 10:31:37 -0000
@@ -683,7 +683,14 @@
if eval $OBJDUMP -f $1 | $SED -e '10q' 2>/dev/null |
$EGREP 'file format pe-i386(.*architecture: i386)?' >/dev/null ; then
win32_nmres=`eval $NM -f posix -A $1 |
- $SED -n -e '1,100{/ I /{s,.*,import,;p;q;};}'`
+ $SED -n -e '
+ 1,100{
+ / I /{
+ s,.*,import,
+ p
+ q
+ }
+ }'`
case $win32_nmres in
import*) win32_libid_type="x86 archive import";;
*) win32_libid_type="x86 archive static";;
Index: libltdl/m4/libtool.m4
===================================================================
RCS file: /cvsroot/libtool/libtool/libltdl/m4/libtool.m4,v
retrieving revision 1.57
diff -u -r1.57 libtool.m4
--- libltdl/m4/libtool.m4 13 Jan 2006 10:07:33 -0000 1.57
+++ libltdl/m4/libtool.m4 21 Jan 2006 10:31:39 -0000
@@ -887,11 +887,18 @@
# to the aix ld manual.
m4_defun([_LT_SYS_MODULE_PATH_AIX],
[AC_LINK_IFELSE(AC_LANG_PROGRAM,[
-aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File
Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; }
-}'`
+lt_aix_libpath_sed='
+ /Import File Strings/,/^$/ {
+ /^0/ {
+ s/^0 *\(.*\)$/\1/
+ p
+ }
+ }'
+aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e
"$lt_aix_libpath_sed"`
# Check for a 64-bit object if we didn't find anything.
-if test -z "$aix_libpath"; then aix_libpath=`dump -HX64 conftest$ac_exeext
2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0
*\(.*\)$/\1/; p; }
-}'`; fi],[])
+if test -z "$aix_libpath"; then
+ aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e
"$lt_aix_libpath_sed"`
+fi],[])
if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
])# _LT_SYS_MODULE_PATH_AIX
Index: clcommit.m4sh
===================================================================
RCS file: /cvsroot/libtool/libtool/clcommit.m4sh,v
retrieving revision 1.10
diff -u -r1.10 clcommit.m4sh
--- clcommit.m4sh 29 Jun 2005 08:23:35 -0000 1.10
+++ clcommit.m4sh 21 Jan 2006 10:31:34 -0000
@@ -392,7 +392,11 @@
{
if $opt_tla; then
tla_log=`$TLA make-log`
- test -n "$summary" || summary=`$SED -e '1{s/^Summary: *//;q;}'`
+ test -n "$summary" || summary=`$SED -e '
+ 1{
+ s/^Summary: *//
+ q
+ }'`
echo "Summary: $summary" > "$tla_log$$T" &&
$SED 1d "$tla_log" >> "$tla_log$$T" &&
cat < "$log_file" >> "$tla_log$$T" &&
@@ -458,7 +462,11 @@
${PAGER-more} "$notify_file" || break
# Break out the subject line again
- my_mail_subject=`$SED -e '1{s/^Subject: *//;q;}' "$notify_file"`
+ my_mail_subject=`$SED -e '
+ 1{
+ s/^Subject: *//
+ q
+ }' "$notify_file"`
my_mail_body=`$SED -e '2,$p;d' "$notify_file"`
echo "$my_mail_body" > "$notify_file"
Index: libltdl/config/mailnotify.m4sh
===================================================================
RCS file: /cvsroot/libtool/libtool/libltdl/config/mailnotify.m4sh,v
retrieving revision 1.1
diff -u -r1.1 mailnotify.m4sh
--- libltdl/config/mailnotify.m4sh 22 Aug 2005 22:33:35 -0000 1.1
+++ libltdl/config/mailnotify.m4sh 21 Jan 2006 10:31:37 -0000
@@ -204,7 +204,12 @@
{
my_outfile="$1"
my_destination="$2"
- my_sed_version_no='/^# '$PROGRAM' (GNU / { s/^# .*version //; p; }; d'
+ my_sed_version_no='
+ /^# '$PROGRAM' (GNU / {
+ s/^# .*version //
+ p
+ }
+ d'
{
echo "User-Agent: $PROGRAM/`$SED \"$my_sed_version_no\" < $progpath`"
Index: tests/sh.test
===================================================================
RCS file: /cvsroot/libtool/libtool/tests/sh.test,v
retrieving revision 1.28
diff -u -r1.28 sh.test
--- tests/sh.test 24 Aug 2005 13:39:51 -0000 1.28
+++ tests/sh.test 21 Jan 2006 10:31:39 -0000
@@ -84,8 +84,13 @@
# Check for using shift after set dummy (same or following line).
for s in $scripts
do
- if $SED -n '/set[ ][
]*dummy/{/set.*dummy.*;.*shift/d;N;/\n.*shift/D;p;}' "$s" |
- $EGREP .; then
+ if $SED -n '
+ /set[ ][ ]*dummy/{
+ /set.*dummy.*;.*shift/d
+ N
+ /\n.*shift/D
+ p
+ }' "$s" | $EGREP .; then
echo "use \`shift' after \`set dummy' in $s"
status=$EXIT_FAILURE
fi
@@ -95,8 +100,12 @@
# redirect stderr so we also barf when sed issues diagnostics.
for s in $scripts
do
- if $SED -n '/^func_/{N;/^func_[^ ]* ()\n{$/d;p;}' "$s" 2>&1 |
- $EGREP .; then
+ if $SED -n '
+ /^func_/{
+ N
+ /^func_[^ ]* ()\n{$/d
+ p
+ }' "$s" 2>&1 | $EGREP .; then
echo "Function definitions should look like this in $s:
func_foo ()
{
@@ -112,7 +121,7 @@
do
if $SED -n '/case \$cc_basename in/,/esac/ {
/^[ ]*[a-zA-Z][a-zA-Z0-9+]*[^*][ ]*)/p
- };' $s 2>&1 | $EGREP .; then
+ }' $s 2>&1 | $EGREP .; then
echo "\$cc_basename matches should include a trailing \`*' in $s."
status=$EXIT_FAILURE
fi
Index: tests/testsuite.at
===================================================================
RCS file: /cvsroot/libtool/libtool/tests/testsuite.at,v
retrieving revision 1.35
diff -u -r1.35 testsuite.at
--- tests/testsuite.at 16 Dec 2005 16:15:32 -0000 1.35
+++ tests/testsuite.at 21 Jan 2006 10:31:39 -0000
@@ -152,7 +152,11 @@
# --------------
m4_define([LT_AT_TAG],
[AT_KEYWORDS([$1])
-eval `$LIBTOOL --tag=$1 --config | sed -n '/^CC=/ { s/CC/$1/; p;}'`
+eval `$LIBTOOL --tag=$1 --config | sed -n '
+ /^CC=/{
+ s/CC/$1/
+ p
+ }'`
AT_CHECK([test -n "[$]$1" || (exit 77)])
])
- FYI: fix sed syntax,
Ralf Wildenhues <=