[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
Challenge: diff in results with /usr/bin/printf and /bin/sh builtin printf
I am in the process of creating ATF tests for printf (which is
why the activity in the sources recently...)
The tests will test both /usr/bin/printf and the shell's builtin
printf. (Actually, any shell's builtin printf, and any external
printf command, but that is not important here).
At first I wondered if I was wasting my time doing both, as for
those of you who don't know, the builtin printf in /bin/sh (and
for that matter in /bin/csh ... /bin/ksh does not have one) uses
the same sources that build /usr/bin/printf. Hence they ought
to be identical.
But it turns out they're not (the /bin/sh one, and /usr/bin/printf,
csh's version seems to be the same as the /usr/bin version.)
So, my challenge is, for anyone who cares, to show what the
difference is - please don't guess, run them as
sh -c 'printf xxx yyy zzz'
/usr/bin/printf xxx yyy zzz
for the same args xxx yyy zzz (however many args you need)
and demonstrate the different output.
Any relatively recent sh and printf should be OK for finding the
difference I know about ... just as long as they are from the same
system build -- testing a printf compiled on NetBSD 7 against a
/bin/sh from HEAD is not useful! Even from different builds of
HEAD won't help ... they need to come from the same identical
printf sources. It should not matter if you're using a binary
system installation, or one you compiled yourself. But do not
test the sh (or printf if it is there) from installation media (the ones
provided just to get NetBSD installed.)
What I am kind of hoping for here is that some of you will find other
differences, apart from the one that I know already, that I can then
add to the ATF tests (or fix, as appropriate).
Obviously, this needs to happen before the ATF tests for printf
get committed, or you will be able to just go look in there and
see the one I discovered already. That kind of limits your time
for looking to the next couple of days (the tests are still being
ps: these tests, unusually for ATF tests, are designed to run both
under ATF, and as standalone scripts (outside ATF). Further they
have already discovered an acknowledged bug in the builtin
printf in bash.
Main Index |
Thread Index |