Re: [PATCH 2/2] test-lint: detect 'export FOO=bar'
Torsten Bögershausen tbo...@web.de writes: +/^\s*export\s+[^=]*=/ and err 'export FOO=bar is not portable (please use FOO=bar export FOO)'; I have a slightly tighter reg exp in my tree, but credits should go to Thomas: /^\s*export\s+\S+=\S+/ Hmm, is that correct? I would expect shells that have problems with 'export FOO=bar' to also fail on 'export FOO=' (i.e. set to empty string and export). -- Thomas Rast trast@{inf,student}.ethz.ch -- To unsubscribe from this list: send the line unsubscribe git in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 2/2] test-lint: detect 'export FOO=bar'
On 09.07.13 11:28, Thomas Rast wrote: Torsten Bögershausen tbo...@web.de writes: + /^\s*export\s+[^=]*=/ and err 'export FOO=bar is not portable (please use FOO=bar export FOO)'; I have a slightly tighter reg exp in my tree, but credits should go to Thomas: /^\s*export\s+\S+=\S+/ Hmm, is that correct? I would expect shells that have problems with 'export FOO=bar' to also fail on 'export FOO=' (i.e. set to empty string and export). Good point, thanks -- To unsubscribe from this list: send the line unsubscribe git in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 2/2] test-lint: detect 'export FOO=bar'
Some shells do not understand the one-line construct, and instead need FOO=bar export FOO Detect this in the test-lint target. Signed-off-by: Thomas Rast tr...@inf.ethz.ch --- I wrote: Torsten Bögershausen tbo...@web.de writes: [...] - export HARNESS_ACTIVE=t + HARNESS_ACTIVE=t + export HARNESS_ACTIVE [...] Ack. Sorry for breaking this -- I suppose test-lint would have caught me out? Well, no, not yet. t/check-non-portable-shell.pl | 1 + 1 file changed, 1 insertion(+) diff --git a/t/check-non-portable-shell.pl b/t/check-non-portable-shell.pl index 8b5a71d..45971f4 100755 --- a/t/check-non-portable-shell.pl +++ b/t/check-non-portable-shell.pl @@ -21,6 +21,7 @@ while () { /^\s*declare\s+/ and err 'arrays/declare not portable'; /^\s*[^#]\s*which\s/ and err 'which is not portable (please use type)'; /test\s+[^=]*==/ and err 'test a == b is not portable (please use =)'; + /^\s*export\s+[^=]*=/ and err 'export FOO=bar is not portable (please use FOO=bar export FOO)'; # this resets our $. for each file close ARGV if eof; } -- 1.8.3.2.947.g0347b11 -- To unsubscribe from this list: send the line unsubscribe git in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 2/2] test-lint: detect 'export FOO=bar'
On 2013-07-08 17.20, Thomas Rast wrote: Some shells do not understand the one-line construct, and instead need FOO=bar export FOO Detect this in the test-lint target. Signed-off-by: Thomas Rast tr...@inf.ethz.ch --- I wrote: Torsten Bögershausen tbo...@web.de writes: [...] - export HARNESS_ACTIVE=t + HARNESS_ACTIVE=t + export HARNESS_ACTIVE [...] Ack. Sorry for breaking this -- I suppose test-lint would have caught me out? Well, no, not yet. Thanks for working on this t/check-non-portable-shell.pl | 1 + 1 file changed, 1 insertion(+) diff --git a/t/check-non-portable-shell.pl b/t/check-non-portable-shell.pl index 8b5a71d..45971f4 100755 --- a/t/check-non-portable-shell.pl +++ b/t/check-non-portable-shell.pl @@ -21,6 +21,7 @@ while () { /^\s*declare\s+/ and err 'arrays/declare not portable'; /^\s*[^#]\s*which\s/ and err 'which is not portable (please use type)'; /test\s+[^=]*==/ and err 'test a == b is not portable (please use =)'; + /^\s*export\s+[^=]*=/ and err 'export FOO=bar is not portable (please use FOO=bar export FOO)'; I have a slightly tighter reg exp in my tree, but credits should go to Thomas: /^\s*export\s+\S+=\S+/ /Torsten -- To unsubscribe from this list: send the line unsubscribe git in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html