Results for builtin-printf.test.sh

statusdashbashmkshzshashosh
pass 395839383748
ok 456538
N-I 1801513176
BUG-2 000100
BUG 203660
FAIL 000001
total636363636363
casedashbashmkshzshashoshdescription
0pass pass ok ok pass pass printf with no args
detailsdetails
1N-I pass N-I N-I N-I pass printf -v %s
detailsdetailsdetailsdetails
2N-I pass N-I N-I N-I pass printf -v %q
detailsdetailsdetailsdetails
3N-I pass N-I N-I N-I pass printf -v a[1]
detailsdetailsdetailsdetails
4pass pass N-I N-I N-I pass printf -v syntax error
detailsdetailsdetails
5N-I pass N-I pass N-I pass dynamic declare instead of %s
detailsdetailsdetails
6N-I pass N-I N-I N-I ok dynamic declare instead of %q
detailsdetailsdetailsdetailsdetails
7N-I pass N-I N-I N-I ok printf -v dynamic scope
detailsdetailsdetailsdetailsdetails
8pass pass pass pass pass pass printf with too few arguments
9pass pass pass pass pass pass printf with too many arguments
10pass pass pass pass pass pass printf width strings
11pass pass pass pass pass pass printf integer
12pass pass pass pass pass pass printf %6.4d -- "precision" does padding for integers
13pass pass pass pass pass pass printf %6.4x X o
14pass pass pass pass pass pass %06d zero padding vs. %6.6d
15pass pass pass pass pass pass %06x %06X %06o
16pass pass ok pass pass pass %06s is no-op
details
17pass pass pass pass pass pass printf %6.4s does both truncation and padding
18pass pass N-I pass pass pass printf %6.0s and %0.0s
details
19pass pass N-I BUG pass pass printf %6.s and %0.s
detailsdetails
20pass pass pass pass pass pass printf %*.*s (width/precision from args)
21pass pass pass pass pass pass unsigned / octal / hex
22pass pass BUG pass pass pass unsigned / octal / hex big
details
23pass pass pass pass ok ok empty string (osh is more strict)
detailsdetails
24pass pass ok pass pass pass No char after ' => zero code point
details
25BUG pass BUG pass BUG pass Unicode char with '
detailsdetailsdetails
26pass pass pass pass pass pass Invalid UTF-8
27BUG pass BUG pass BUG ok Too large
detailsdetailsdetailsdetails
28pass pass pass pass pass N-I negative numbers with unsigned / octal / hex
details
29pass pass pass pass pass N-I printf floating point (not required, but they all implement it)
details
30pass pass pass pass pass N-I printf floating point with - and 0
details
31pass pass pass pass pass N-I printf eE fF gG
details
32N-I pass pass pass pass pass printf backslash escapes
details
33pass pass pass pass pass pass printf octal backslash escapes
34N-I pass pass pass N-I pass printf unicode backslash escapes
detailsdetails
35pass pass pass pass pass pass printf invalid backslash escape (is ignored)
36pass pass pass pass pass pass printf % escapes
37pass pass pass pass pass pass printf %c ASCII
38N-I pass pass pass N-I pass printf %c unicode - prints the first BYTE of a string - it does not respect UTF-8
detailsdetails
39ok pass pass pass pass ok printf invalid format
detailsdetails
40N-I ok pass ok N-I pass printf %q
detailsdetailsdetailsdetails
41N-I ok N-I ok N-I pass printf %6q (width)
detailsdetailsdetailsdetailsdetails
42pass pass pass ok ok FAIL printf negative numbers
detailsdetailsdetails
43pass pass pass pass pass N-I printf + and space flags
details
44pass pass pass pass pass N-I printf # flag
details
45pass pass pass BUG BUG ok Runtime error for invalid integer
detailsdetailsdetails
46N-I pass N-I N-I N-I pass %(strftime format)T
detailsdetailsdetailsdetails
47N-I pass N-I N-I N-I pass %(strftime format)T doesn't respect TZ if not exported
detailsdetailsdetailsdetails
48N-I pass N-I N-I N-I pass %(strftime format)T TZ in environ but not in shell's memory
detailsdetailsdetailsdetails
49N-I pass N-I N-I N-I pass %10.5(strftime format)T
detailsdetailsdetailsdetails
50pass pass pass pass pass pass Regression for 'printf x y'
51N-I pass N-I N-I N-I ok bash truncates long strftime string at 128
detailsdetailsdetailsdetailsdetails
52ok ok ok BUG BUG pass printf positive integer overflow
detailsdetailsdetailsdetailsdetails
53ok ok ok BUG BUG pass printf negative integer overflow
detailsdetailsdetailsdetailsdetails
54N-I pass pass pass pass pass printf %b does backslash escaping
details
55N-I pass pass pass N-I pass printf %b unicode escapes
detailsdetails
56pass pass pass pass pass pass printf %b respects \c early return
57pass pass pass N-I pass pass printf %b supports octal escapes, both \141 and \0141
details
58pass pass pass N-I pass pass printf %b with truncated octal escapes
details
59pass pass pass BUG pass pass printf %d %X support hex 0x5 and octal 055
details
60pass pass pass BUG pass pass printf %d with + prefix (positive sign)
details
61pass pass pass BUG-2 BUG ok leading spaces are accepted in value given to %d %X, but not trailing spaces
detailsdetailsdetails
62ok ok ok ok ok pass Arbitrary base 64#a is rejected (unlike in shell arithmetic)
detailsdetailsdetailsdetailsdetails
259 passed, 31 OK, 69 not implemented, 18 BUG, 1 failed, 0 timeouts, 0 cases skipped
1 failed under osh

Details on runs that didn't PASS

mksh0 printf with no args

stdout:
stderr: 
printf: missing operand
Try 'printf --help' for more information.
zsh0 printf with no args

stdout:
stderr: 
printf: not enough arguments
dash1 printf -v %s

stdout:
['']
stderr:
dash: 2: printf: Illegal option -v
mksh1 printf -v %s

stdout:
-v['']
stderr:
printf: warning: ignoring excess arguments, starting with ‘foo’
zsh1 printf -v %s

stdout:
-v['']
stderr:
ash1 printf -v %s

stdout:
-v['']
stderr:
dash2 printf -v %q

stdout:
stderr: 
dash: 3: printf: Illegal option -v
mksh2 printf -v %q

stdout:
-v
stderr:
printf: warning: ignoring excess arguments, starting with ‘foo’
zsh2 printf -v %q

stdout:
-v
stderr:
ash2 printf -v %q

stdout:
-v
stderr:
dash3 printf -v a[1]

stdout:
stderr: 
dash: 1: Syntax error: "(" unexpected
mksh3 printf -v a[1]

stdout:
-vstatus=0
['a', 'b', 'c']
stderr:
printf: warning: ignoring excess arguments, starting with ‘a[1]’
zsh3 printf -v a[1]

stdout:
-vstatus=0
['a', 'b', 'c']
stderr:
ash3 printf -v a[1]

stdout:
stderr: 
ash: syntax error: unexpected "("
mksh4 printf -v syntax error

stdout:
-vstatus=0
stderr:
printf: warning: ignoring excess arguments, starting with ‘a[’
zsh4 printf -v syntax error

stdout:
-vstatus=0
stderr:
ash4 printf -v syntax error

stdout:
-vstatus=0
stderr:
dash5 dynamic declare instead of %s

stdout:
['']
stderr:
dash: 2: declare: not found
mksh5 dynamic declare instead of %s

stdout:
['']
stderr:
mksh: <stdin>[2]: declare: not found
ash5 dynamic declare instead of %s

stdout:
['']
stderr:
ash: declare: not found
dash6 dynamic declare instead of %q

stdout:
stderr: 
dash: 3: Bad substitution
mksh6 dynamic declare instead of %q

stdout:
stderr: 
mksh: <stdin>[3]: declare: not found
zsh6 dynamic declare instead of %q

stdout:
stderr: 
zsh: bad substitution
ash6 dynamic declare instead of %q

stdout:
stderr: 
ash: syntax error: bad substitution
osh6 dynamic declare instead of %q

stdout:
$'"quoted" with spaces and \\'
stderr:
dash7 printf -v dynamic scope

stdout:
not implemented
stderr:
mksh7 printf -v dynamic scope

stdout:
not implemented
stderr:
zsh7 printf -v dynamic scope

stdout:
not implemented
stderr:
ash7 printf -v dynamic scope

stdout:
not implemented
stderr:
osh7 printf -v dynamic scope

stdout:
dollar=dollar
--
dollar='$'
mylocal=mylocal
--
dollar='$'
mylocal=
stderr:
mksh16 %06s is no-op

stdout:
(    42)
(   -42)
((status=1
stderr:
printf: %06s: invalid conversion specification
printf: %06s: invalid conversion specification
mksh18 printf %6.0s and %0.0s

stdout:
[      ]
[
stderr:
printf: %0.0s: invalid conversion specification
mksh19 printf %6.s and %0.s

stdout:
[      ]
[
stderr:
printf: %0.s: invalid conversion specification
zsh19 printf %6.s and %0.s

stdout:
[   foo]
[foo]
stderr:
mksh22 unsigned / octal / hex big

stdout:
[1]
[1]
[1]
[1]

[2147483647]
[17777777777]
[7fffffff]
[7FFFFFFF]

stderr:
ash23 empty string (osh is more strict)

stdout:
0
stderr:
ash: invalid number ''
osh23 empty string (osh is more strict)

stdout:
stderr: 
  printf '%d\n' ''
                ^
[ stdin ]:1: printf expected an integer, got ''
mksh24 No char after ' => zero code point

stdout:
0
0
stderr:
printf: ‘'’: expected a numeric value
printf: ‘"’: expected a numeric value
dash25 Unicode char with '

stdout:
ce
206
316

e4
228
344

stderr:
mksh25 Unicode char with '

stdout:
weird bug
stderr:
ash25 Unicode char with '

stdout:
ce
206
316

e4
228
344

stderr:
dash27 Too large

stdout:
too large
f4
244
364

stderr:
mksh27 Too large

stdout:
weird bug
stderr:
ash27 Too large

stdout:
too large
f4
244
364

stderr:
osh27 Too large

stdout:
too large
f4
244
364

stderr:
  printf '%x\n' \'$too_large
                ^~
[ stdin ]:5: Warning: UTF-8 decode: Integer too large at offset 1 in string of 5 bytes
  printf '%u\n' \'$too_large
                ^~
[ stdin ]:6: Warning: UTF-8 decode: Integer too large at offset 1 in string of 5 bytes
  printf '%o\n' \'$too_large
                ^~
[ stdin ]:7: Warning: UTF-8 decode: Integer too large at offset 1 in string of 5 bytes
osh28 negative numbers with unsigned / octal / hex

stdout:
status=1
status=1
status=1
status=1
stderr:
  [%u]\n
    ^
[ printf arg at line 1 of [ stdin ] ]:1

  printf '[%u]\n' -42
         ^
[ stdin ]:1: Can't format negative number with %u: -42
  [%o]\n
    ^
[ printf arg at line 4 of [ stdin ] ]:1

  printf '[%o]\n' -42
         ^
[ stdin ]:4: Can't format negative number with %o: -42
  [%x]\n
    ^
[ printf arg at line 7 of [ stdin ] ]:1

  printf '[%x]\n' -42
         ^
[ stdin ]:7: Can't format negative number with %x: -42
  [%X]\n
    ^
[ printf arg at line 10 of [ stdin ] ]:1

  printf '[%X]\n' -42
         ^
[ stdin ]:10: Can't format negative number with %X: -42
osh29 printf floating point (not required, but they all implement it)

stdout:
stderr: 
  [%f]\n
    ^
[ printf arg at line 1 of [ stdin ] ]:1

  printf '[%f]\n' 3.14159
         ^
[ stdin ]:1: osh printf doesn't support floating point
  [%.2f]\n
      ^
[ printf arg at line 2 of [ stdin ] ]:1

  printf '[%.2f]\n' 3.14159
         ^
[ stdin ]:2: osh printf doesn't support floating point
  [%8.2f]\n
       ^
[ printf arg 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 arg at line 4 of [ stdin ] ]:1

  printf '[%-8.2f]\n' 3.14159
         ^
[ stdin ]:4: osh printf doesn't support floating point
  [%-f]\n
     ^
[ printf arg at line 5 of [ stdin ] ]:1

  printf '[%-f]\n' 3.14159
         ^
[ stdin ]:5: osh printf doesn't support floating point
  [%-f]\n
     ^
[ printf arg at line 6 of [ stdin ] ]:1

  printf '[%-f]\n' 3.14
         ^
[ stdin ]:6: osh printf doesn't support floating point
osh30 printf floating point with - and 0

stdout:
---
stderr:
  [%8.4f]\n
       ^
[ printf arg 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 arg 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 arg 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 arg at line 4 of [ stdin ] ]:1

  printf '[%08.04f]\n' 3.14
         ^
[ stdin ]:4: Expected a printf format character
  [%-8.4f]\n
        ^
[ printf arg 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 arg 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 arg at line 8 of [ stdin ] ]:1

  printf '[%-8.04f]\n' 3.14
         ^
[ stdin ]:8: Expected a printf format character
  [%-08.04f]\n
         ^
[ printf arg at line 9 of [ stdin ] ]:1

  printf '[%-08.04f]\n' 3.14
         ^
[ stdin ]:9: Expected a printf format character
osh31 printf eE fF gG

stdout:
stderr: 
  [%e]\n
    ^
[ printf arg at line 1 of [ stdin ] ]:1

  printf '[%e]\n' 3.14
         ^
[ stdin ]:1: osh printf doesn't support floating point
  [%E]\n
    ^
[ printf arg at line 2 of [ stdin ] ]:1

  printf '[%E]\n' 3.14
         ^
[ stdin ]:2: osh printf doesn't support floating point
  [%f]\n
    ^
[ printf arg at line 3 of [ stdin ] ]:1

  printf '[%f]\n' 3.14
         ^
[ stdin ]:3: osh printf doesn't support floating point
  [%g]\n
    ^
[ printf arg at line 4 of [ stdin ] ]:1

  printf '[%g]\n' 3.14
         ^
[ stdin ]:4: osh printf doesn't support floating point
  [%G]\n
    ^
[ printf arg at line 5 of [ stdin ] ]:1

  printf '[%G]\n' 3.14
         ^
[ stdin ]:5: osh printf doesn't support floating point
dash32 printf backslash escapes

stdout:
['a\tb']
['\\xE2\\x98\\xA0']
['$e']
['\x1f7']
stderr:
dash34 printf unicode backslash escapes

stdout:
['\\u2620']
['\\U0000065f']
stderr:
ash34 printf unicode backslash escapes

stdout:
['\\u2620']
['\\U0000065f']
stderr:
dash38 printf %c unicode - prints the first BYTE of a string - it does not respect UTF-8

stdout:
stderr: 
ash38 printf %c unicode - prints the first BYTE of a string - it does not respect UTF-8

stdout:
stderr: 
dash39 printf invalid format

stdout:
status=2
status=2
stderr:
dash: 1: printf: %z: invalid directive
dash: 3: printf: %-z: invalid directive
osh39 printf invalid format

stdout:
status=2
status=2
stderr:
  %z
   ^
[ printf arg at line 1 of [ stdin ] ]:1

  printf '%z' 42
         ^
[ stdin ]:1: Invalid printf format character
  %-z
    ^
[ printf arg at line 3 of [ stdin ] ]:1

  printf '%-z' 42
         ^
[ stdin ]:3: Invalid printf format character
dash40 printf %q

stdout:
[
stderr:
dash: 2: printf: %q: invalid directive
bash40 printf %q

stdout:
[a\ b]
stderr:
zsh40 printf %q

stdout:
[a\ b]
stderr:
ash40 printf %q

stdout:
[
stderr:
ash: %q]\n: invalid format
dash41 printf %6q (width)

stdout:
[[
stderr:
dash: 2: printf: %6q: invalid directive
dash: 3: printf: %1q: invalid directive
bash41 printf %6q (width)

stdout:
[  a\ b]
[a\ b]
stderr:
mksh41 printf %6q (width)

stdout:
[[
stderr:
printf: %6q: invalid conversion specification
printf: %1q: invalid conversion specification
zsh41 printf %6q (width)

stdout:
[  a\ b]
[a\ b]
stderr:
ash41 printf %6q (width)

stdout:
[[
stderr:
ash: %6q]\n: invalid format
ash: %1q]\n: invalid format
zsh42 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=1
stderr:
zsh: bad math expression: operator expected at `z'
zsh: bad math expression: operator expected at `z'
ash42 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=1
stderr:
ash: invalid number '-42 '
ash: invalid number '-42 '
ash: invalid number '-42z'
ash: invalid number '-42z'
osh42 printf negative numbers

[osh stdout] Expected '[-42] status=0\n[-42] status=0\n[-42] status=0\n[-42] status=0\n[-42] status=0\n[-42] status=0\nstatus=1\nstatus=1\n' Got '[-42] status=0\n[-42] status=0\n[-42] status=0\n[-42] status=0\nstatus=1\nstatus=1\nstatus=1\nstatus=1\n'

stdout:
[-42] status=0
[-42] status=0
[-42] status=0
[-42] status=0
status=1
status=1
status=1
status=1
stderr:
  printf '[%d] ' ' -42 '
                 ^
[ stdin ]:11: printf expected an integer, got ' -42 '
  printf '[%i] ' ' -42 '
                 ^
[ stdin ]:13: printf expected an integer, got ' -42 '
  printf '[%d] ' ' -42z'
                 ^
[ stdin ]:16: printf expected an integer, got ' -42z'
  printf '[%i] ' ' -42z'
                 ^
[ stdin ]:18: printf expected an integer, got ' -42z'
osh43 printf + and space flags

stdout:
stderr: 
  [%+d]\n
    ^
[ printf arg at line 1 of [ stdin ] ]:1

  printf '[%+d]\n' 42
         ^
[ stdin ]:1: osh printf doesn't support the '+' flag
  [%+d]\n
    ^
[ printf arg at line 2 of [ stdin ] ]:1

  printf '[%+d]\n' -42
         ^
[ stdin ]:2: osh printf doesn't support the '+' flag
  [% d]\n
    ^
[ printf arg at line 3 of [ stdin ] ]:1

  printf '[% d]\n' 42
         ^
[ stdin ]:3: osh printf doesn't support the ' ' flag
  [% d]\n
    ^
[ printf arg at line 4 of [ stdin ] ]:1

  printf '[% d]\n' -42
         ^
[ stdin ]:4: osh printf doesn't support the ' ' flag
osh44 printf # flag

stdout:
---
stderr:
  [%#o][%#o]\n
    ^
[ printf arg 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 arg 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 arg 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 arg 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 arg at line 6 of [ stdin ] ]:1

  printf '[%g][%#g]\n' 3 3
         ^
[ stdin ]:6: osh printf doesn't support floating point
zsh45 Runtime error for invalid integer

stdout:
0
status=1
0
status=0
stderr:
zsh: bad math expression: operator expected at `abc'
ash45 Runtime error for invalid integer

stdout:
0
status=1
0
status=1
stderr:
ash: invalid number '3abc'
ash: invalid number 'xyz'
osh45 Runtime error for invalid integer

stdout:
status=1
status=1
stderr:
  printf '%d\n' $x
                ^~
[ stdin ]:2: printf expected an integer, got '3abc'
  printf '%d\n' xyz
                ^~~
[ stdin ]:4: printf expected an integer, got 'xyz'
dash46 %(strftime format)T

stdout:
status=2
stderr:
dash: 2: printf: %(: invalid directive
dash: 4: printf: %(: invalid directive
mksh46 %(strftime format)T

stdout:
status=1
stderr:
printf: %(: invalid conversion specification
printf: %(: invalid conversion specification
zsh46 %(strftime format)T

stdout:
status=1
stderr:
printf: %(: invalid directive
printf: %(: invalid directive
ash46 %(strftime format)T

stdout:
status=1
stderr:
ash: %(%Y-%m-%d)T\n: invalid format
ash: %(%Y-%m-%d)T\n: invalid format
dash47 %(strftime format)T doesn't respect TZ if not exported

stdout:
stderr: 
dash: 2: printf: %(: invalid directive
dash: 5: printf: %(: invalid directive
mksh47 %(strftime format)T doesn't respect TZ if not exported

stdout:
stderr: 
printf: %(: invalid conversion specification
printf: %(: invalid conversion specification
zsh47 %(strftime format)T doesn't respect TZ if not exported

stdout:
stderr: 
printf: %(: invalid directive
printf: %(: invalid directive
ash47 %(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
dash48 %(strftime format)T TZ in environ but not in shell's memory

stdout:
stderr: 
dash: 2: printf: %(: invalid directive
dash: 6: printf: %(: invalid directive
mksh48 %(strftime format)T TZ in environ but not in shell's memory

stdout:
stderr: 
printf: %(: invalid conversion specification
printf: %(: invalid conversion specification
zsh48 %(strftime format)T TZ in environ but not in shell's memory

stdout:
stderr: 
printf: %(: invalid directive
printf: %(: invalid directive
ash48 %(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
dash49 %10.5(strftime format)T

stdout:
[[status=2
stderr:
dash: 2: printf: %10.5(: invalid directive
dash: 4: printf: %10.5(: invalid directive
mksh49 %10.5(strftime format)T

stdout:
[[status=1
stderr:
printf: %10.5(: invalid conversion specification
printf: %10.5(: invalid conversion specification
zsh49 %10.5(strftime format)T

stdout:
[[status=1
stderr:
printf: %10.5(: invalid directive
printf: %10.5(: invalid directive
ash49 %10.5(strftime format)T

stdout:
[[status=1
stderr:
ash: %10.5(%Y-%m-%d)T]\n: invalid format
ash: %10.5(%Y-%m-%d)T]\n: invalid format
dash51 bash truncates long strftime string at 128

stdout:
stderr: 
mksh51 bash truncates long strftime string at 128

stdout:
stderr: 
zsh51 bash truncates long strftime string at 128

stdout:
stderr: 
ash51 bash truncates long strftime string at 128

stdout:
stderr: 
osh51 bash truncates long strftime string at 128

stdout:
4
40
120
124
128
stderr:
dash52 printf positive integer overflow

stdout:
18446744073709551615
status=0
18446744073709551615
status=1

9223372036854775807
status=1
9223372036854775807
status=1

stderr:
dash: 4: printf: 18446744073709551616: Numerical result out of range
dash: 2: printf: 18446744073709551615: Numerical result out of range
dash: 4: printf: 18446744073709551616: Numerical result out of range
bash52 printf positive integer overflow

stdout:
18446744073709551615
status=0
18446744073709551615
status=0

9223372036854775807
status=0
9223372036854775807
status=0

stderr:
bash: line 4: printf: warning: 18446744073709551616: Numerical result out of range
bash: line 2: printf: warning: 18446744073709551615: Numerical result out of range
bash: line 4: printf: warning: 18446744073709551616: Numerical result out of range
mksh52 printf positive integer overflow

stdout:
18446744073709551615
status=0
18446744073709551615
status=1

9223372036854775807
status=1
9223372036854775807
status=1

stderr:
printf: ‘18446744073709551616’: Numerical result out of range
printf: ‘18446744073709551615’: Numerical result out of range
printf: ‘18446744073709551616’: Numerical result out of range
zsh52 printf positive integer overflow

stdout:
1844674407370955161
status=0
1844674407370955161
status=0

1844674407370955161
status=0
1844674407370955161
status=0

stderr:
zsh: number truncated after 19 digits: 18446744073709551615
zsh: number truncated after 19 digits: 18446744073709551616
zsh: number truncated after 19 digits: 18446744073709551615
zsh: number truncated after 19 digits: 18446744073709551616
ash52 printf positive integer overflow

stdout:
18446744073709551615
status=0
0
status=1

0
status=1
0
status=1

stderr:
ash: invalid number '18446744073709551616'
ash: invalid number '18446744073709551615'
ash: invalid number '18446744073709551616'
dash53 printf negative integer overflow

stdout:
1
status=0
18446744073709551615
status=1

-9223372036854775808
status=1
-9223372036854775808
status=1

stderr:
dash: 5: printf: -18446744073709551616: Numerical result out of range
dash: 3: printf: -18446744073709551615: Numerical result out of range
dash: 5: printf: -18446744073709551616: Numerical result out of range
bash53 printf negative integer overflow

stdout:
1
status=0
18446744073709551615
status=0

-9223372036854775808
status=0
-9223372036854775808
status=0

stderr:
bash: line 5: printf: warning: -18446744073709551616: Numerical result out of range
bash: line 3: printf: warning: -18446744073709551615: Numerical result out of range
bash: line 5: printf: warning: -18446744073709551616: Numerical result out of range
mksh53 printf negative integer overflow

stdout:
1
status=0
18446744073709551615
status=1

-9223372036854775808
status=1
-9223372036854775808
status=1

stderr:
printf: ‘-18446744073709551616’: Numerical result out of range
printf: ‘-18446744073709551615’: Numerical result out of range
printf: ‘-18446744073709551616’: Numerical result out of range
zsh53 printf negative integer overflow

stdout:
16602069666338596455
status=0
16602069666338596455
status=0

-1844674407370955161
status=0
-1844674407370955161
status=0

stderr:
zsh: number truncated after 19 digits: 18446744073709551615
zsh: number truncated after 19 digits: 18446744073709551616
zsh: number truncated after 19 digits: 18446744073709551615
zsh: number truncated after 19 digits: 18446744073709551616
ash53 printf negative integer overflow

stdout:
0
status=1
0
status=1

0
status=1
0
status=1

stderr:
ash: invalid number '-18446744073709551615'
ash: invalid number '-18446744073709551616'
ash: invalid number '-18446744073709551615'
ash: invalid number '-18446744073709551616'
dash54 printf %b does backslash escaping

stdout:
[\044]
[$]

[\x7e]
[\x7e]

[\A]
[\A]
stderr:
dash55 printf %b unicode escapes

stdout:
[\u03bc]
[\u03bc]
stderr:
ash55 printf %b unicode escapes

stdout:
[\u03bc]
[\u03bc]
stderr:
zsh57 printf %b supports octal escapes, both \141 and \0141

stdout:
three \141
four  a

\1419
a9
stderr:
zsh58 printf %b with truncated octal escapes

stdout:
\558
-8

 5c 37
 07
 07
 07
stderr:
zsh59 printf %d %X support hex 0x5 and octal 055

stdout:
hex
85
55
hex CAPS
85
55
octal 3
55
37
octal 4
55
37
octal 5
55
37
stderr:
zsh60 printf %d with + prefix (positive sign)

stdout:
decimal
42
octal
77
hex lowercase
171
hex uppercase
171
stderr:
zsh61 leading spaces are accepted in value given to %d %X, but not trailing spaces

stdout:
stderr: 
ash61 leading spaces are accepted in value given to %d %X, but not trailing spaces

stdout:
-123
status=0
0
status=1
---
63
status=0
255
status=0
FF
status=0
ff
status=0
stderr:
ash: invalid number '-123 '
osh61 leading spaces are accepted in value given to %d %X, but not trailing spaces

stdout:
-123
status=0
status=1
---
63
status=0
255
status=0
FF
status=0
ff
status=0
stderr:
  printf '%d\n' ' -123 '
                ^
[ stdin ]:5: printf expected an integer, got ' -123 '
dash62 Arbitrary base 64#a is rejected (unlike in shell arithmetic)

stdout:
64
status=1
stderr:
dash: 1: printf: 64#a: not completely converted
bash62 Arbitrary base 64#a is rejected (unlike in shell arithmetic)

stdout:
64
status=1
stderr:
bash: line 1: printf: 64#a: invalid number
mksh62 Arbitrary base 64#a is rejected (unlike in shell arithmetic)

stdout:
64
status=1
stderr:
printf: ‘64#a’: value not completely converted
zsh62 Arbitrary base 64#a is rejected (unlike in shell arithmetic)

stdout:
0
status=1
stderr:
zsh: invalid base (must be 2 to 36 inclusive): 64
ash62 Arbitrary base 64#a is rejected (unlike in shell arithmetic)

stdout:
0
status=1
stderr:
ash: invalid number '64#a'