Re: [PATCH] tests: turn on test-lint-shell-syntax by default

2013-02-05 Thread Junio C Hamano
Junio C Hamano writes: > Torsten Bögershausen writes: > >> Thanks for the detailed suggestion. >> Instead of using a file for putting out non portable syntax, >> can we can use a similar logic as test_failure ? > > Your test_bad_syntax_ function can be called from a subshell, and > its "exit 1"

Re: [PATCH] tests: turn on test-lint-shell-syntax by default

2013-02-05 Thread Junio C Hamano
Torsten Bögershausen writes: > Thanks for the detailed suggestion. > Instead of using a file for putting out non portable syntax, > can we can use a similar logic as test_failure ? Your test_bad_syntax_ function can be called from a subshell, and its "exit 1" will not exit, no? test_exp

Re: [PATCH] tests: turn on test-lint-shell-syntax by default

2013-02-05 Thread Torsten Bögershausen
On 27.01.13 18:34, Junio C Hamano wrote: > Torsten Bögershausen writes: > >> Back to the which: >> ... >> and running "make test" gives the following, at least in my system: >> ... > I think everybody involved in this discussion already knows that; > the point is that it can easily give false nega

Re: [PATCH] tests: turn on test-lint-shell-syntax by default

2013-01-27 Thread Junio C Hamano
Junio C Hamano writes: > If we did not care about incurring runtime performance cost, we > could arrange: > ... > Then you can wrap commands whose use we want to limit, perhaps like > this, in the test framework: > ... > sed () { > ... > done > if test -z "$must_

Re: [PATCH] tests: turn on test-lint-shell-syntax by default

2013-01-27 Thread Junio C Hamano
Torsten Bögershausen writes: > Back to the which: > ... > and running "make test" gives the following, at least in my system: > ... I think everybody involved in this discussion already knows that; the point is that it can easily give false negative, without the scripts working very hard to do s

Re: [PATCH] tests: turn on test-lint-shell-syntax by default

2013-01-27 Thread Junio C Hamano
Jonathan Nieder writes: > ... > With the above definition of "which", the only sign of a mistake would > be some extra output to stderr (which is quelled when running tests in > the normal way). The "exit" is caught by the subshell and just makes > the "if" condition false. > > That's not so ter

Re: [PATCH] tests: turn on test-lint-shell-syntax by default

2013-01-27 Thread Torsten Bögershausen
On 27.01.13 10:31, Jonathan Nieder wrote: > Hi, > > Torsten Bögershausen wrote: >> On 15.01.13 21:38, Junio C Hamano wrote: >>> Torsten Bögershausen writes: > What do we think about something like this for fishing for which: > [...] +which () { + echo >&2 "which is not porta

Re: [PATCH] tests: turn on test-lint-shell-syntax by default

2013-01-27 Thread Jonathan Nieder
Hi, Torsten Bögershausen wrote: > On 15.01.13 21:38, Junio C Hamano wrote: >> Torsten Bögershausen writes: >>> What do we think about something like this for fishing for which: [...] >>> +which () { >>> + echo >&2 "which is not portable (please use type)" >>> + exit 1 >>> +} [...] >>

Re: [PATCH] tests: turn on test-lint-shell-syntax by default

2013-01-26 Thread Torsten Bögershausen
On 26.01.13 22:43, Junio C Hamano wrote: > Torsten Bögershausen writes: > >> Do we really need "which" to detect if frotz is installed? > I think we all know the answer to that question is no, but why is > that a relevant question in the context of this discussion? One of > us may be very confus

Re: [PATCH] tests: turn on test-lint-shell-syntax by default

2013-01-26 Thread Junio C Hamano
Torsten Bögershausen writes: > Do we really need "which" to detect if frotz is installed? I think we all know the answer to that question is no, but why is that a relevant question in the context of this discussion? One of us may be very confused. I thought the topic of this discussion was th

Re: [PATCH] tests: turn on test-lint-shell-syntax by default

2013-01-25 Thread Torsten Bögershausen
On 15.01.13 21:38, Junio C Hamano wrote: > Torsten Bögershausen writes: > >> What do we think about something like this for fishing for which: >> >> --- a/t/test-lib.sh >> +++ b/t/test-lib.sh >> @@ -644,6 +644,10 @@ yes () { >> : >> done >> } >> +which () { >> + ech

Re: [PATCH] tests: turn on test-lint-shell-syntax by default

2013-01-15 Thread Junio C Hamano
Torsten Bögershausen writes: > What do we think about something like this for fishing for which: > > --- a/t/test-lib.sh > +++ b/t/test-lib.sh > @@ -644,6 +644,10 @@ yes () { > : > done > } > +which () { > + echo >&2 "which is not portable (please use type)" > +

Re: [PATCH] tests: turn on test-lint-shell-syntax by default

2013-01-15 Thread Torsten Bögershausen
On 13.01.13 23:38, Junio C Hamano wrote: > Jonathan Nieder writes: > >> Hi, >> >> Torsten Bögershausen wrote: >> >>> - /^\s*[^#]\s*which\s/ and err 'which is not portable (please use type)'; >>> + /^\s*[^#]\s*which\s+[-a-zA-Z0-9]+$/ and err 'which is not portable >>> (please use type)'; >> >

Re: [PATCH] tests: turn on test-lint-shell-syntax by default

2013-01-13 Thread Junio C Hamano
Jonathan Nieder writes: > Hi, > > Torsten Bögershausen wrote: > >> -/^\s*[^#]\s*which\s/ and err 'which is not portable (please use type)'; >> +/^\s*[^#]\s*which\s+[-a-zA-Z0-9]+$/ and err 'which is not portable >> (please use type)'; > > Hmm. Neither the old version nor the new one matc

Re: [PATCH] tests: turn on test-lint-shell-syntax by default

2013-01-13 Thread Jonathan Nieder
Hi, Torsten Bögershausen wrote: > - /^\s*[^#]\s*which\s/ and err 'which is not portable (please use type)'; > + /^\s*[^#]\s*which\s+[-a-zA-Z0-9]+$/ and err 'which is not portable > (please use type)'; Hmm. Neither the old version nor the new one matches what seem to be typical uses of

Re: [PATCH] tests: turn on test-lint-shell-syntax by default

2013-01-13 Thread Matt Kraai
On Sun, Jan 13, 2013 at 11:25:57AM +0100, Torsten Bögershausen wrote: > @@ -16,10 +16,10 @@ sub err { > > while (<>) { > chomp; > - /^\s*sed\s+-i/ and err 'sed -i is not portable'; > - /^\s*echo\s+-n/ and err 'echo -n is not portable (please use printf)'; > - /^\s*declare\s+/ a

Re: [PATCH] tests: turn on test-lint-shell-syntax by default

2013-01-13 Thread Torsten Bögershausen
On 12.01.13 07:00, Junio C Hamano wrote: > Torsten Bögershausen writes: > >> The test Makefile has a default set of lint tests which are run >> as part of "make test". >> >> The macro TEST_LINT defaults to "test-lint-duplicates test-lint-executable". >> >> Add test-lint-shell-syntax here, to dete

Re: [PATCH] tests: turn on test-lint-shell-syntax by default

2013-01-11 Thread Junio C Hamano
Torsten Bögershausen writes: > The test Makefile has a default set of lint tests which are run > as part of "make test". > > The macro TEST_LINT defaults to "test-lint-duplicates test-lint-executable". > > Add test-lint-shell-syntax here, to detect non-portable shell syntax early. > > Signed-off-

[PATCH] tests: turn on test-lint-shell-syntax by default

2013-01-11 Thread Torsten Bögershausen
The test Makefile has a default set of lint tests which are run as part of "make test". The macro TEST_LINT defaults to "test-lint-duplicates test-lint-executable". Add test-lint-shell-syntax here, to detect non-portable shell syntax early. Signed-off-by: Torsten Bögershausen --- t/Makefile |