Re: [PATCH 1/4] test: Add target test-lint-shell-syntax
From: Junio C Hamano <hidden>
Date: 2016-06-15 22:55:41
Torsten Bögershausen [off-list ref] 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.