Bug#595063: read() builtin doesn't read integer value /proc files (but bash's does)

2010-11-28 Thread Herbert Xu
On Sat, Sep 04, 2010 at 07:35:04PM +, Jilles Tjoelker wrote: > > > I attached an updated patch that corrects this pb by discarding the > > buffer when opening a new file. > > This discarding is still bad as it throws away valid data if the open > file description is shared. This happens if st

Bug#595063: read() builtin doesn't read integer value /proc files (but bash's does)

2010-09-04 Thread Jilles Tjoelker
On Sat, Sep 04, 2010 at 08:20:33PM +0200, Steve Schnepp wrote: > 2010/9/3 Jilles Tjoelker : > > This patch assumes that the file descriptor is discarded afterwards (its > > position does not matter). Therefore the very common construct > >  while read x; do > >    ... > >  done > > stops working.

Bug#595063: read() builtin doesn't read integer value /proc files (but bash's does)

2010-09-04 Thread Steve Schnepp
2010/9/3 Jilles Tjoelker : > This patch assumes that the file descriptor is discarded afterwards (its > position does not matter). Therefore the very common construct >  while read x; do >    ... >  done > stops working. Ohh.. thanks for that, I didn't see it. Actually "while read x" continues to

Bug#595063: read() builtin doesn't read integer value /proc files (but bash's does)

2010-09-03 Thread Jilles Tjoelker
On Thu, Sep 02, 2010 at 05:02:55PM +0200, Steve Schnepp wrote: > 2010/9/1 Steve Schnepp : > > conforming to POSIX isn't a realistic option, would it be possible to > > have a workaround that doesn't involve an external tool like cat(1) ? > Hi, I just hacked & attached a little patch away to be abl

Bug#595063: read() builtin doesn't read integer value /proc files (but bash's does)

2010-09-03 Thread Steve Schnepp
2010/9/2 Jilles Tjoelker : Thanks for your prompt reply. > Note that a change in the file between the single-byte reads will cause > an inconsistent value to be read. This is also the case with regular > files on a filesystem, so it is acceptable. Are you implying that: - if the procfs is made t

Bug#595063: read() builtin doesn't read integer value /proc files (but bash's does)

2010-09-02 Thread Jilles Tjoelker
On Wed, Sep 01, 2010 at 10:10:11AM +0200, Steve Schnepp wrote: > Hi, I opened bug 595063 on the debian BTS [1] and I was suggested to > resend the email upstream. > So I copied the body of the bug below : > dash's read() builtin seems to read the underlying file 1 char at a > time. This doesn't w

Bug#595063: read() builtin doesn't read integer value /proc files (but bash's does)

2010-09-02 Thread Steve Schnepp
2010/9/1 Steve Schnepp : > conforming to POSIX isn't a realistic option, would it be possible to > have a workaround that doesn't involve an external tool like cat(1) ? Hi, I just hacked & attached a little patch away to be able to solve this case. Feel free to reply with your comments. NB: I jus

Bug#595063: read() builtin doesn't read integer value /proc files (but bash's does)

2010-09-01 Thread Steve Schnepp
Hi, I opened bug 595063 on the debian BTS [1] and I was suggested to resend the email upstream. So I copied the body of the bug below : dash's read() builtin seems to read the underlying file 1 char at a time. This doesn't work with some files under /proc, since procfs isn't fully POSIX compliant

Bug#595063: read() builtin doesn't read integer value /proc files but bash's does

2010-09-01 Thread Steve Schnepp
Hi, I opened bug 595063 on the debian BTS [1] and I was suggested to resend the email upstream. So I copied the body of the bug below : dash's read() builtin seems to read the underlying file 1 char at a time. This doesn't work with some files under /proc, since procfs isn't fully POSIX compliant