bug-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [bug #67624] echo: write error: Invalid argument


From: Greg Wooledge
Subject: Re: [bug #67624] echo: write error: Invalid argument
Date: Tue, 28 Oct 2025 07:20:34 -0400
User-agent: Mutt/1.10.1 (2018-07-13)

On Tue, Oct 28, 2025 at 10:00:00 +0100, Andreas Schwab wrote:
> On Okt 28 2025, Martin D Kealey wrote:
> 
> > laas:~# cat t.sh
> > #!/bin/bash
> > echo 60 > /proc/sys/kernel/panic
> > laas:~# strace -f t.sh
> > ...
> > writev(1, [{"60", 2}, {"\n", 1}], 2) = 2
> > writev(1, [{"", 0}, {"\n", 1}], 2) = -1 EINVAL (Invalid argument)
> 
> Where is the second writev coming from?  "echo 60" should output
> $'60\n', and nothing else.

writev() is supposed to return the number of bytes written.  Bash
tried to write 3 bytes, but the return value was 2.  I guess it
concludes that the newline got lost in transit, and tries to write
it again.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]