[PATCH 7/7] syntax-check: fix violations and implement sc_prohibit_sed_s_comma.

2011-11-21 Thread Gary V. Vaughan
I like to name temporary directories that I will remove shortly
with two leading commas so that they sort lexicographically at
the top of `ls' output.  Now, `./configure
--prefix=`pwd`/,,inst' works again, for the first time in
several years.
* cfg.mk (sc_prohibit_sed_s_comma): Comma is too common a
character to use routinely as the separator for sed
substitutions on file paths and other variables determined by
the user, causing bugs like the one I describe above.  Make sure
we don't accidentally reintroduce any comma separators in
future.
* Makefile.am, bootstrap, bootstrap.conf, build-aux/extract-trace,
build-aux/general.m4sh, build-aux/git-hooks/commit-msg,
build-aux/git-log-fix, build-aux/ltmain.m4sh, libtoolize.m4sh,
m4/libtool.m4, m4/ltdl.m4, tests/cdemo-undef.test,
tests/cmdline_wrap.at, tests/darwin.at, tests/defs.m4sh,
tests/getopt-m4sh.at, tests/install.at, tests/libtoolize.at,
tests/mdemo/Makefile.am, tests/need_lib_prefix.at,
tests/sysroot.at, tests/tagdemo-undef.test, tests/testsuite.at:
Try to use `|' as the default separator wherever possible,
otherwise something else that doesn't occur in the substitution
expression.
* NEWS: Updated.

Signed-off-by: Gary V. Vaughan g...@gnu.org
---
 Makefile.am|   88 
 NEWS   |1 +
 bootstrap  |   10 ++--
 bootstrap.conf |6 +-
 build-aux/extract-trace|   10 ++--
 build-aux/general.m4sh |   16 
 build-aux/git-hooks/commit-msg |4 +-
 build-aux/git-log-fix  |   48 +++---
 build-aux/ltmain.m4sh  |6 +-
 cfg.mk |   10 +
 libtoolize.m4sh|   62 ++--
 m4/libtool.m4  |   16 
 m4/ltdl.m4 |2 +-
 tests/cdemo-undef.test |2 +-
 tests/cmdline_wrap.at  |2 +-
 tests/darwin.at|2 +-
 tests/defs.m4sh|2 +-
 tests/getopt-m4sh.at   |2 +-
 tests/install.at   |2 +-
 tests/libtoolize.at|   14 +++---
 tests/mdemo/Makefile.am|2 +-
 tests/need_lib_prefix.at   |2 +-
 tests/sysroot.at   |2 +-
 tests/tagdemo-undef.test   |2 +-
 tests/testsuite.at |4 +-
 25 files changed, 164 insertions(+), 153 deletions(-)

diff --git a/Makefile.am b/Makefile.am
index 31d286e..680ae3e 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -52,7 +52,7 @@ LT_M4SH   = $(M4SH) -B 
'$(srcdir)/$(m4sh_dir)'
 lt__cd = CDPATH=$${ZSH_VERSION+.}$(PATH_SEPARATOR)  cd
 
 git_version_gen = '$(SHELL)' '$(aux_dir)/git-version-gen' '.tarball-version'
-rebuild = rebuild=:; revision=`$(lt__cd) $(srcdir)  $(git_version_gen) | sed 
's,-.*$$,,g'`
+rebuild = rebuild=:; revision=`$(lt__cd) $(srcdir)  $(git_version_gen) | sed 
's|-.*$$||g'`
 
 
 # -- #
@@ -108,18 +108,18 @@ EXTRA_DIST += $(extract_trace) $(libtoolize_in) 
$(libtoolize_m4sh) \
 ## because they must be static in distributed files, and not accidentally
 ## changed by configure running on the build machine.
 bootstrap_edit  = $(SED) \
- -e 's,@MACRO_VERSION\@,$(VERSION),g' \
- -e s,@MACRO_REVISION\@,$$revision,g \
- -e s,@MACRO_SERIAL\@,$$serial,g \
- -e 's,@PACKAGE\@,$(PACKAGE),g' \
- -e 's,@PACKAGE_BUGREPORT\@,$(PACKAGE_BUGREPORT),g' \
- -e 's,@PACKAGE_URL\@,$(PACKAGE_URL),g' \
- -e 's,@PACKAGE_NAME\@,$(PACKAGE_NAME),g' \
- -e s,@package_revision\@,$$revision,g \
- -e 's,@PACKAGE_STRING\@,$(PACKAGE_NAME) $(VERSION),g' \
- -e 's,@PACKAGE_TARNAME\@,$(PACKAGE),g' \
- -e 's,@PACKAGE_VERSION\@,$(VERSION),g' \
- -e 's,@VERSION\@,$(VERSION),g'
+ -e 's|@MACRO_VERSION\@|$(VERSION)|g' \
+ -e s|@MACRO_REVISION\@|$$revision|g \
+ -e s|@MACRO_SERIAL\@|$$serial|g \
+ -e 's|@PACKAGE\@|$(PACKAGE)|g' \
+ -e 's|@PACKAGE_BUGREPORT\@|$(PACKAGE_BUGREPORT)|g' \
+ -e 's|@PACKAGE_URL\@|$(PACKAGE_URL)|g' \
+ -e 's|@PACKAGE_NAME\@|$(PACKAGE_NAME)|g' \
+ -e s|@package_revision\@|$$revision|g \
+ -e 's|@PACKAGE_STRING\@|$(PACKAGE_NAME) $(VERSION)|g' \
+ -e 's|@PACKAGE_TARNAME\@|$(PACKAGE)|g' \
+ -e 's|@PACKAGE_VERSION\@|$(VERSION)|g' \
+ -e 's|@VERSION\@|$(VERSION)|g'
 
 ## ltmain.sh needs some additional editing to remove unsubstituted
 ## variable defaulting lines, because ltmain.sh never gets passed
@@ -210,8 +210,8 @@ $(lt_Makefile_am): $(ltdl_mk)
  }; \
  '$(SED)' -n '/^.. DO NOT REMOVE THIS LINE -- /,$$p' \
  '$(ltdl_mk)' \
-   |'$(SED)' -e 's,libltdl_,,; s,libltdl/,,; s,: 

Re: [PATCH 7/7] syntax-check: fix violations and implement sc_prohibit_sed_s_comma.

2011-11-21 Thread Eric Blake
On 11/21/2011 07:47 AM, Gary V. Vaughan wrote:
 I like to name temporary directories that I will remove shortly
 with two leading commas so that they sort lexicographically at
 the top of `ls' output.  Now, `./configure
 --prefix=`pwd`/,,inst' works again, for the first time in
 several years.

 Try to use `|' as the default separator wherever possible,
 otherwise something else that doesn't occur in the substitution
 expression.

I'm in favor of this one.  In particular, one of the reasons that
autoconf documents | as superior to , is that | has to be shell-quoted
to be used, while , does not, which means a user is more likely to have
a filename containing comma than they are to have a filename containing
a pipe.

-- 
Eric Blake   ebl...@redhat.com+1-919-301-3266
Libvirt virtualization library http://libvirt.org



signature.asc
Description: OpenPGP digital signature