Skip to content

Commit dd5b7dc

Browse files
committed
Merge branch 'es/check-non-portable-pre-5.10'
Developer support update. * es/check-non-portable-pre-5.10: check-non-portable-shell: support Perl versions older than 5.10
2 parents bd96a78 + 142997d commit dd5b7dc

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

t/check-non-portable-shell.pl

+5-4
Original file line numberDiff line numberDiff line change
@@ -27,14 +27,14 @@ sub err {
2727
close $f;
2828
}
2929

30+
my $line = '';
3031
while (<>) {
3132
chomp;
33+
$line .= $_;
3234
# stitch together incomplete lines (those ending with "\")
33-
while (s/\\$//) {
34-
$_ .= readline;
35-
chomp;
36-
}
35+
next if $line =~ s/\\$//;
3736

37+
$_ = $line;
3838
/\bcp\s+-a/ and err 'cp -a is not portable';
3939
/\bsed\s+-[^efn]\s+/ and err 'sed option not portable (use only -n, -e, -f)';
4040
/\becho\s+-[neE]/ and err 'echo with option is not portable (use printf)';
@@ -48,6 +48,7 @@ sub err {
4848
/\bexport\s+[A-Za-z0-9_]*=/ and err '"export FOO=bar" is not portable (use FOO=bar && export FOO)';
4949
/^\s*([A-Z0-9_]+=(\w+|(["']).*?\3)\s+)+(\w+)/ and exists($func{$4}) and
5050
err '"FOO=bar shell_func" assignment extends beyond "shell_func"';
51+
$line = '';
5152
# this resets our $. for each file
5253
close ARGV if eof;
5354
}

0 commit comments

Comments
 (0)