[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#7325: new test failure due to non-portability of printf formats like
From: |
Eric Blake |
Subject: |
bug#7325: new test failure due to non-portability of printf formats like %05.3s |
Date: |
Wed, 03 Nov 2010 13:27:45 -0600 |
User-agent: |
Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.12) Gecko/20101027 Fedora/3.1.6-1.fc14 Mnenhy/0.8.3 Thunderbird/3.1.6 |
On 11/03/2010 12:59 PM, Jim Meyering wrote:
> Note that coreutils' printf does not accept the '0' modifier in a %s format.
>
> $ env printf '%05.3s\n' 23
> printf: %05.3s: invalid conversion specification
>
> That's because POSIX says the "0" modifier applies only to the
> d, i, o, u, x, X, a, A, e, E, f, F, g, and G conversion specifiers.
>
> One solution is to trim off the "0".
> It's probably a good idea regardless, in case some implementation rejects it.
>
> On the other hand, I find the zero-padding you currently get
> with stat on solaris to be slightly more intuitive.
I agree that %05.3:X resulting in 00023 would be ideal. And I agree
that we'd have to trim off the 0 modifier before calling the underlying
printf %s, and thus be responsible for putting in '0' padding ourselves
rather than relying on printf() padding.
--
Eric Blake address@hidden +1-801-349-2682
Libvirt virtualization library http://libvirt.org
signature.asc
Description: OpenPGP digital signature
- bug#7325: new test failure due to non-portability of printf formats like %05.3s, Jim Meyering, 2010/11/03
- bug#7325: new test failure due to non-portability of printf formats like %05.3s,
Eric Blake <=
- bug#7325: new test failure due to non-portability of printf formats like %05.3s, Jim Meyering, 2010/11/03
- bug#7325: new test failure due to non-portability of printf formats like %05.3s, Eric Blake, 2010/11/03
- bug#7325: new test failure due to non-portability of printf formats like %05.3s, Paul Eggert, 2010/11/03
- bug#7325: new test failure due to non-portability of printf formats like %05.3s, Jim Meyering, 2010/11/04
- bug#7325: new test failure due to non-portability of printf formats like %05.3s, Jim Meyering, 2010/11/04
- bug#7325: new test failure due to non-portability of printf formats like %05.3s, Paul Eggert, 2010/11/04
- bug#7325: new test failure due to non-portability of printf formats like %05.3s, Jim Meyering, 2010/11/04
- bug#7325: new test failure due to non-portability of printf formats like %05.3s, Jim Meyering, 2010/11/05
- bug#7325: new test failure due to non-portability of printf formats like %05.3s, Paul Eggert, 2010/11/05
- bug#7325: new test failure due to non-portability of printf formats like %05.3s, Pádraig Brady, 2010/11/04