{"thread":{"id":"32739","subject":"[PATCH v2] Reduce false positive in check-non-portable-shell.pl","startedAt":"2013-01-27T07:46:00Z","lastAt":"2013-01-27T07:46:00Z","messageCount":1,"participants":["Torsten Bögershausen"],"isPatch":true,"patchVersion":2,"patchTotal":null},"messages":[{"id":"207939","messageId":"201301270846.00842.tboegi@web.de","threadId":"32739","inReplyTo":null,"subject":"[PATCH v2] Reduce false positive in check-non-portable-shell.pl","fromName":"Torsten Bögershausen","fromEmail":"tboegi@web.de","sentAt":"2013-01-27T07:46:00Z","receivedAt":"2013-01-27T07:46:00Z","isPatch":true,"sender":{"key":"tboegi@web.de","avatar":"https://avatars.githubusercontent.com/u/7138363?v=4"},"body":"check-non-portable-shell.pl is using simple regular expressions to\nfind illegal shell syntax.\n\nImprove the expressions and reduce the chance for false positves:\n\n\"sed -i\" must be followed by 1..n whitespace and 1 non whitespace\n\"declare\" must be followed by 1..n whitespace and 1 non whitespace\n\"echo -n\" must be followed by 1..n whitespace and 1 non whitespace\n\"which\": catch lines like \"if which foo\"\n\nSigned-off-by: Torsten Bögershausen <tboegi@web.de>\n---\n t/check-non-portable-shell.pl | 8 ++++----\n 1 file changed, 4 insertions(+), 4 deletions(-)\n\ndiff --git a/t/check-non-portable-shell.pl b/t/check-non-portable-shell.pl\nindex 8b5a71d..d9ddcdf 100755\n--- a/t/check-non-portable-shell.pl\n+++ b/t/check-non-portable-shell.pl\n@@ -16,10 +16,10 @@ sub err {\n \n while (<>) {\n \tchomp;\n-\t/^\\s*sed\\s+-i/ and err 'sed -i is not portable';\n-\t/^\\s*echo\\s+-n/ and err 'echo -n 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/^\\s*sed\\s+-i\\s+\\S/ and err 'sed -i is not portable';\n+\t/^\\s*echo\\s+-n\\s+\\S/ and err 'echo -n is not portable (please use printf)';\n+\t/^\\s*declare\\s+\\S/ and err 'arrays/declare not portable';\n+\t/^\\s*if\\s+which\\s+\\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# this resets our $. for each file\n \tclose ARGV if eof;\n-- \n1.8.1.1\n"}]}