From 61e09a55669820ab0cd2bb3ffcdbd8e40baa6497 Mon Sep 17 00:00:00 2001 From: "Gary V. Vaughan" Date: Mon, 21 Nov 2011 18:02:23 +0700 Subject: syntax-check: fix violations and implement sc_prohibit_sed_s_comma. 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 --- cfg.mk | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'cfg.mk') diff --git a/cfg.mk b/cfg.mk index 918870ec..dc89660c 100644 --- a/cfg.mk +++ b/cfg.mk @@ -100,6 +100,16 @@ sc_prohibit_nested_quotes: halt='found nested double quotes' \ $(_sc_search_regexp_or_exclude) +# Commas in filenames are quite common, so using them routinely for sed is +# asking for trouble! +sc_prohibit_sed_s_comma: + @explicit='($$SED|sed)[ ]+(-e[ ]+)?['\''"]?s,' \ + implicit='['\''";][ ]*s,[^,]*,[^,]*,g?['\''";]' \ + literal='^[ ]*s,[^,]*,[^,]*,g?['\''";]?$$' \ + prohibit='('$$implicit'|'$$explicit'|'$$literal')' \ + halt='found use of comma separator in sed substitution' \ + $(_sc_search_regexp) + # Check for using shift after set dummy (same or following line). exclude_file_name_regexp--sc_prohibit_set_dummy_without_shift = ^cfg.mk$$ sc_prohibit_set_dummy_without_shift: -- cgit v1.2.1