[RFC] Add basic syntax check on shell scripts

2012-12-02 Thread Torsten Bögershausen
The test suite needs to be run on different platforms. As it may be difficult for contributors to catch syntax which work on GNU/linux, but is unportable, make a quick check for the most common problems. "sed -i", "echo -n" or "array in shell scripts" This list is not complete, and may need to be e

Re: [RFC] Add basic syntax check on shell scripts

2012-12-02 Thread Stefano Lattarini
On 12/02/2012 02:17 PM, Torsten Bögershausen wrote: > The test suite needs to be run on different platforms. > As it may be difficult for contributors to catch syntax > which work on GNU/linux, but is unportable, make a quick check > for the most common problems. > "sed -i", "echo -n" or "array in

Re: [RFC] Add basic syntax check on shell scripts

2012-12-03 Thread Junio C Hamano
Torsten Bögershausen writes: > The test suite needs to be run on different platforms. > As it may be difficult for contributors to catch syntax > which work on GNU/linux, but is unportable, make a quick check > for the most common problems. > "sed -i", "echo -n" or "array in shell scripts" > This

Re: [RFC] Add basic syntax check on shell scripts

2012-12-03 Thread Nguyen Thai Ngoc Duy
On Mon, Dec 3, 2012 at 11:56 PM, Junio C Hamano wrote: > Torsten Bögershausen writes: > >> The test suite needs to be run on different platforms. >> As it may be difficult for contributors to catch syntax >> which work on GNU/linux, but is unportable, make a quick check >> for the most common pro

Re: [RFC] Add basic syntax check on shell scripts

2012-12-04 Thread Junio C Hamano
Nguyen Thai Ngoc Duy writes: >> This (once it gets cleaned up to reduce false positives) belongs to >> "cd t && make test-lint". > > Or a project commit hook? Surely. It is OK to have "cd t && make test-lint" in your pre-commit hook. A few more things in addition to what Torsten's script attem

Re: [RFC] Add basic syntax check on shell scripts

2012-12-04 Thread Nguyen Thai Ngoc Duy
On Wed, Dec 5, 2012 at 2:39 AM, Junio C Hamano wrote: >> Or a project commit hook? > > Surely. It is OK to have "cd t && make test-lint" in your > pre-commit hook. No, what I meant is a shared pre-commit script that all git devs are encouraged (or forced) to install so bugs are found locally rat

Re: [RFC] Add basic syntax check on shell scripts

2012-12-04 Thread Junio C Hamano
Nguyen Thai Ngoc Duy writes: > On Wed, Dec 5, 2012 at 2:39 AM, Junio C Hamano wrote: >>> Or a project commit hook? >> >> Surely. It is OK to have "cd t && make test-lint" in your >> pre-commit hook. > > No, what I meant is a shared pre-commit script that all git devs are > encouraged (or forced

Re: [RFC] Add basic syntax check on shell scripts

2012-12-04 Thread Jeff King
On Wed, Dec 05, 2012 at 12:43:30PM +0700, Nguyen Thai Ngoc Duy wrote: > On Wed, Dec 5, 2012 at 2:39 AM, Junio C Hamano wrote: > >> Or a project commit hook? > > > > Surely. It is OK to have "cd t && make test-lint" in your > > pre-commit hook. > > No, what I meant is a shared pre-commit script

Re: [RFC] Add basic syntax check on shell scripts

2012-12-04 Thread Jeff King
On Wed, Dec 05, 2012 at 02:30:56AM -0500, Jeff King wrote: > Anyway, I do think a "shell portability lint" would be a great addition > to "test-lint", but I am slightly skeptical that it will be easy to > write a good one that does not have false positives. Still, there may be > some low-hanging f

Re: [RFC] Add basic syntax check on shell scripts

2012-12-05 Thread Sebastian Schuberth
On 2012/12/04 20:39 , Junio C Hamano wrote: A few more things in addition to what Torsten's script attempts to catch that we would want to catch are: [...] > * Do not write ERE with backslashes and expect "grep" to grok them; > that's GNUism. e.g. > >grep "^\(author\|committer\) "

Re: [RFC] Add basic syntax check on shell scripts

2012-12-05 Thread Junio C Hamano
Jeff King writes: > You would want a "check shell script portability" script, and you would > probably want to run it: > > - on the regular built scripts; possibly during build time (I have done > this before with "perl -c" for perl scripts and it is reasonably > successful). Or in a te