Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: possible glibc bug with buffers [was Re: 4.3.4-dev-6]



On Monday 07 January 2008, Clint Adams wrote:
> 
> On Thu, Jan 03, 2008 at 05:08:24PM +0000, Peter Stephenson wrote:
> > I'm not getting that last "foo"; could there be a race somewhere, or a
> > non-standard configuration option set that's doing something odd with
> > file descriptors, or something nasty in the compilation tree?
> 
> My current understanding of the situation is as follows:
> bash, ksh, and zsh behave normally under glibc 2.3
> 
> under glibc 2.7, ksh behaves normally
> 
> bash does this
> $ echo one >/dev/full
> bash: echo: write error: No space left on device
> $ echo two
> one
> two
> 
> and zsh does this
> % echo one >/dev/full
> echo: write error: no space left on device
> one
> % echo two
> two
> 
> I can't reproduce this with a simple fprintf-ing to /dev/full.
> 
> 
> 
> 

this is being discussed right now on linux-hotplug as well; there is also Debian 
bug report on it.
--- Begin Message ---
On Thu, 2008-01-03 at 17:17 -0700, Andrew Patterson wrote:
> On Fri, 2008-01-04 at 09:07 +0900, Tejun Heo wrote:
> > Hello,
> > 
> > Andrew Patterson wrote:
> > > It looks like this is a shell issue.  After looking through the sysfs
> > > code, I realized that this problem seems to be driven from user-land.
> > > So I performed some experiments:
> > > 
> > >      1. Wrote a simple program that just used write(2) to write to the
> > >         sysfs entry. This works fine.
> > >      2. Used /bin/echo instead of the built-in echo command.  This too
> > >         works fine.
> > >      3. Tried several shells.  Zsh and Bash both fail.  Csh works fine.
> > > 
> > > I then ran strace on the following shell-script:
> > > 
> > > #!/bin/bash
> > > 
> > > echo x > allow_restart
> > > echo y > allow_restart
> > > echo z > allow_restart
> > > 
> > > and got:
> > > 
> > > # strace -e trace=write ~/tmp/tester.sh 
> > > write(1, "x\n", 2)                      = -1 EINVAL (Invalid argument)
> > > write(1, "x\n", 2)                      = -1 EINVAL (Invalid argument)
> > > write(2, "/home/andrew/tmp/tester.sh: line"..., 72/home/andrew/tmp/tester.sh: line 4: echo: write error: Invalid argument
> > > ) = 72
> > > write(1, "x\ny\n", 4)                   = -1 EINVAL (Invalid argument)
> > > write(1, "x\ny\n", 4)                   = -1 EINVAL (Invalid argument)
> > > write(2, "/home/andrew/tmp/tester.sh: line"..., 72/home/andrew/tmp/tester.sh: line 5: echo: write error: Invalid argument
> > > ) = 72
> > > write(1, "x\ny\nz\n", 6)                = -1 EINVAL (Invalid argument)
> > > write(1, "x\ny\nz\n", 6)                = -1 EINVAL (Invalid argument)
> > > write(2, "/home/andrew/tmp/tester.sh: line"..., 72/home/andrew/tmp/tester.sh: line 6: echo: write error: Invalid argument
> > > ) = 72
> > > write(1, "x\ny\nz\n", 6x
> > > y
> > > z
> > > )                = 6
> > > Process 3800 detached
> > 
> > Eeeeeeeekkkk.... That's scary.  Which distro are you using and what does
> > 'bash --version' say?
> 
> IA64 Debian lenny.  
> 
> # bash --version
> GNU bash, version 3.1.17(1)-release (ia64-unknown-linux-gnu)
> 
> # zsh --version 
> zsh 4.3.4 (ia64-unknown-linux-gnu)
> 
> # csh --version
> tcsh 6.14.00 (Astron) 2005-03-25 (ia64-unknown-linux) options
> wide,nls,dl,al,kan,rh,nd,color,filec
> 
> I suppose I should try this an ia32 box again, and perhaps with some
> other distros.  I am not sure what the kernel can do about this, but it
> might be nice to report it to the shell maintainers.
> 

This looks like it might be the culprit. 

http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=459643

The fact that it works on SLES10 lends further evidence to glibc being
the problem.

-- 
Andrew Patterson
Hewlett-Packard Company

-
To unsubscribe from this list: send the line "unsubscribe linux-hotplug" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


--- End Message ---

Attachment: signature.asc
Description: This is a digitally signed message part.



Messages sorted by: Reverse Date, Date, Thread, Author