[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH 6/7] syntax-check: fix violations and implement sc_prohibit_t
From: |
Stefano Lattarini |
Subject: |
Re: [PATCH 6/7] syntax-check: fix violations and implement sc_prohibit_test_const_follows_var. |
Date: |
Mon, 21 Nov 2011 21:13:08 +0100 |
User-agent: |
KMail/1.13.7 (Linux/2.6.30-2-686; KDE/4.6.5; i686; ; ) |
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"' instead of noisy `test "X$b" = Xa'.
>
This seems "back-bending" to me, and slightly unclear to read. Also,
it goes against the (unofficial) conventions of autoconf, which is
to use either `test "x$b" = xa' or `test "x$b" = Xa'.
Also ...
> # Bootstrap this package from checked-out sources.
> # Written by Gary V. Vaughan, 2010
> @@ -1760,7 +1760,7 @@ func_ifcontains ()
> ;;
> esac
>
> - test "$_G_status" -eq 0 || exit $_G_status
> + test 0 -eq $_G_status || exit $_G_status
> }
... changes like this seems overly paranoid, in case $_G_status is
expected (as I surmise it is) to be a non-negative integer. And
if this assumption stps to hold dur to a bug in your code, you are
going to be bitten by much worse problem anyway:
# $shell is either Solaris 1 0or AT&T ksh, Solaris 10 XPG4 sh, or
# zsh 4.3.12.
$ $shell -c 'exit t; echo foo'; echo status = $?
status = 0
Regards,
Stefano
- Re: [PATCH 7/7] syntax-check: fix violations and implement sc_prohibit_sed_s_comma., (continued)
Re: [PATCH 6/7] syntax-check: fix violations and implement sc_prohibit_test_const_follows_var.,
Stefano Lattarini <=
Re: [PATCH 1/7] syntax-check: fix violations and implement sc_useless_quotes_in_case., Eric Blake, 2011/11/21
Re: [PATCH 1/7] syntax-check: fix violations and implement sc_useless_quotes_in_case., Gary V. Vaughan, 2011/11/25