builtin-printf () { run-file builtin-printf "$@" } run-file () { local spec_name=$1; shift; sh-spec spec/$spec_name.test.sh --compare-shells --oils-bin-dir $PWD/bin "$@" }
spec test index / oilshell.org
226 passed, 21 OK, 67 not implemented, 10 BUG, 0 failed, 0 timeouts, 0 cases skipped
mksh | 0 printf with no args stdout: stderr: printf: missing operand Try 'printf --help' for more information. |
zsh | 0 printf with no args stdout: stderr: printf: not enough arguments |
dash | 1 printf -v %s stdout: ['']stderr: dash: 2: printf: Illegal option -v |
mksh | 1 printf -v %s stdout: -v['']stderr: printf: warning: ignoring excess arguments, starting with ‘foo’ |
zsh | 1 printf -v %s stdout: -v['']stderr: |
ash | 1 printf -v %s stdout: -v['']stderr: |
dash | 2 printf -v %q stdout: stderr: dash: 3: printf: Illegal option -v |
mksh | 2 printf -v %q stdout: -vstderr: printf: warning: ignoring excess arguments, starting with ‘foo’ |
zsh | 2 printf -v %q stdout: -vstderr: |
ash | 2 printf -v %q stdout: -vstderr: |
dash | 3 printf -v a[1] stdout: stderr: dash: 1: Syntax error: "(" unexpected |
mksh | 3 printf -v a[1] stdout: -vstatus=0 ['a', 'b', 'c']stderr: printf: warning: ignoring excess arguments, starting with ‘a[1]’ |
zsh | 3 printf -v a[1] stdout: -vstatus=0 ['a', 'b', 'c']stderr: |
ash | 3 printf -v a[1] stdout: stderr: ash: syntax error: unexpected "(" |
mksh | 4 printf -v syntax error stdout: -vstatus=0stderr: printf: warning: ignoring excess arguments, starting with ‘a[’ |
zsh | 4 printf -v syntax error stdout: -vstatus=0stderr: |
ash | 4 printf -v syntax error stdout: -vstatus=0stderr: |
dash | 5 dynamic declare instead of %s stdout: ['']stderr: dash: 2: declare: not found |
mksh | 5 dynamic declare instead of %s stdout: ['']stderr: mksh: <stdin>[2]: declare: not found |
ash | 5 dynamic declare instead of %s stdout: ['']stderr: ash: declare: not found |
dash | 6 dynamic declare instead of %q stdout: stderr: dash: 3: Bad substitution |
mksh | 6 dynamic declare instead of %q stdout: stderr: mksh: <stdin>[3]: declare: not found |
zsh | 6 dynamic declare instead of %q stdout: stderr: zsh: bad substitution |
ash | 6 dynamic declare instead of %q stdout: stderr: ash: syntax error: bad substitution |
osh | 6 dynamic declare instead of %q stdout: $'"quoted" with spaces and \\'stderr: |
dash | 7 printf -v dynamic scope stdout: not implementedstderr: |
mksh | 7 printf -v dynamic scope stdout: not implementedstderr: |
zsh | 7 printf -v dynamic scope stdout: not implementedstderr: |
ash | 7 printf -v dynamic scope stdout: not implementedstderr: |
osh | 7 printf -v dynamic scope stdout: dollar=dollar -- dollar='$' mylocal=mylocal -- dollar='$' mylocal=stderr: |
mksh | 16 %06s is no-op stdout: ( 42) ( -42) ((status=1stderr: printf: %06s: invalid conversion specification printf: %06s: invalid conversion specification |
mksh | 18 printf %6.0s and %0.0s stdout: [ ] [stderr: printf: %0.0s: invalid conversion specification |
mksh | 19 printf %6.s and %0.s stdout: [ ] [stderr: printf: %0.s: invalid conversion specification |
zsh | 19 printf %6.s and %0.s stdout: [ foo] [foo]stderr: |
mksh | 22 unsigned / octal / hex big stdout: [1] [1] [1] [1] [2147483647] [17777777777] [7fffffff] [7FFFFFFF]stderr: |
ash | 23 empty string (osh is more strict) stdout: 0stderr: ash: invalid number '' |
osh | 23 empty string (osh is more strict) stdout: stderr: printf '%d\n' '' ^ [ stdin ]:1: printf expected an integer, got '' |
mksh | 24 No char after ' => zero code point stdout: 0 0stderr: printf: ‘'’: expected a numeric value printf: ‘"’: expected a numeric value |
dash | 25 Unicode char with ' stdout: ce 206 316 e4 228 344stderr: |
mksh | 25 Unicode char with ' stdout: ce 206 316 e4 228 344stderr: 'printf: warning: \xbc: character(s) following character constant have been ignored\nprintf: warning: \xbc: character(s) following character constant have been ignored\nprintf: warning: \xbc: character(s) following character constant have been ignored\nprintf: warning: \xb8\x89: character(s) following character constant have been ignored\nprintf: warning: \xb8\x89: character(s) following character constant have been ignored\nprintf: warning: \xb8\x89: character(s) following character constant have been ignored\n' |
ash | 25 Unicode char with ' stdout: ce 206 316 e4 228 344stderr: |
dash | 27 Too large stdout: too large f4 244 364stderr: |
mksh | 27 Too large stdout: too large f4 244 364stderr: 'printf: warning: \x91\x84\x91: character(s) following character constant have been ignored\nprintf: warning: \x91\x84\x91: character(s) following character constant have been ignored\nprintf: warning: \x91\x84\x91: character(s) following character constant have been ignored\n' |
ash | 27 Too large stdout: too large f4 244 364stderr: |
osh | 27 Too large stdout: too large f4 244 364stderr: printf '%x\n' \'$too_large ^~ [ stdin ]:3: Warning: UTF-8 decode: Integer too large at offset 1 in string of 5 bytes printf '%u\n' \'$too_large ^~ [ stdin ]:4: Warning: UTF-8 decode: Integer too large at offset 1 in string of 5 bytes printf '%o\n' \'$too_large ^~ [ stdin ]:5: Warning: UTF-8 decode: Integer too large at offset 1 in string of 5 bytes |
osh | 28 negative numbers with unsigned / octal / hex stdout: stderr: [%u]\n ^ [ printf word at line 1 of [ stdin ] ]:1 printf '[%u]\n' -42 ^ [ stdin ]:1: fatal: Can't format negative number with %u: -42 |
osh | 29 printf floating point (not required, but they all implement it) stdout: stderr: [%f]\n ^ [ printf word at line 1 of [ stdin ] ]:1 printf '[%f]\n' 3.14159 ^ [ stdin ]:1: osh printf doesn't support floating point [%.2f]\n ^ [ printf word at line 2 of [ stdin ] ]:1 printf '[%.2f]\n' 3.14159 ^ [ stdin ]:2: osh printf doesn't support floating point [%8.2f]\n ^ [ printf word at line 3 of [ stdin ] ]:1 printf '[%8.2f]\n' 3.14159 ^ [ stdin ]:3: osh printf doesn't support floating point [%-8.2f]\n ^ [ printf word at line 4 of [ stdin ] ]:1 printf '[%-8.2f]\n' 3.14159 ^ [ stdin ]:4: osh printf doesn't support floating point [%-f]\n ^ [ printf word at line 5 of [ stdin ] ]:1 printf '[%-f]\n' 3.14159 ^ [ stdin ]:5: osh printf doesn't support floating point [%-f]\n ^ [ printf word at line 6 of [ stdin ] ]:1 printf '[%-f]\n' 3.14 ^ [ stdin ]:6: osh printf doesn't support floating point |
osh | 30 printf floating point with - and 0 stdout: ---stderr: [%8.4f]\n ^ [ printf word at line 1 of [ stdin ] ]:1 printf '[%8.4f]\n' 3.14 ^ [ stdin ]:1: osh printf doesn't support floating point [%08.4f]\n ^ [ printf word at line 2 of [ stdin ] ]:1 printf '[%08.4f]\n' 3.14 ^ [ stdin ]:2: osh printf doesn't support floating point [%8.04f]\n ^ [ printf word at line 3 of [ stdin ] ]:1 printf '[%8.04f]\n' 3.14 # meaning less 0 ^ [ stdin ]:3: Expected a printf format character [%08.04f]\n ^ [ printf word at line 4 of [ stdin ] ]:1 printf '[%08.04f]\n' 3.14 ^ [ stdin ]:4: Expected a printf format character [%-8.4f]\n ^ [ printf word at line 6 of [ stdin ] ]:1 printf '[%-8.4f]\n' 3.14 ^ [ stdin ]:6: osh printf doesn't support floating point [%-08.4f]\n ^ [ printf word at line 7 of [ stdin ] ]:1 printf '[%-08.4f]\n' 3.14 ^ [ stdin ]:7: osh printf doesn't support floating point [%-8.04f]\n ^ [ printf word at line 8 of [ stdin ] ]:1 printf '[%-8.04f]\n' 3.14 ^ [ stdin ]:8: Expected a printf format character [%-08.04f]\n ^ [ printf word at line 9 of [ stdin ] ]:1 printf '[%-08.04f]\n' 3.14 ^ [ stdin ]:9: Expected a printf format character |
osh | 31 printf eE fF gG stdout: stderr: [%e]\n ^ [ printf word at line 1 of [ stdin ] ]:1 printf '[%e]\n' 3.14 ^ [ stdin ]:1: osh printf doesn't support floating point [%E]\n ^ [ printf word at line 2 of [ stdin ] ]:1 printf '[%E]\n' 3.14 ^ [ stdin ]:2: osh printf doesn't support floating point [%f]\n ^ [ printf word at line 3 of [ stdin ] ]:1 printf '[%f]\n' 3.14 ^ [ stdin ]:3: osh printf doesn't support floating point [%g]\n ^ [ printf word at line 4 of [ stdin ] ]:1 printf '[%g]\n' 3.14 ^ [ stdin ]:4: osh printf doesn't support floating point [%G]\n ^ [ printf word at line 5 of [ stdin ] ]:1 printf '[%G]\n' 3.14 ^ [ stdin ]:5: osh printf doesn't support floating point |
dash | 32 printf backslash escapes stdout: ['a\tb'] ['\\xE2\\x98\\xA0'] ['$e'] ['\x1f7']stderr: |
dash | 34 printf unicode backslash escapes stdout: ['\\u2620'] ['\\U0000065f']stderr: |
ash | 34 printf unicode backslash escapes stdout: ['\\u2620'] ['\\U0000065f']stderr: |
dash | 39 printf %c -- doesn't respect UTF-8! Bad. stdout: [$\u03bc\u03bc] 1stderr: |
ash | 39 printf %c -- doesn't respect UTF-8! Bad. stdout: [\u03bc\u03bc] 1stderr: |
osh | 39 printf %c -- doesn't respect UTF-8! Bad. stdout: [μμ] 0stderr: %c ^ [ printf word at line 3 of [ stdin ] ]:1 printf '%c' "$twomu" | wc --bytes ^ [ stdin ]:3: osh printf doesn't support single characters (bytes) |
dash | 40 printf invalid format stdout: status=2 status=2stderr: dash: 1: printf: %z: invalid directive dash: 3: printf: %-z: invalid directive |
osh | 40 printf invalid format stdout: status=2 status=2stderr: %z ^ [ printf word at line 1 of [ stdin ] ]:1 printf '%z' 42 ^ [ stdin ]:1: Invalid printf format character %-z ^ [ printf word at line 3 of [ stdin ] ]:1 printf '%-z' 42 ^ [ stdin ]:3: Invalid printf format character |
dash | 41 printf %q stdout: [stderr: dash: 2: printf: %q: invalid directive |
bash | 41 printf %q stdout: [a\ b]stderr: |
zsh | 41 printf %q stdout: [a\ b]stderr: |
ash | 41 printf %q stdout: [stderr: ash: %q]\n: invalid format |
dash | 42 printf %6q (width) stdout: [[stderr: dash: 2: printf: %6q: invalid directive dash: 3: printf: %1q: invalid directive |
bash | 42 printf %6q (width) stdout: [ a\ b] [a\ b]stderr: |
mksh | 42 printf %6q (width) stdout: [[stderr: printf: %6q: invalid conversion specification printf: %1q: invalid conversion specification |
zsh | 42 printf %6q (width) stdout: [ a\ b] [a\ b]stderr: |
ash | 42 printf %6q (width) stdout: [[stderr: ash: %6q]\n: invalid format ash: %1q]\n: invalid format |
zsh | 43 printf negative numbers stdout: [-42] status=0 [-42] status=0 [-42] status=0 [-42] status=0 [-42] status=0 [-42] status=0 [0] status=1 [0] status=1stderr: zsh: bad math expression: operator expected at `z' zsh: bad math expression: operator expected at `z' |
ash | 43 printf negative numbers stdout: [-42] status=0 [-42] status=0 [-42] status=0 [-42] status=0 [0] status=1 [0] status=1 [0] status=1 [0] status=1stderr: ash: invalid number '-42 ' ash: invalid number '-42 ' ash: invalid number '-42z' ash: invalid number '-42z' |
osh | 43 printf negative numbers stdout: [-42] status=0 [-42] status=0 [-42] status=0 [-42] status=0 [-42] status=0 [-42] status=0 status=1 status=1stderr: printf '[%d] ' ' -42z' ^ [ stdin ]:16: printf expected an integer, got ' -42z' printf '[%i] ' ' -42z' ^ [ stdin ]:18: printf expected an integer, got ' -42z' |
osh | 44 printf + and space flags stdout: stderr: [%+d]\n ^ [ printf word at line 1 of [ stdin ] ]:1 printf '[%+d]\n' 42 ^ [ stdin ]:1: osh printf doesn't support the '+' flag [%+d]\n ^ [ printf word at line 2 of [ stdin ] ]:1 printf '[%+d]\n' -42 ^ [ stdin ]:2: osh printf doesn't support the '+' flag [% d]\n ^ [ printf word at line 3 of [ stdin ] ]:1 printf '[% d]\n' 42 ^ [ stdin ]:3: osh printf doesn't support the ' ' flag [% d]\n ^ [ printf word at line 4 of [ stdin ] ]:1 printf '[% d]\n' -42 ^ [ stdin ]:4: osh printf doesn't support the ' ' flag |
osh | 45 printf # flag stdout: ---stderr: [%#o][%#o]\n ^ [ printf word at line 1 of [ stdin ] ]:1 printf '[%#o][%#o]\n' 0 42 ^ [ stdin ]:1: osh printf doesn't support the '#' flag [%#x][%#x]\n ^ [ printf word at line 2 of [ stdin ] ]:1 printf '[%#x][%#x]\n' 0 42 ^ [ stdin ]:2: osh printf doesn't support the '#' flag [%#X][%#X]\n ^ [ printf word at line 3 of [ stdin ] ]:1 printf '[%#X][%#X]\n' 0 42 ^ [ stdin ]:3: osh printf doesn't support the '#' flag [%.0f][%#.0f]\n ^ [ printf word at line 5 of [ stdin ] ]:1 printf '[%.0f][%#.0f]\n' 3 3 ^ [ stdin ]:5: osh printf doesn't support floating point [%g][%#g]\n ^ [ printf word at line 6 of [ stdin ] ]:1 printf '[%g][%#g]\n' 3 3 ^ [ stdin ]:6: osh printf doesn't support floating point |
zsh | 46 Runtime error for invalid integer stdout: 0 status=1 0 status=0stderr: zsh: bad math expression: operator expected at `abc' |
ash | 46 Runtime error for invalid integer stdout: 0 status=1 0 status=1stderr: ash: invalid number '3abc' ash: invalid number 'xyz' |
osh | 46 Runtime error for invalid integer stdout: status=1 status=1stderr: printf '%d\n' $x ^~ [ stdin ]:2: printf expected an integer, got '3abc' printf '%d\n' xyz ^~~ [ stdin ]:4: printf expected an integer, got 'xyz' |
dash | 47 %(strftime format)T stdout: status=2stderr: dash: 2: printf: %(: invalid directive dash: 4: printf: %(: invalid directive |
mksh | 47 %(strftime format)T stdout: status=1stderr: printf: %(: invalid conversion specification printf: %(: invalid conversion specification |
zsh | 47 %(strftime format)T stdout: status=1stderr: printf: %(: invalid directive printf: %(: invalid directive |
ash | 47 %(strftime format)T stdout: status=1stderr: ash: %(%Y-%m-%d)T\n: invalid format ash: %(%Y-%m-%d)T\n: invalid format |
dash | 48 %(strftime format)T doesn't respect TZ if not exported stdout: stderr: dash: 2: printf: %(: invalid directive dash: 5: printf: %(: invalid directive |
mksh | 48 %(strftime format)T doesn't respect TZ if not exported stdout: stderr: printf: %(: invalid conversion specification printf: %(: invalid conversion specification |
zsh | 48 %(strftime format)T doesn't respect TZ if not exported stdout: stderr: printf: %(: invalid directive printf: %(: invalid directive |
ash | 48 %(strftime format)T doesn't respect TZ if not exported stdout: stderr: ash: %(%Y-%m-%d %H:%M:%S)T\n: invalid format ash: %(%Y-%m-%d %H:%M:%S)T\n: invalid format |
dash | 49 %(strftime format)T TZ in environ but not in shell's memory stdout: stderr: dash: 2: printf: %(: invalid directive dash: 6: printf: %(: invalid directive |
mksh | 49 %(strftime format)T TZ in environ but not in shell's memory stdout: stderr: printf: %(: invalid conversion specification printf: %(: invalid conversion specification |
zsh | 49 %(strftime format)T TZ in environ but not in shell's memory stdout: stderr: printf: %(: invalid directive printf: %(: invalid directive |
ash | 49 %(strftime format)T TZ in environ but not in shell's memory stdout: stderr: ash: %(%Y-%m-%d %H:%M:%S)T\n: invalid format ash: %(%Y-%m-%d %H:%M:%S)T\n: invalid format |
dash | 50 %10.5(strftime format)T stdout: [[status=2stderr: dash: 2: printf: %10.5(: invalid directive dash: 4: printf: %10.5(: invalid directive |
mksh | 50 %10.5(strftime format)T stdout: [[status=1stderr: printf: %10.5(: invalid conversion specification printf: %10.5(: invalid conversion specification |
zsh | 50 %10.5(strftime format)T stdout: [[status=1stderr: printf: %10.5(: invalid directive printf: %10.5(: invalid directive |
ash | 50 %10.5(strftime format)T stdout: [[status=1stderr: ash: %10.5(%Y-%m-%d)T]\n: invalid format ash: %10.5(%Y-%m-%d)T]\n: invalid format |
dash | 52 bash truncates long strftime string at 128 stdout: stderr: |
mksh | 52 bash truncates long strftime string at 128 stdout: stderr: |
zsh | 52 bash truncates long strftime string at 128 stdout: stderr: |
ash | 52 bash truncates long strftime string at 128 stdout: stderr: |
osh | 52 bash truncates long strftime string at 128 stdout: 4 40 120 124 128stderr: |
dash | 53 printf with explicit NUL byte stdout: stderr: |
zsh | 53 printf with explicit NUL byte stdout: x z zstderr: |
ash | 53 printf with explicit NUL byte stdout: stderr: |