-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

[adding bug-gnulib, since this affects more than just coreutils]

According to Peter Fales on 2/4/2008 4:00 PM:
| 2) I can see what's happening, though I'm not quite sure how it's supposed
|    to work.   When the gnulib vsnprintf("%*s",-3,"x") is called, it
|    ends up eventually calling the the system snprintf through the
SNPRINTF_BUF
|    macro as  snprint(result+length, maxlen, "%-*s%n", -3, "x", &count);
|
|    It looks like the system snprintf is buggy.  I suspect the '-' character
|    in the format specification is negating the value of the -3 argument.

Indeed, that seems like the bug.  Bruno, it looks like we need to add
another test to the printf replacement suite.

|
|    On the system in question, this test program
|
|       main()
|       {
|               int count;
|       
|               printf("1 %*s%n\n",-3,"x",&count);
|               printf("1 %-*s%n\n",-3,"x",&count);
|               printf("1 %-*s%n\n",3,"x",&count);
|       }
|
|     prints
|
|       1 x
|       1   x
|       1 x

And that violates C99/POSIX.  Duplication of the `-' flag should not
disable it.

- --
Don't work too hard, make some time for fun as well!

Eric Blake             [EMAIL PROTECTED]
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.5 (Cygwin)
Comment: Public key at home.comcast.net/~ericblake/eblake.gpg
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFHp+KQ84KuGfSFAYARAs1KAKCq2sTdm5WWGRg7RIs9afvptrSTOgCfX2Xz
UpKtEpi1VIpDkWPe+kGyiBY=
=9CNT
-----END PGP SIGNATURE-----


Reply via email to