Re: broken pipe from func-output by changing network settings?

2017-10-17 Thread L A Walsh

� wrote:

On 2017-10-17 at 14:28 -0400, Daniel Mills wrote:

  

Cygwin implements mkfifo, which bash will use in place of /dev/fd



The provided error messages suggest that bash is trying to use /dev/fd:

  

R:bin/iotest: line 112: /dev/fd/62: No such file or directory
cat: write error: Broken pipe
W:bin/iotest: line 112: /dev/fd/62: No such file or directory
/h> cat: write error: Broken pipe


---
   Regardless of implementation, this has worked for the past
3 years (1st checked in 2014-10-29) with the coalesce receive
microseconds set to 1.  Only when I change rx-usecs to 0 on
the linux-server side do I start getting error messages
(each time, every time) running it on the cygwin side.

   Can anyone tell me how I'd get such an error if cygwin
and bash are working correctly?  I.e. sorta looks like either
a cygwin or bash-on-cygwin bug and not a scripting error, no?

  :-(




Re: broken pipe from func-output by changing network settings?

2017-10-17 Thread Ángel
On 2017-10-17 at 14:28 -0400, Daniel Mills wrote:

> 
> Cygwin implements mkfifo, which bash will use in place of /dev/fd

The provided error messages suggest that bash is trying to use /dev/fd:

> R:bin/iotest: line 112: /dev/fd/62: No such file or directory
> cat: write error: Broken pipe
> W:bin/iotest: line 112: /dev/fd/62: No such file or directory
> /h> cat: write error: Broken pipe




Re: broken pipe from func-output by changing network settings?

2017-10-17 Thread Daniel Mills
On Tue, Oct 17, 2017 at 1:37 PM, Ángel  wrote:

> bash converts < <(  dd_need_io "$if" "$of"  ...)  into a read
> from /dev/fd/62 in order to make readarray read file descriptor 62.
>
> Given that this the host OS doesn't provide them, the first thing I
> would verify would be: is cygwin, as setup on that system, providing
> such descriptors?
>
> As a simple test, you can do:
>  wc -l <(cat /etc/passwd)
>
> (change /etc/passwd to another file if that's not available)
>
> Regards
>
>
> Cygwin implements mkfifo, which bash will use in place of /dev/fd


Re: broken pipe from func-output by changing network settings?

2017-10-17 Thread Ángel
On 2017-10-17 at 03:28 -0700, L A Walsh wrote:
> I run the test using cygwin, and use /dev/zero and /dev/null --
> creating those files in my home directory on each platform.
> 
> That way I can copy from /dev/zero on one platform to /dev/null on the other
> or vice-versa to get timings of file transfer speed, APART from
> file-io delays of going through the file system.
(...)
> So my question is -- how can the pipe disappear so fast
> that my "readarray out" results in a broken pipe message.
> 
> Shouldn't that be impossible with the code above?
> 
> FWIW, the readarray is trying to catch the output from 'dd',
> with 's' catching the status of the 'dd' command (as passed
> through nice).
> 
> But why would changing network settings on an ethernet
> node result in pipe errors in bash?
> 
> Ideas?

bash converts < <(  dd_need_io "$if" "$of"  ...)  into a read
from /dev/fd/62 in order to make readarray read file descriptor 62.

Given that this the host OS doesn't provide them, the first thing I
would verify would be: is cygwin, as setup on that system, providing
such descriptors?

As a simple test, you can do:
 wc -l <(cat /etc/passwd)

(change /etc/passwd to another file if that's not available)

Regards




Re: broken pipe

2008-02-13 Thread Brian J. Murrell
On Wed, 2008-02-13 at 16:00 -0500, Brian J. Murrell wrote:
 
 find / -type f -print 21 | head -20 || true

Doh!

This of course won't work.  The first solution should though.

b.



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


Re: broken pipe

2008-02-13 Thread Paul Jarc
Brian J. Murrell [EMAIL PROTECTED] wrote:
 It is a shame for this particular reason that head does not (perhaps as
 an option) consume it's input after displaying the 20 lines.

You can do that with sed:
... | sed '21,$d'


paul




Re: broken pipe

2008-02-13 Thread Brian J. Murrell
On Wed, 2008-02-13 at 14:56 -0600, Michael Potter wrote:
 Bash Bunch,
 
 I googled a bit and it see this problem asked several times, but I
 never really saw a slick solution:
 
 given this:
 
 set -o pipefail
 find / -type f -print 21 |head -20
 echo ${PIPESTATUS[*]}
 
 prints this:
 141 0
 
 find fails because it has a bunch of output, but head only will accept
 the first n lines.
 
 This is a problem for me because I have trap ERR  errexit  pipefail 
 activated.
 
 The solution I will use will be to write the find output to a file,
 then run head on it.

How about:

find / -type f -print 21 | (head -20; cat /dev/null)

or

find / -type f -print 21 | head -20 || true

 I am hoping that someone on the group has a more graceful solution.

It is a shame for this particular reason that head does not (perhaps as
an option) consume it's input after displaying the 20 lines.

b.



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