Bug 207

Summary: weird behavior with hush, printf, and empty args
Product: Busybox Reporter: Mike Frysinger <vapier>
Component: Standard ComplianceAssignee: unassigned
Status: RESOLVED FIXED    
Severity: enhancement CC: busybox-cvs
Priority: P5    
Version: unspecified   
Target Milestone: ---   
Hardware: PC   
OS: Linux   
Host: Target:
Build:

Description Mike Frysinger 2009-03-20 10:42:11 UTC
i cant explain this one ...

$ cat test.sh
printf '%s\n' "$@"
$ ./busybox hush ./test.sh
n$

looks like when printf %s gets "" it incorrectly consumes an extra byte ?

bash works fine:
$ sh ./test.sh

$
Comment 1 Denys Vlasenko 2009-03-20 10:52:10 UTC
It just converts "\n" to "n". strace:

execve("/root/bin/printf", ["printf", "%sn"], [/* 30 vars */])...

Looking into it...
Comment 2 Mike Frysinger 2009-03-20 11:12:57 UTC
i say "weird" because it works fine with arguments:
$ ./busybox hush ./test.sh 1
1
$
Comment 3 Denys Vlasenko 2009-03-20 11:33:53 UTC
I updated hush hot fix, please try it:

http://busybox.net/downloads/fixes-1.13.3/busybox-1.13.3-hush.patch
Comment 4 Mike Frysinger 2009-03-20 12:37:00 UTC
yep, thanks