diff options
| author | Conrad Meyer <cem@FreeBSD.org> | 2019-03-07 18:24:16 +0000 |
|---|---|---|
| committer | Conrad Meyer <cem@FreeBSD.org> | 2019-03-07 18:24:16 +0000 |
| commit | 905fdc3ff1c2e58478d205cd78d904ffa1f738d4 (patch) | |
| tree | a7451df3cfd3f3f7a027d9b73b886c53475d7ff3 /usr.bin/seq | |
| parent | 052d159a8b83f03d7dc5eb31cd9a9b4a6fe3d9da (diff) | |
Notes
Diffstat (limited to 'usr.bin/seq')
| -rw-r--r-- | usr.bin/seq/seq.c | 3 | ||||
| -rwxr-xr-x | usr.bin/seq/tests/seq_test.sh | 17 |
2 files changed, 18 insertions, 2 deletions
diff --git a/usr.bin/seq/seq.c b/usr.bin/seq/seq.c index 04f3c5c81f41c..7559dbd9ce20d 100644 --- a/usr.bin/seq/seq.c +++ b/usr.bin/seq/seq.c @@ -310,7 +310,8 @@ valid_format(const char *fmt) } } - return (conversions <= 1); + /* PR 236347 -- user format strings must have a conversion */ + return (conversions == 1); } /* diff --git a/usr.bin/seq/tests/seq_test.sh b/usr.bin/seq/tests/seq_test.sh index efc4396752f53..f6f20a87216b7 100755 --- a/usr.bin/seq/tests/seq_test.sh +++ b/usr.bin/seq/tests/seq_test.sh @@ -1,4 +1,4 @@ -# Copyright (c) 2018 Conrad Meyer <cem@FreeBSD.org> +# Copyright (c) 2019 Conrad Meyer <cem@FreeBSD.org> # All rights reserved. # # Redistribution and use in source and binary forms, with or without @@ -34,7 +34,22 @@ float_rounding_body() atf_check -o inline:'1\n1.1\n1.2\n' seq 1 0.1 1.2 } +atf_test_case format_includes_conversion +format_includes_conversion_head() +{ + atf_set "descr" "Check for correct user-provided format strings" +} +format_includes_conversion_body() +{ + # PR 236347 + atf_check -s exit:1 -o empty -e match:"invalid format string" \ + seq -f foo 3 + atf_check -s exit:0 -o inline:'foo1\nfoo2\n' -e empty \ + seq -f foo%g 2 +} + atf_init_test_cases() { atf_add_test_case float_rounding + atf_add_test_case format_includes_conversion } |
