diff options
author | jilles <jilles@FreeBSD.org> | 2015-03-15 11:43:51 +0000 |
---|---|---|
committer | jilles <jilles@FreeBSD.org> | 2015-03-15 11:43:51 +0000 |
commit | 06654ae5cb4a97978bdd4367a8acbe2ff3c3ab7b (patch) | |
tree | c5c58f7ca0e8b8c1057cc29eca7b7a0e1f0e0aea /tools/regression/usr.bin | |
parent | 3cc419d83408cc3c19bc1a08007fda0bbb55ca39 (diff) | |
download | FreeBSD-src-06654ae5cb4a97978bdd4367a8acbe2ff3c3ab7b.zip FreeBSD-src-06654ae5cb4a97978bdd4367a8acbe2ff3c3ab7b.tar.gz |
MFC r279779: env: Fix crash when -S string is not empty but no operand
follows.
split_spaces() set argc in main() incorrectly, which caused trouble for
getopt().
Examples:
env -S '\c'
env -S -i
PR: 197769
Diffstat (limited to 'tools/regression/usr.bin')
-rw-r--r-- | tools/regression/usr.bin/env/regress-env.rgdata | 33 | ||||
-rw-r--r-- | tools/regression/usr.bin/env/regress-sb.rb | 1 |
2 files changed, 34 insertions, 0 deletions
diff --git a/tools/regression/usr.bin/env/regress-env.rgdata b/tools/regression/usr.bin/env/regress-env.rgdata index e060eac..90c296e 100644 --- a/tools/regression/usr.bin/env/regress-env.rgdata +++ b/tools/regression/usr.bin/env/regress-env.rgdata @@ -382,3 +382,36 @@ gblenv=OUTSIDEVAR=OutsideValue setenv:D=D_ThisisAlongstring_D1 stdout:A_ThisisAlongstring_A1 B_ThisisAlongstring_B1 C_ThisisAlongstring_C1 D_ThisisAlongstring_D1 ScriptName: [%-script.pathname-%] [run] + +[test] + sb_args:sh + script:[%-testpgm.pathname-%] -S '\c' >/dev/null +[run] +[test] + sb_args:sh + script:[%-testpgm.pathname-%] -S'\c' >/dev/null +[run] +[test] + sb_args:sh + script:[%-testpgm.pathname-%] -u foo -S '\c' >/dev/null +[run] +[test] + sb_args:sh + script:[%-testpgm.pathname-%] -u foo -S'\c' >/dev/null +[run] +[test] + sb_args:sh + script:[%-testpgm.pathname-%] -S '-u bar \c' >/dev/null +[run] +[test] + sb_args:sh + script:[%-testpgm.pathname-%] -S'-u bar \c' >/dev/null +[run] +[test] + sb_args:sh + script:[%-testpgm.pathname-%] -u foo -S '-u bar \c' >/dev/null +[run] +[test] + sb_args:sh + script:[%-testpgm.pathname-%] -u foo -S'-u bar \c' >/dev/null +[run] diff --git a/tools/regression/usr.bin/env/regress-sb.rb b/tools/regression/usr.bin/env/regress-sb.rb index f6333aa..b43ddd3 100644 --- a/tools/regression/usr.bin/env/regress-sb.rb +++ b/tools/regression/usr.bin/env/regress-sb.rb @@ -346,6 +346,7 @@ class RGTestOptions # "just anything" that matches the general pattern. There are # no blanks in the recognized values, but I use an x-tended # regexp and then add blanks to make it more readable. + optval.gsub!(/\[%- testpgm\.pathname -%\]/x, $testpgm) optval.gsub!(/\[%- testpgm\.basename -%\]/x, File.basename($testpgm)) optval.gsub!(/\[%- script\.pathname -%\]/x, $scriptfile) |