From owner-freebsd-bugs@FreeBSD.ORG Sat Apr 6 20:40:00 2013 Return-Path: Delivered-To: freebsd-bugs@smarthost.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id C2B6BC6F for ; Sat, 6 Apr 2013 20:40:00 +0000 (UTC) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2001:1900:2254:206c::16:87]) by mx1.freebsd.org (Postfix) with ESMTP id 91C91F54 for ; Sat, 6 Apr 2013 20:40:00 +0000 (UTC) Received: from freefall.freebsd.org (localhost [127.0.0.1]) by freefall.freebsd.org (8.14.6/8.14.6) with ESMTP id r36Ke0Rq075395 for ; Sat, 6 Apr 2013 20:40:00 GMT (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.14.6/8.14.6/Submit) id r36Ke06L075394; Sat, 6 Apr 2013 20:40:00 GMT (envelope-from gnats) Resent-Date: Sat, 6 Apr 2013 20:40:00 GMT Resent-Message-Id: <201304062040.r36Ke06L075394@freefall.freebsd.org> Resent-From: FreeBSD-gnats-submit@FreeBSD.org (GNATS Filer) Resent-To: freebsd-bugs@FreeBSD.org Resent-Reply-To: FreeBSD-gnats-submit@FreeBSD.org, Joe Public Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 29DB5BDE for ; Sat, 6 Apr 2013 20:31:18 +0000 (UTC) (envelope-from root@ai1.alaska.net) Received: from ai1.alaska.net (ai1.alaska.net [209.112.188.15]) by mx1.freebsd.org (Postfix) with ESMTP id 62E3FF2E for ; Sat, 6 Apr 2013 20:31:17 +0000 (UTC) Received: (from root@localhost) by ai1.alaska.net (8.14.5/8.14.5) id r36KWOJk085654; Sat, 6 Apr 2013 11:32:24 -0900 (AKST) (envelope-from root) Message-Id: <201304062032.r36KWOJk085654@ai1.alaska.net> Date: Sat, 6 Apr 2013 11:32:24 -0900 (AKST) From: Joe Public To: FreeBSD-gnats-submit@freebsd.org X-Send-Pr-Version: 3.113 Subject: bin/177674: /bin/sh 'while read X' loop problem X-BeenThere: freebsd-bugs@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list Reply-To: Joe Public List-Id: Bug reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 06 Apr 2013 20:40:00 -0000 >Number: 177674 >Category: bin >Synopsis: /bin/sh 'while read X' loop problem >Confidential: no >Severity: non-critical >Priority: medium >Responsible: freebsd-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: sw-bug >Submitter-Id: current-users >Arrival-Date: Sat Apr 06 20:40:00 UTC 2013 >Closed-Date: >Last-Modified: >Originator: Joe Public >Release: FreeBSD 9.1-RELEASE i386 >Organization: none >Environment: System: FreeBSD 9.1-RELEASE FreeBSD 9.1-RELEASE #0 r243826: Tue Dec 4 06:55:39 UTC 2012 root@obrian.cse.buffalo.edu:/usr/obj/usr/src/sys/GENERIC i386 >Description: There is some kind of problem with 'read' in a sh(1) loop, but it is only demonstrated with some programs (such as mplayer). >How-To-Repeat: First, create a file with some valid MP3 pathanmes inside, then: OK: while read X; do echo $X; done < FILEWITHMP3PATHNAMES OK: while read X; do ls -l $X; done < FILEWITHMP3PATHNAMES FAIL: while read X; do mplayer $X; done < FILEWITHMP3PATHNAMES This last command line will fail in a mess of corruption, and it is difficult to explain what is actually occurring. With only 1 pathname in the file, it works OK, but with 2 or more, it increasingly results in more and more corruption. >Fix: I don't know what the problem is. I tried inserting sleep(1) commands to make the loop slow and other things, but nothing made any difference. >Release-Note: >Audit-Trail: >Unformatted: