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 tbo...@web.de 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

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

2013-02-05 Thread Junio C Hamano
Torsten Bögershausen tbo...@web.de 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?

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

2013-02-05 Thread Junio C Hamano
Junio C Hamano gits...@pobox.com writes: Torsten Bögershausen tbo...@web.de 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

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 tbo...@web.de 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 +} [...] if (

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 tbo...@web.de writes: What do we think about something like this for fishing for which: [...] +which () { + echo 2 which is not portable (please

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

2013-01-27 Thread Junio C Hamano
Jonathan Nieder jrnie...@gmail.com 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

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

2013-01-27 Thread Junio C Hamano
Torsten Bögershausen tbo...@web.de 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

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

2013-01-27 Thread Junio C Hamano
Junio C Hamano gits...@pobox.com 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

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

2013-01-26 Thread Junio C Hamano
Torsten Bögershausen tbo...@web.de 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

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 tbo...@web.de 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

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 jrnie...@gmail.com 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-15 Thread Junio C Hamano
Torsten Bögershausen tbo...@web.de 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-13 Thread Torsten Bögershausen
On 12.01.13 07:00, Junio C Hamano wrote: Torsten Bögershausen tbo...@web.de 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

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+/ and err

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

2013-01-11 Thread Junio C Hamano
Torsten Bögershausen tbo...@web.de 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.