Re: bash pipe redirection gets stuck

2012-12-04 Thread jb
 long at rule.lv writes:

 
 Dear all,
 I stumbled upon a problem where multiple pipe redirection occasionally get
 stuck when trying to get sha256 sum of a stream.
 
 You can try to reproduce the problem if you have /usr/ports/shells/bash
 installed (output redirection used in this command is possible only in
 bash).
 Create temporary test file with command: dd if=/dev/urandom of=/tmp/file1
 bs=1k count=10
 And the command I'm using is:
 /usr/local/bin/bash -c 'cat /tmp/file1 | tee (/sbin/sha256 
 /tmp/file1.sha256)  /tmp/file1.copy' ; echo $status

I could reproduce it on FreeBSD 9.0-RELEASE-p3 on 3rd try, but after upgrade
of bash-4.1.11 to bash-4.2.37 it works (tested 30 times).
jb
 

___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org


bash pipe redirection gets stuck

2012-12-03 Thread long
Dear all,
I stumbled upon a problem where multiple pipe redirection occasionally get
stuck when trying to get sha256 sum of a stream.

You can try to reproduce the problem if you have /usr/ports/shells/bash
installed (output redirection used in this command is possible only in
bash).
Create temporary test file with command: dd if=/dev/urandom of=/tmp/file1
bs=1k count=10
And the command I'm using is:
/usr/local/bin/bash -c 'cat /tmp/file1 | tee (/sbin/sha256 
/tmp/file1.sha256)  /tmp/file1.copy' ; echo $status

Command gets stuck about once in 20 executions.
top output when command gets stuck (irrelevant processes removed):
  PID USERNAMETHR PRI NICE   SIZERES STATE   C   TIME   WCPU COMMAND
84073 HappyUser 1  520 17612K  2268K wait0   0:00  0.00% bash
84154 HappyUser 1  520 10084K   844K fifoow  1   0:00  0.00% tee

And more strangely, I can reproduce this problem on 9.0-RELEASE and
7.4-RELEASE-p6, but couldn't reproduce on 8.2-RELEASE-p4.

Thanks for any pointers/explanations,
Normunds

___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org


Re: bash pipe redirection gets stuck

2012-12-03 Thread Jerry
On Mon, 3 Dec 2012 16:35:15 +0200 (EET)
l...@rule.lv articulated:

 Dear all,
 I stumbled upon a problem where multiple pipe redirection
 occasionally get stuck when trying to get sha256 sum of a stream.
 
 You can try to reproduce the problem if you
 have /usr/ports/shells/bash installed (output redirection used in
 this command is possible only in bash).
 Create temporary test file with command: dd if=/dev/urandom
 of=/tmp/file1 bs=1k count=10
 And the command I'm using is:
 /usr/local/bin/bash -c 'cat /tmp/file1 | tee (/sbin/sha256 
 /tmp/file1.sha256)  /tmp/file1.copy' ; echo $status
 
 Command gets stuck about once in 20 executions.
 top output when command gets stuck (irrelevant processes removed):
   PID USERNAMETHR PRI NICE   SIZERES STATE   C   TIME   WCPU
 COMMAND 84073 HappyUser 1  520 17612K  2268K wait0
 0:00  0.00% bash 84154 HappyUser 1  520 10084K   844K fifoow
 1   0:00  0.00% tee
 
 And more strangely, I can reproduce this problem on 9.0-RELEASE and
 7.4-RELEASE-p6, but couldn't reproduce on 8.2-RELEASE-p4.
 
 Thanks for any pointers/explanations,
 Normunds

For starters, what version of Bash? FreeBSD is still a few patches
behind the current patch level, so that is also a possibility.

I would suggest you visit:
https://lists.gnu.org/mailman/listinfo/bug-bash, subscribe to the
list and then ask your question bug-b...@gnu.org.

-- 
Jerry ♔

Disclaimer: off-list followups get on-list replies or get ignored.
Please do not ignore the Reply-To header.
__
Communicate!  It can't make things any worse.
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org

Re: bash pipe redirection gets stuck

2012-12-03 Thread Frank Reppin

On 03.12.12 15:35, l...@rule.lv wrote:
[...]

I stumbled upon a problem where multiple pipe redirection occasionally get
stuck when trying to get sha256 sum of a stream.

You can try to reproduce the problem if you have /usr/ports/shells/bash
installed (output redirection used in this command is possible only in
bash).
Create temporary test file with command: dd if=/dev/urandom of=/tmp/file1
bs=1k count=10
And the command I'm using is:
/usr/local/bin/bash -c 'cat /tmp/file1 | tee (/sbin/sha256 
/tmp/file1.sha256)  /tmp/file1.copy' ; echo $status

Command gets stuck about once in 20 executions.
top output when command gets stuck (irrelevant processes removed):
   PID USERNAMETHR PRI NICE   SIZERES STATE   C   TIME   WCPU COMMAND
84073 HappyUser 1  520 17612K  2268K wait0   0:00  0.00% bash
84154 HappyUser 1  520 10084K   844K fifoow  1   0:00  0.00% tee

And more strangely, I can reproduce this problem on 9.0-RELEASE and
7.4-RELEASE-p6, but couldn't reproduce on 8.2-RELEASE-p4.

It maybe couldn't gather more randomness from /dev/random?
The random(4) manpage suggests that there's (theoretically)
indeed a chance that it blocks - see the section about
'kern.random.sys.seeded'.
So in fact - when you think the command gets stuck - it's
probably not bash related at all.

cheers,
Frank Reppin

--
43rd Law of Computing:
Anything that can go wr
fortune: Segmentation violation -- Core dumped
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org


Re: bash pipe redirection gets stuck

2012-12-03 Thread jb
 long at rule.lv writes:

 
 Dear all,
 I stumbled upon a problem where multiple pipe redirection occasionally get
 stuck when trying to get sha256 sum of a stream.
 
 You can try to reproduce the problem if you have /usr/ports/shells/bash
 installed (output redirection used in this command is possible only in
 bash).
 Create temporary test file with command: dd if=/dev/urandom of=/tmp/file1
 bs=1k count=10
 And the command I'm using is:
 /usr/local/bin/bash -c 'cat /tmp/file1 | tee (/sbin/sha256 
 /tmp/file1.sha256)  /tmp/file1.copy' ; echo $status
 ...

Do you get stuck with this ? Does it make any difference ?
/usr/local/bin/bash -c 'cat /tmp/file1 | tee /tmp/file1.copy | /sbin/sha256 \
/tmp/file1.sha256' ; echo $status

jb




___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org


Re: bash pipe redirection gets stuck

2012-12-03 Thread jb
jb jb.1234abcd at gmail.com writes:

 ...
 Do you get stuck with this ? Does it make any difference ?

I missed a redirector - sorry about that; the entry should be:
/usr/local/bin/bash -c 'cat /tmp/file1 | tee /tmp/file1.copy | /sbin/sha256  \
/tmp/file1.sha256' ; echo $status

jb



___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org


Re: bash pipe redirection gets stuck

2012-12-03 Thread long
 On 03.12.12 15:35, l...@rule.lv wrote:
 [...]
 I stumbled upon a problem where multiple pipe redirection occasionally
 get
 stuck when trying to get sha256 sum of a stream.

 You can try to reproduce the problem if you have /usr/ports/shells/bash
 installed (output redirection used in this command is possible only in
 bash).
 Create temporary test file with command: dd if=/dev/urandom
 of=/tmp/file1
 bs=1k count=10
 And the command I'm using is:
 /usr/local/bin/bash -c 'cat /tmp/file1 | tee (/sbin/sha256 
 /tmp/file1.sha256)  /tmp/file1.copy' ; echo $status

 Command gets stuck about once in 20 executions.
 top output when command gets stuck (irrelevant processes removed):
PID USERNAMETHR PRI NICE   SIZERES STATE   C   TIME   WCPU
 COMMAND
 84073 HappyUser 1  520 17612K  2268K wait0   0:00  0.00%
 bash
 84154 HappyUser 1  520 10084K   844K fifoow  1   0:00  0.00% tee

 And more strangely, I can reproduce this problem on 9.0-RELEASE and
 7.4-RELEASE-p6, but couldn't reproduce on 8.2-RELEASE-p4.
 It maybe couldn't gather more randomness from /dev/random?
 The random(4) manpage suggests that there's (theoretically)
 indeed a chance that it blocks - see the section about
 'kern.random.sys.seeded'.
 So in fact - when you think the command gets stuck - it's
 probably not bash related at all.

 cheers,
 Frank Reppin

 --
 43rd Law of Computing:
  Anything that can go wr
 fortune: Segmentation violation -- Core dumped



Thanks for your answer, but randomly generated file is created fine (it is
only for illustrative purpose). As far as I understand, thing that blocks
is tee inside bash command or pipeline.

Thanks and best regards,
Normunds

___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org