{"thread":{"id":"33605","subject":"[PATCH] test-lint-shell-syntax: Allow bash syntax in bash tests","startedAt":"2013-04-25T18:48:33Z","lastAt":"2013-04-25T18:48:33Z","messageCount":1,"participants":["Torsten Bögershausen"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"215471","messageId":"201304252048.33803.tboegi@web.de","threadId":"33605","inReplyTo":null,"subject":"[PATCH] test-lint-shell-syntax: Allow bash syntax in bash tests","fromName":"Torsten Bögershausen","fromEmail":"tboegi@web.de","sentAt":"2013-04-25T18:48:33Z","receivedAt":"2013-04-25T18:48:33Z","isPatch":true,"sender":{"key":"tboegi@web.de","avatar":"https://avatars.githubusercontent.com/u/7138363?v=4"},"body":"t/check-non-portable-sh.pl checks for bash only syntax like test $a == $b\nThis is wrong when bash is used.\nSwitch to bash mode and skip this test\n\nSigned-off-by: Torsten Bögershausen <tboegi@web.de>\n---\n t/check-non-portable-shell.pl | 7 +++++--\n 1 file changed, 5 insertions(+), 2 deletions(-)\n\ndiff --git a/t/check-non-portable-shell.pl b/t/check-non-portable-shell.pl\nindex 58f8e2c..1ca8c8b 100755\n--- a/t/check-non-portable-shell.pl\n+++ b/t/check-non-portable-shell.pl\n@@ -7,23 +7,26 @@ use strict;\n use warnings;\n \n my $exit_code=0;\n+my $bashmode=0;\n \n sub err {\n \tmy $msg = shift;\n-\tprint \"$ARGV:$.: error: $msg: $_\\n\";\n+\tprint \"$ARGV:$.: error: (bashmode=$bashmode) $msg: $_\\n\";\n \t$exit_code = 1;\n }\n \n while (<>) {\n \tchomp;\n+\t/^\\. \\.\\/lib\\-bash.sh/ and $bashmode=1;\n \t/ e?grep\\s+\\\"[^\"]*\\\\([st])/ and err \"grep \\\\$1 is not portable)\";\n \t/ [^e]grep.*\\\\\\+/ and err 'grep with \\+ is not portable (please use egrep)';\n \t/^\\s*sed\\s+-i/ and err 'sed -i is not portable';\n \t/^\\s*echo\\s+-(\\S)\\s+/ and err \"echo -$1 is not portable (please use printf)\";\n \t/^\\s*declare\\s+/ and err 'arrays/declare not portable';\n \t/^\\s*[^#]\\s*which\\s/ and err 'which is not portable (please use type)';\n-\t/test\\s+[^=]*==/ and err '\"test a == b\" is not portable (please use =)';\n+\t$bashmode==0 and /test\\s+[^=]*==/ and err '\"test a == b\" is not portable (please use =)';\n \t# this resets our $. for each file\n \tclose ARGV if eof;\n+\t$bashmode=0 if eof;\n }\n exit $exit_code;\n-- \n1.8.2.1.614.g66d7af5\n"}]}