From owner-freebsd-questions@FreeBSD.ORG Mon Dec 3 14:45:01 2012 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 4A1FD989 for ; Mon, 3 Dec 2012 14:45:01 +0000 (UTC) (envelope-from long@rule.lv) Received: from mx1.rule.lv (ns1.rule.lv [91.142.1.7]) by mx1.freebsd.org (Postfix) with ESMTP id F019F8FC0C for ; Mon, 3 Dec 2012 14:44:59 +0000 (UTC) Received: from mail.omv.lv (unknown [127.0.0.10]) by mx1.rule.lv (Postfix) with ESMTP id 26E7EDADC28 for ; Mon, 3 Dec 2012 16:35:16 +0200 (EET) X-Virus-Scanned: amavisd-new at mail.omv.lv Received: from mx1.rule.lv ([127.0.0.10]) by mail.omv.lv (mail.omv.lv [127.0.0.10]) (amavisd-new, port 10024) with LMTP id G7vrSZWNFGga for ; Mon, 3 Dec 2012 16:35:15 +0200 (EET) Received: from m.rule.lv (unknown [127.0.0.10]) by mx1.rule.lv (Postfix) with ESMTP id D7116DADC23 for ; Mon, 3 Dec 2012 16:35:15 +0200 (EET) Received: from 144.36.114.84 (SquirrelMail authenticated user long@rule.lv) by mail.rule.lv with HTTP; Mon, 3 Dec 2012 16:35:15 +0200 (EET) Message-ID: <23353.144.36.114.84.1354545315.squirrel@mail.rule.lv> Date: Mon, 3 Dec 2012 16:35:15 +0200 (EET) Subject: bash pipe redirection gets stuck From: long@rule.lv To: freebsd-questions@freebsd.org User-Agent: SquirrelMail/1.4.10a MIME-Version: 1.0 Content-Type: text/plain;charset=utf-8 Content-Transfer-Encoding: 8bit X-Priority: 3 (Normal) Importance: Normal X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 03 Dec 2012 14:45:01 -0000 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 USERNAME THR PRI NICE SIZE RES STATE C TIME WCPU COMMAND 84073 HappyUser 1 52 0 17612K 2268K wait 0 0:00 0.00% bash 84154 HappyUser 1 52 0 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