[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: bug#9129: Built-in printf Sits Awkwardly with UDP.
From: |
Ralph Corderoy |
Subject: |
Re: bug#9129: Built-in printf Sits Awkwardly with UDP. |
Date: |
Fri, 22 Jul 2011 17:32:12 +0100 |
Hi Jim,
> > On 07/20/2011 07:34 AM, Ralph Corderoy wrote:
> > > BTW, the code for the built-in printf has a bug. For negative
> > > field-widths it negates a negative integer without checking it
> > > will fit. E.g. on this 64-bit machine
> > >
> > > $ printf '%-9223372036854775808s.\n' foo
> > > foo.
> > > $
> >
> > Coreutils' printf shares this misfortune. Sadly, it might even be a
> > bug in the underlying glibc printf(), although I haven't tried to
> > write a test program to check that, yet.
>
> This is not about a negative field width.
Just to ensure there's no confusion, as far as bash's built-in printf is
concerned one aspect of it is about a negative field width since
$ printf '.%*q.\n' -10 foo
.foo .
is implemented by converting the "-10" into a number, spotting it's
negative, setting the left-justified flag, and then negating the number.
Coreutils' printf doesn't have that particular issue since it passes the
negative number to the C library as a negative and has it deal with the
justification change. For %b, which libc doesn't support, coreutils
says
/* FIXME: Field width and precision are not supported
for %b, even though POSIX requires it. */
so there's no code to go wrong. :-)
Cheers, Ralph.
- Re: Built-in printf Sits Awkwardly with UDP., (continued)
- Re: Built-in printf Sits Awkwardly with UDP., Ralph Corderoy, 2011/07/19
- Re: Built-in printf Sits Awkwardly with UDP., Bob Proulx, 2011/07/19
- Re: Built-in printf Sits Awkwardly with UDP., Ralph Corderoy, 2011/07/20
- Re: Built-in printf Sits Awkwardly with UDP., Eric Blake, 2011/07/20
- Re: Built-in printf Sits Awkwardly with UDP., Ralph Corderoy, 2011/07/20
- Message not available
- Re: Built-in printf Sits Awkwardly with UDP., Ralph Corderoy, 2011/07/22
- Re: Built-in printf Sits Awkwardly with UDP., Chet Ramey, 2011/07/24
- Re: Built-in printf Sits Awkwardly with UDP., Ralph Corderoy, 2011/07/25
- Re: Built-in printf Sits Awkwardly with UDP., Chet Ramey, 2011/07/25
- Re: bug#9129: Built-in printf Sits Awkwardly with UDP., Jim Meyering, 2011/07/22
- Re: bug#9129: Built-in printf Sits Awkwardly with UDP.,
Ralph Corderoy <=
- Re: bug#9129: Built-in printf Sits Awkwardly with UDP., Chet Ramey, 2011/07/24
- Re: Built-in printf Sits Awkwardly with UDP., Andre Majorel, 2011/07/21
- Re: Built-in printf Sits Awkwardly with UDP., Ben Pfaff, 2011/07/21
- Message not available
- Re: Built-in printf Sits Awkwardly with UDP., Ralph Corderoy, 2011/07/22