Subject: Re: [PATCH 1/4] test: Add target test-lint-shell-syntax

From: Torsten Bögershausen <[email-masked]>
Date: Tue, 08 Jan 2013 05:11:23 +0100

On 07.01.13 19:07, Junio C Hamano wrote:
> Torsten Bögershausen <[email-masked]> writes:
> 
>> Sorry for late answer, but there is a problem (both linux and Mac OS X) :-(
>> $ make test-lint does not do shel syntax check, neither
>> $ make test-lint-shell-syntax
> 
> In which directory?
> 
>     $ make -C t test-lint-shell-syntax
>     ... passes silently ...
>     $ ed t/t0000-basic.sh
>     /test_expect_success/
>     a
>             which sh
>     .
>     w
>     q
>     $ make -C t test-lint-shell-syntax
>     t0000-basic.sh:28: error: which is not portable (please use type):      which sh
>     make: *** [test-lint-shell-syntax] Error 1
> 
> If you edit out '@' (but nothing else) from this line:
> 
>> 	@'$(PERL_PATH_SQ)' check-non-portable-shell.pl $(T)
> 
> and run the above again, you would see that it is running this shell
> command:
> 
> '/usr/bin/perl' check-non-portable-shell.pl t0000-basic.sh t0001-init.sh ...
> 
> If you introduce a Perl syntax error to check-non-portable-shell.pl,
> like this, you will get:
> 
>     $ make -C t test-lint-shell-syntax
>     syntax error at check-non-portable-shell.pl line 11, near "whoa
> 
> So... is your shell broken?  The above seems to work for dash, bash,
> ksh and zsh.
Thanks for helping me out, and sorry for the noise.

My brain "went off track" while chasing a failure of t7400 on pu under Mac OS :-(