[Bug 113] New: printf format handling incorrect when asterisk(*) follows format specifier

bugzilla at busybox.net bugzilla at busybox.net
Wed Feb 18 16:26:39 UTC 2009


              Host: all
            Target: all
             Build: all versions >= 1.12.0
           Summary: printf format handling incorrect when asterisk(*)
                    follows format specifier
           Product: Busybox
           Version: 1.12.x
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: minor
          Priority: P3
         Component: Other
        AssignedTo: unassigned at busybox.net
        ReportedBy: ssh at sgi.com
                CC: busybox-cvs at busybox.net
   Estimated Hours: 0.0

Created an attachment (id=69)
 --> (https://bugs.busybox.net/attachment.cgi?id=69)
Patch to fix printf asterisk bug

Starting with version 1.12.0, printf incorrectly handles formatting incorrectly
when an asterisk follows any format specifier in the format string.  Here is a
simple example:

For any version *before* 1.12.0:

# printf "** %s **\n" "testing"
** testing **

But, for any version 1.12.0 or later:

# printf "** %s **\n" "testing"
** (null) **

The problem is caused by the new have_prec and have_width tests in
print_direc().  These are done *before* the format string is temporarily
truncated, so the have_width test detects any following asterisk characters.   
Simply doing the temporary truncate of the format string before the tests fixes
the problem.    The attached patch resolves the problem, and applies cleanly to
all versions 1.12.0 through 1.13.3   (haven't tried any other versions).

Configure bugmail: https://bugs.busybox.net/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.

More information about the busybox-cvs mailing list