Results for builtin-printf.test.sh

statusdashbashmkshzshashosh
pass 324932333036
ok 123527
N-I 1701511177
BUG 101220
FAIL 000001
total515151515151
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 pass pass ok ok empty string (osh is more strict)
detailsdetails
23pass pass ok pass pass pass No char after ' (osh is more strict)
details
24BUG pass BUG pass BUG FAIL Unicode char with ' (osh is more strict)
detailsdetailsdetailsdetails
25pass pass pass pass pass N-I negative numbers with unsigned / octal / hex
details
26pass pass pass pass pass N-I printf floating point (not required, but they all implement it)
details
27pass pass pass pass pass N-I printf floating point with - and 0
details
28pass pass pass pass pass N-I printf eE fF gG
details
29N-I pass pass pass pass pass printf backslash escapes
details
30pass pass pass pass pass pass printf octal backslash escapes
31N-I pass pass pass N-I pass printf unicode backslash escapes
detailsdetails
32pass pass pass pass pass pass printf invalid backslash escape (is ignored)
33pass pass pass pass pass pass printf % escapes
34pass pass pass pass pass pass printf %b backslash escaping
35pass pass pass pass pass pass printf %b with \c early return
36N-I pass pass pass N-I N-I printf %c -- doesn't respect UTF-8! Bad.
detailsdetailsdetails
37ok pass pass pass pass ok printf invalid format
detailsdetails
38N-I ok pass ok N-I pass printf %q
detailsdetailsdetailsdetails
39N-I ok N-I ok N-I pass printf %6q (width)
detailsdetailsdetailsdetailsdetails
40pass pass pass ok ok ok printf negative numbers
detailsdetailsdetails
41pass pass pass pass pass N-I printf + and space flags
details
42pass pass pass pass pass N-I printf # flag
details
43pass pass pass BUG BUG ok Runtime error for invalid integer
detailsdetailsdetails
44N-I pass N-I N-I N-I pass %(strftime format)T
detailsdetailsdetailsdetails
45N-I pass N-I N-I N-I pass %(strftime format)T doesn't respect TZ if not exported
detailsdetailsdetailsdetails
46N-I pass N-I N-I N-I pass %(strftime format)T TZ in environ but not in shell's memory
detailsdetailsdetailsdetails
47N-I pass N-I N-I N-I pass %10.5(strftime format)T
detailsdetailsdetailsdetails
48pass pass pass pass pass pass Regression for 'printf x y'
49N-I pass N-I N-I N-I ok bash truncates long strftime string at 128
detailsdetailsdetailsdetailsdetails
50N-I pass pass ok N-I pass printf with explicit NUL byte
detailsdetailsdetails
212 passed, 20 OK, 67 not implemented, 6 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:
ash22 empty string (osh is more strict)

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

stdout:
stderr: 
  printf '%d\n' ''
                ^
[ stdin ]:1: printf expected an integer, got ''
mksh23 No char after ' (osh is more strict)

stdout:
0
0
stderr:
printf: ‘'’: expected a numeric value
printf: ‘"’: expected a numeric value
dash24 Unicode char with ' (osh is more strict)

stdout:
ce
stderr:
mksh24 Unicode char with ' (osh is more strict)

stdout:
ce
stderr:
'printf: warning: \xbc: character(s) following character constant have been ignored\n'
ash24 Unicode char with ' (osh is more strict)

stdout:
ce
stderr:
osh24 Unicode char with ' (osh is more strict)

[osh stdout] Expected '3bc\n', got 'ce\n'

stdout:
ce
stderr:
osh25 negative numbers with unsigned / octal / hex

stdout:
stderr: 
  [%u]\n
    ^
[ printf word at line 1 of [ stdin ] ]:1: fatal: Can't format negative number -42 with %u
osh26 printf floating point (not required, but they all implement it)

stdout:
stderr: 
  [%f]\n
    ^
[ printf word at line 1 of [ stdin ] ]:1: osh printf doesn't support floating point
  [%.2f]\n
      ^
[ printf word at line 2 of [ stdin ] ]:1: osh printf doesn't support floating point
  [%8.2f]\n
       ^
[ printf word at line 3 of [ stdin ] ]:1: osh printf doesn't support floating point
  [%-8.2f]\n
        ^
[ printf word at line 4 of [ stdin ] ]:1: osh printf doesn't support floating point
  [%-f]\n
     ^
[ printf word at line 5 of [ stdin ] ]:1: osh printf doesn't support floating point
  [%-f]\n
     ^
[ printf word at line 6 of [ stdin ] ]:1: osh printf doesn't support floating point
osh27 printf floating point with - and 0

stdout:
---
stderr:
  [%8.4f]\n
       ^
[ printf word at line 1 of [ stdin ] ]:1: osh printf doesn't support floating point
  [%08.4f]\n
        ^
[ printf word at line 2 of [ stdin ] ]:1: osh printf doesn't support floating point
  [%8.04f]\n
       ^
[ printf word at line 3 of [ stdin ] ]:1: Expected a printf format character
  [%08.04f]\n
        ^
[ printf word at line 4 of [ stdin ] ]:1: Expected a printf format character
  [%-8.4f]\n
        ^
[ printf word at line 6 of [ stdin ] ]:1: osh printf doesn't support floating point
  [%-08.4f]\n
         ^
[ printf word at line 7 of [ stdin ] ]:1: osh printf doesn't support floating point
  [%-8.04f]\n
        ^
[ printf word at line 8 of [ stdin ] ]:1: Expected a printf format character
  [%-08.04f]\n
         ^
[ printf word at line 9 of [ stdin ] ]:1: Expected a printf format character
osh28 printf eE fF gG

stdout:
stderr: 
  [%e]\n
    ^
[ printf word at line 1 of [ stdin ] ]:1: osh printf doesn't support floating point
  [%E]\n
    ^
[ printf word at line 2 of [ stdin ] ]:1: osh printf doesn't support floating point
  [%f]\n
    ^
[ printf word at line 3 of [ stdin ] ]:1: osh printf doesn't support floating point
  [%g]\n
    ^
[ printf word at line 4 of [ stdin ] ]:1: osh printf doesn't support floating point
  [%G]\n
    ^
[ printf word at line 5 of [ stdin ] ]:1: osh printf doesn't support floating point
dash29 printf backslash escapes

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

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

stdout:
['\\u2620']
['\\U0000065f']
stderr:
dash36 printf %c -- doesn't respect UTF-8! Bad.

stdout:
[$\u03bc\u03bc]
1
stderr:
ash36 printf %c -- doesn't respect UTF-8! Bad.

stdout:
[\u03bc\u03bc]
1
stderr:
osh36 printf %c -- doesn't respect UTF-8! Bad.

stdout:
[μμ]
0
stderr:
  %c
   ^
[ printf word at line 3 of [ stdin ] ]:1: osh printf doesn't support single characters (bytes)
dash37 printf invalid format

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

stdout:
status=2
status=2
stderr:
  %z
   ^
[ printf word at line 1 of [ stdin ] ]:1: Invalid printf format character
  %-z
    ^
[ printf word at line 3 of [ stdin ] ]:1: Invalid printf format character
dash38 printf %q

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

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

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

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

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

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

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

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

stdout:
[[
stderr:
ash: %6q]\n: invalid format
ash: %1q]\n: invalid format
zsh40 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'
ash40 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'
osh40 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=1
stderr:
  printf '[%d] ' ' -42z'
                 ^
[ stdin ]:16: printf expected an integer, got ' -42z'
  printf '[%i] ' ' -42z'
                 ^
[ stdin ]:18: printf expected an integer, got ' -42z'
osh41 printf + and space flags

stdout:
stderr: 
  [%+d]\n
    ^
[ printf word at line 1 of [ stdin ] ]:1: osh printf doesn't support the '+' flag
  [%+d]\n
    ^
[ printf word at line 2 of [ stdin ] ]:1: osh printf doesn't support the '+' flag
  [% d]\n
    ^
[ printf word at line 3 of [ stdin ] ]:1: osh printf doesn't support the ' ' flag
  [% d]\n
    ^
[ printf word at line 4 of [ stdin ] ]:1: osh printf doesn't support the ' ' flag
osh42 printf # flag

stdout:
---
stderr:
  [%#o][%#o]\n
    ^
[ printf word at line 1 of [ stdin ] ]:1: osh printf doesn't support the '#' flag
  [%#x][%#x]\n
    ^
[ printf word at line 2 of [ stdin ] ]:1: osh printf doesn't support the '#' flag
  [%#X][%#X]\n
    ^
[ printf word at line 3 of [ stdin ] ]:1: osh printf doesn't support the '#' flag
  [%.0f][%#.0f]\n
      ^
[ printf word at line 5 of [ stdin ] ]:1: osh printf doesn't support floating point
  [%g][%#g]\n
    ^
[ printf word at line 6 of [ stdin ] ]:1: osh printf doesn't support floating point
zsh43 Runtime error for invalid integer

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

stdout:
0
status=1
0
status=1
stderr:
ash: invalid number '3abc'
ash: invalid number 'xyz'
osh43 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'
dash44 %(strftime format)T

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

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

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

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

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

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

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

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

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

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

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

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

stdout:
[[status=1
stderr:
printf: %10.5(: invalid directive
printf: %10.5(: invalid directive
ash47 %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
dash49 bash truncates long strftime string at 128

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

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

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

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

stdout:
4
40
120
124
128
stderr:
dash50 printf with explicit NUL byte

stdout:
stderr: 
zsh50 printf with explicit NUL byte

stdout:
xzz
stderr:
ash50 printf with explicit NUL byte

stdout:
stderr: