summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGary V. Vaughan <gary@gnu.org>2011-11-19 22:53:20 +0700
committerGary V. Vaughan <gary@gnu.org>2011-11-25 14:53:41 +0700
commit4757bf0637658fd2e298042d9f7a0d51c5f49495 (patch)
treea6c57a622fbbd161d981fd6667b1395a6966cad9
parenta53d6cc4983d5c274b9db259835af12c12842a6b (diff)
downloadlibtool-4757bf0637658fd2e298042d9f7a0d51c5f49495.tar.gz
syntax-check: fix violations and implement sc_prohibit_bare_basename.
* cfg.mk (sc_prohibit_bare_basename, sc_prohibit_basename_with_sed): Make sure not to go back to using occasional `|$basename' or `|$dirname' syntax. * build-aux/git-hooks/commit-msg, build-aux/ltmain.m4sh, * build-aux/options-parser, tests/fcdemo-conf.test, * tests/fcdemo-shared.test, tests/fcdemo-static.test, * tests/libtoolize.at: Fix violations. Signed-off-by: Gary V. Vaughan <gary@gnu.org>
-rwxr-xr-xbuild-aux/git-hooks/commit-msg4
-rw-r--r--build-aux/ltmain.m4sh3
-rw-r--r--build-aux/options-parser6
-rw-r--r--cfg.mk11
-rwxr-xr-xtests/fcdemo-conf.test2
-rwxr-xr-xtests/fcdemo-shared.test2
-rwxr-xr-xtests/fcdemo-static.test2
-rw-r--r--tests/libtoolize.at4
8 files changed, 23 insertions, 11 deletions
diff --git a/build-aux/git-hooks/commit-msg b/build-aux/git-hooks/commit-msg
index f2e61080..ba1073bc 100755
--- a/build-aux/git-hooks/commit-msg
+++ b/build-aux/git-hooks/commit-msg
@@ -6,13 +6,13 @@
: ${SED="sed"}
test set = ${ECHO+'set'} = set || ECHO='printf %s\n'
-basename="$SED -e "'s|^.*/||'
+basename='s|^.*/||'
nl='
'
progpath=$0
-progname=`$ECHO "$progpath" |$basename`
+progname=`$ECHO "$progpath" |$SED -e "$basename"`
log_file=$1
export log_file
diff --git a/build-aux/ltmain.m4sh b/build-aux/ltmain.m4sh
index 02ff034d..b60b574a 100644
--- a/build-aux/ltmain.m4sh
+++ b/build-aux/ltmain.m4sh
@@ -3027,7 +3027,8 @@ func_extract_archives ()
cd $my_xdir || exit $?
darwin_archive=$my_xabs
darwin_curdir=`pwd`
- darwin_base_archive=`basename "$darwin_archive"`
+ func_basename "$darwin_archive"
+ darwin_base_archive=$func_basename_result
darwin_arches=`$LIPO -info "$darwin_archive" 2>/dev/null | $GREP Architectures 2>/dev/null || true`
if test -n "$darwin_arches"; then
darwin_arches=`$ECHO "$darwin_arches" | $SED -e 's/.*are://'`
diff --git a/build-aux/options-parser b/build-aux/options-parser
index 4777d767..566ae430 100644
--- a/build-aux/options-parser
+++ b/build-aux/options-parser
@@ -167,8 +167,8 @@ EXIT_SKIP=77 # $? = 77 is used to indicate a skipped test to automake.
debug_cmd=${debug_cmd-":"}
exit_cmd=:
-dirname="$SED -e "'s|/[^/]*$||'
-basename="$SED -e "'s|^.*/||'
+dirname='s|/[^/]*$||'
+basename='s|^.*/||'
nl='
'
@@ -181,7 +181,7 @@ nl='
progpath=$0
# The name of this program.
-progname=`echo "$progpath" |$basename`
+progname=`echo "$progpath" |$SED "$basename"`
## ------------------------- ##
diff --git a/cfg.mk b/cfg.mk
index c9bfd927..3c366bde 100644
--- a/cfg.mk
+++ b/cfg.mk
@@ -75,6 +75,17 @@ sc_prohibit_Xsed_without_X:
else :; \
fi || :
+# Use a consistent dirname and basename idiom.
+sc_prohibit_bare_basename:
+ @prohibit='\|[ ]*\$$(base|dir)name' \
+ halt='use `|$$SED "$$basename"'\'' instead of `|$$basename'\' \
+ $(_sc_search_regexp)
+
+sc_prohibit_basename_with_dollar_sed:
+ @prohibit='(base|dir)name="?(\$$SED|sed)[ "]' \
+ halt='use `basename='\''s|^.*/||'\'' instead of `basename="$$SED...' \
+ $(_sc_search_regexp)
+
# Check for using `[' instead of `test'.
exclude_file_name_regexp--sc_prohibit_bracket_as_test = ^cfg.mk$$
sc_prohibit_bracket_as_test:
diff --git a/tests/fcdemo-conf.test b/tests/fcdemo-conf.test
index b7e08a64..028b53ea 100755
--- a/tests/fcdemo-conf.test
+++ b/tests/fcdemo-conf.test
@@ -31,7 +31,7 @@ func_make_distclean
# We do not want to fail if all we got was a Fortran 77 compiler.
func_configure_nofail
if test "$conf_status" -eq "$EXIT_FAILURE"; then
- case `echo $FC | $SED $basename` in
+ case `echo $FC | $SED "$basename"` in
g77* | f77* | xlf | xlf[_-]* | frt* | pgf77* | cf77* | fort77* | fl32* | af77*)
func_skip "The FC fortran tests do not work with Fortran 77 compilers" ;;
*) exit $EXIT_FAILURE
diff --git a/tests/fcdemo-shared.test b/tests/fcdemo-shared.test
index f20cb5d5..76fb6947 100755
--- a/tests/fcdemo-shared.test
+++ b/tests/fcdemo-shared.test
@@ -31,7 +31,7 @@ func_make_distclean
# We do not want to fail if all we got was a Fortran 77 compiler.
func_configure_nofail "--disable-static"
if test "$conf_status" -eq "$EXIT_FAILURE"; then
- case `echo $FC | $SED $basename` in
+ case `echo $FC | $SED "$basename"` in
g77* | f77* | xlf | xlf[_-]* | frt* | pgf77* | cf77* | fort77* | fl32* | af77*)
func_skip "The FC fortran tests do not work with Fortran 77 compilers" ;;
*) exit $EXIT_FAILURE
diff --git a/tests/fcdemo-static.test b/tests/fcdemo-static.test
index 0f8dede7..2e27020a 100755
--- a/tests/fcdemo-static.test
+++ b/tests/fcdemo-static.test
@@ -31,7 +31,7 @@ func_make_distclean
# We do not want to fail if all we got was a Fortran 77 compiler.
func_configure_nofail "--disable-shared"
if test "$conf_status" -eq "$EXIT_FAILURE"; then
- case `echo $FC | $SED $basename` in
+ case `echo $FC | $SED "$basename"` in
g77* | f77* | xlf | xlf[_-]* | frt* | pgf77* | cf77* | fort77* | fl32* | af77*)
func_skip "The FC fortran tests do not work with Fortran 77 compilers" ;;
*) exit $EXIT_FAILURE
diff --git a/tests/libtoolize.at b/tests/libtoolize.at
index e112acf4..9c97fdb4 100644
--- a/tests/libtoolize.at
+++ b/tests/libtoolize.at
@@ -696,7 +696,7 @@ LT_AT_ACLOCAL([-I $abs_top_srcdir/m4])
: ${GREP="grep"}
: ${SED="sed"}
-basename="$SED -e s,^.*/,,"
+basename='s,^.*/,,'
# func_grep expression filename
# Check whether EXPRESSION matches any line of FILENAME, without output.
@@ -724,7 +724,7 @@ func_serial ()
my_serial=
if test -z "$my_macro_regex" ||
test "$my_filename" = aclocal.m4 ||
- test "$my_macro_regex" = `echo "$my_filename" | $basename` ||
+ test "$my_macro_regex" = `echo "$my_filename" | $SED "$basename"` ||
func_grep '^AC_DEFUN(\@<:@'"$my_macro_regex" "$my_filename"
then
my_serial=`$SED -e "$my_sed_serial" "$my_filename"`