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

2011-11-21 Thread Gary V. Vaughan
More syntax-check inspired goodness to make our shell code more readable and maintainable. There's nothing controversial in here, except perhaps a seemingly large amount of code churn for a relatively small gain in each case, however the code definitely *does* need all the help it can get to be

[PATCH 3/7] tests: migrate tests/sh.test checks to syntax-checks.

2011-11-21 Thread Gary V. Vaughan
Some modernization of the legacy testsuite. * tests/sh.test: Remove. * Makefile.am (COMMON_TESTS): Adjust. * cfg.mk (sc_libtool_m4_cc_basename, sc_prohibit_bracket_as_test) (sc_prohibit_nested_quotes, sc_prohibit_set_dummy_without_shift) (sc_prohibit_set_minus_minus,

[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

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

2011-11-21 Thread Eric Blake
On 11/21/2011 07:47 AM, Gary V. Vaughan wrote: Contrary to popular belief, Bourne shell does not resplit case expressions after expansion, so if there are no shell unquoted shell metacharacters or whitespace, the quotes are useless. @@ -568,7 +568,7 @@ func_resolve_sysroot () # store the

Re: [PATCH 3/7] tests: migrate tests/sh.test checks to syntax-checks.

2011-11-21 Thread Stefano Lattarini
Hi Gary. Just a quick nit (I haven't looked at the whole series, and not even at the whole patch in fact; sorry). On Monday 21 November 2011, Gary V wrote: for file do - test -f $file || touch $file + test -f $file || touch $file What's the point of quoting file after

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

2011-11-21 Thread Stefano Lattarini
Hi Gary. Again, few quick nits here, probably incomplete. On Monday 21 November 2011, Gary V wrote: * 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/general.m4sh,

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

2011-11-21 Thread Eric Blake
On 11/21/2011 07:47 AM, Gary V. Vaughan wrote: Until now, libtool sources have used braced variable names seemingly at random! Almost always the braces are just noise, so remove all the unnecessary ones. * cfg.mk (sc_useless_braces_in_variable_derefs): New syntax check rule to ensure we only

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

2011-11-21 Thread Eric Blake
On 11/21/2011 07:47 AM, Gary V. Vaughan wrote: To safely use a non-literal first argument to `test', you must always prepend a literal non-`-' character, but often the second operand is a constant that doesn't begin with a `-' already, so always use `test a = $b' instead of noisy `test X$b =

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

2011-11-21 Thread Stefano Lattarini
Hi Gary. Few more random nits... On Monday 21 November 2011, Gary V wrote: To safely use a non-literal first argument to `test', you must always prepend a literal non-`-' character, but often the second operand is a constant that doesn't begin with a `-' already, so always use `test a = $b'

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.

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

2011-11-21 Thread Roumen Petrov
Gary V. Vaughan wrote: [SNIP] diff --git a/bootstrap.conf b/bootstrap.conf index 6f0f0c3..c3491b5 100644 --- a/bootstrap.conf +++ b/bootstrap.conf @@ -77,13 +77,13 @@ gnulib_modules=' # Extra gnulib files that are not in modules, which override files of # the same name installed by other

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

2011-11-21 Thread Eric Blake
On 11/21/2011 01:59 PM, Roumen Petrov wrote: Gary V. Vaughan wrote: [SNIP] diff --git a/bootstrap.conf b/bootstrap.conf index 6f0f0c3..c3491b5 100644 --- a/bootstrap.conf +++ b/bootstrap.conf @@ -77,13 +77,13 @@ gnulib_modules=' # Extra gnulib files that are not in modules, which

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

2011-11-21 Thread Gary V. Vaughan
Hi Eric, On 21 Nov 2011, at 23:15, Eric Blake wrote: On 11/21/2011 07:47 AM, Gary V. Vaughan wrote: Contrary to popular belief, Bourne shell does not resplit case expressions after expansion, so if there are no shell unquoted shell metacharacters or whitespace, the quotes are useless. @@

Re: [PATCH 3/7] tests: migrate tests/sh.test checks to syntax-checks.

2011-11-21 Thread Gary V. Vaughan
Hi Stefano, On 22 Nov 2011, at 02:52, Stefano Lattarini wrote: Hi Gary. Just a quick nit (I haven't looked at the whole series, and not even at the whole patch in fact; sorry). No apologies necessary, every little helps! Thank you. On Monday 21 November 2011, Gary V wrote: for file

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

2011-11-21 Thread Gary V. Vaughan
On 22 Nov 2011, at 02:59, Stefano Lattarini wrote: Hi Gary. Again, few quick nits here, probably incomplete. Hi Stefano, Thanks for taking a look again. On Monday 21 November 2011, Gary V wrote: * cfg.mk (sc_prohibit_bare_basename, sc_prohibit_basename_with_sed): Make sure not to go back

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

2011-11-21 Thread Gary V. Vaughan
Hi Eric, Thanks for the feedback. On 22 Nov 2011, at 03:05, Eric Blake wrote: On 11/21/2011 07:47 AM, Gary V. Vaughan wrote: Until now, libtool sources have used braced variable names seemingly at random! Almost always the braces are just noise, so remove all the unnecessary ones. * cfg.mk

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

2011-11-21 Thread Gary V. Vaughan
Hi Eric, On 22 Nov 2011, at 03:07, Eric Blake wrote: On 11/21/2011 07:47 AM, Gary V. Vaughan wrote: To safely use a non-literal first argument to `test', you must always prepend a literal non-`-' character, but often the second operand is a constant that doesn't begin with a `-' already, so

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

2011-11-21 Thread Gary V. Vaughan
Hi Stefano, On 22 Nov 2011, at 03:13, Stefano Lattarini wrote: Hi Gary. Few more random nits... Thanks ;) On Monday 21 November 2011, Gary V wrote: To safely use a non-literal first argument to `test', you must always prepend a literal non-`-' character, but often the second operand is a