From owner-freebsd-bugs@FreeBSD.ORG Wed Oct 12 22:10:08 2011 Return-Path: Delivered-To: freebsd-bugs@hub.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 46D5A106566C for ; Wed, 12 Oct 2011 22:10:08 +0000 (UTC) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2001:4f8:fff6::28]) by mx1.freebsd.org (Postfix) with ESMTP id 1F0388FC12 for ; Wed, 12 Oct 2011 22:10:08 +0000 (UTC) Received: from freefall.freebsd.org (localhost [127.0.0.1]) by freefall.freebsd.org (8.14.4/8.14.4) with ESMTP id p9CMA7wd088656 for ; Wed, 12 Oct 2011 22:10:07 GMT (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.14.4/8.14.4/Submit) id p9CMA7jI088655; Wed, 12 Oct 2011 22:10:07 GMT (envelope-from gnats) Resent-Date: Wed, 12 Oct 2011 22:10:07 GMT Resent-Message-Id: <201110122210.p9CMA7jI088655@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, Adrian Wontroba Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id D4A751065674 for ; Wed, 12 Oct 2011 22:01:56 +0000 (UTC) (envelope-from nobody@FreeBSD.org) Received: from red.freebsd.org (red.freebsd.org [IPv6:2001:4f8:fff6::22]) by mx1.freebsd.org (Postfix) with ESMTP id BA83B8FC12 for ; Wed, 12 Oct 2011 22:01:56 +0000 (UTC) Received: from red.freebsd.org (localhost [127.0.0.1]) by red.freebsd.org (8.14.4/8.14.4) with ESMTP id p9CM1uYP024769 for ; Wed, 12 Oct 2011 22:01:56 GMT (envelope-from nobody@red.freebsd.org) Received: (from nobody@localhost) by red.freebsd.org (8.14.4/8.14.4/Submit) id p9CM1uDF024764; Wed, 12 Oct 2011 22:01:56 GMT (envelope-from nobody) Message-Id: <201110122201.p9CM1uDF024764@red.freebsd.org> Date: Wed, 12 Oct 2011 22:01:56 GMT From: Adrian Wontroba To: freebsd-gnats-submit@FreeBSD.org X-Send-Pr-Version: www-3.1 Cc: Subject: misc/161526: script outputs corrupt if input is not from a terminal X-BeenThere: freebsd-bugs@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Bug reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 12 Oct 2011 22:10:08 -0000 >Number: 161526 >Category: misc >Synopsis: script outputs corrupt if input is not from a terminal >Confidential: no >Severity: non-critical >Priority: low >Responsible: freebsd-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: sw-bug >Submitter-Id: current-users >Arrival-Date: Wed Oct 12 22:10:07 UTC 2011 >Closed-Date: >Last-Modified: >Originator: Adrian Wontroba >Release: RELENG_8 >Organization: na >Environment: FreeBSD awbsd.censored 8.2-STABLE FreeBSD 8.2-STABLE #0: Fri Oct 7 00:51:20 BST 2011 toor@awbsd.censored:/usr/obj/usr/src/sys/GENERIC i386 >Description: If the standard input for the current version of script (1.24.30.5) in RELENG_8 / 8-STABLE is not a terminal, in a simple case (running date) both the output file and the standard output from script are corrupt with multiple 5e 44 08 08 sequences inserted. The previous version of script (1.24.30.4) does not display this behaviour. Output is is similar irrespective of standard input redirection. I have been unable so far to produce a simple test case for my starting point of portupgrade hanging when run in a batch job. The examples below were produced using freshly compiled versions of the previous and current versions of script. I have already reverted /usr/bin/script on this system to the old version. current script without standard input redirection - works as expected [aw1@awbsd ~/script]$ /home/aw1/script/1.24.30.5/script -qa /tmp/56 date > /tmp/56o 2> /tmp/56e [aw1@awbsd ~/script]$ [aw1@awbsd /tmp]$ ls -l 56* -rw-r--r-- 1 aw1 wheel 36 Oct 12 22:17 56 -rw-r--r-- 1 aw1 wheel 0 Oct 12 22:17 56e -rw-r--r-- 1 aw1 wheel 30 Oct 12 22:17 56o [aw1@awbsd /tmp]$ for i in 56*; do echo $i; hd $i; done 56 00000000 64 61 74 65 0d 0a 57 65 64 20 4f 63 74 20 31 32 |date..Wed Oct 12| 00000010 20 32 32 3a 31 37 3a 32 37 20 42 53 54 20 32 30 | 22:17:27 BST 20| 00000020 31 31 0d 0a |11..| 00000024 56e 56o 00000000 57 65 64 20 4f 63 74 20 31 32 20 32 32 3a 31 37 |Wed Oct 12 22:17| 00000010 3a 32 37 20 42 53 54 20 32 30 31 31 0d 0a |:27 BST 2011..| 0000001e current script with standard input redirection - outputs corrupt [aw1@awbsd ~/script]$ /home/aw1/script/1.24.30.5/script -qa /tmp/55 date > /tmp/55o 2> /tmp/55e < /dev/null [aw1@awbsd ~/script]$ [aw1@awbsd /tmp]$ ls -l 55* -rw-r--r-- 1 aw1 wheel 516 Oct 12 22:11 55 -rw-r--r-- 1 aw1 wheel 0 Oct 12 22:11 55e -rw-r--r-- 1 aw1 wheel 510 Oct 12 22:11 55o [aw1@awbsd /tmp]$ for i in 55*; do echo $i; hd $i; done 55 00000000 64 61 74 65 0d 0a 5e 44 08 08 5e 44 08 08 5e 44 |date..^D..^D..^D| 00000010 08 08 5e 44 08 08 5e 44 08 08 5e 44 08 08 5e 44 |..^D..^D..^D..^D| * 000001d0 08 08 5e 44 08 08 5e 44 08 08 5e 44 08 08 57 65 |..^D..^D..^D..We| 000001e0 64 20 4f 63 74 20 31 32 20 32 32 3a 31 31 3a 31 |d Oct 12 22:11:1| 000001f0 37 20 42 53 54 20 32 30 31 31 0d 0a 5e 44 08 08 |7 BST 2011..^D..| 00000200 5e 44 08 08 |^D..| 00000204 55e 55o 00000000 5e 44 08 08 5e 44 08 08 5e 44 08 08 5e 44 08 08 |^D..^D..^D..^D..| * 000001d0 5e 44 08 08 5e 44 08 08 57 65 64 20 4f 63 74 20 |^D..^D..Wed Oct | 000001e0 31 32 20 32 32 3a 31 31 3a 31 37 20 42 53 54 20 |12 22:11:17 BST | 000001f0 32 30 31 31 0d 0a 5e 44 08 08 5e 44 08 08 |2011..^D..^D..| 000001fe the previous version of script (1.24.30.4) does not display this behaviour, previous script without standard input redirection [aw1@awbsd ~/script]$ /home/aw1/script/1.24.30.4/script -qa /tmp/46 date > /tmp/46o 2> /tmp/46e [aw1@awbsd ~/script]$ [aw1@awbsd /tmp]$ ls -l 46* -rw-r--r-- 1 aw1 wheel 36 Oct 12 22:14 46 -rw-r--r-- 1 aw1 wheel 0 Oct 12 22:14 46e -rw-r--r-- 1 aw1 wheel 30 Oct 12 22:14 46o [aw1@awbsd /tmp]$ for i in 46*; do echo $i; hd $i; done 46 00000000 64 61 74 65 0d 0a 57 65 64 20 4f 63 74 20 31 32 |date..Wed Oct 12| 00000010 20 32 32 3a 31 34 3a 33 39 20 42 53 54 20 32 30 | 22:14:39 BST 20| 00000020 31 31 0d 0a |11..| 00000024 46e 46o 00000000 57 65 64 20 4f 63 74 20 31 32 20 32 32 3a 31 34 |Wed Oct 12 22:14| 00000010 3a 33 39 20 42 53 54 20 32 30 31 31 0d 0a |:39 BST 2011..| 0000001e previous script with standard input redirection [aw1@awbsd ~/script]$ /home/aw1/script/1.24.30.4/script -qa /tmp/45 date > /tmp/45o 2> /tmp/45e < /dev/null [aw1@awbsd ~/script]$ [aw1@awbsd /tmp]$ ls -l 45* -rw-r--r-- 1 aw1 wheel 36 Oct 12 22:08 45 -rw-r--r-- 1 aw1 wheel 0 Oct 12 22:08 45e -rw-r--r-- 1 aw1 wheel 30 Oct 12 22:08 45o [aw1@awbsd /tmp]$ for i in 45*; do echo $i; hd $i; done 45 00000000 64 61 74 65 0d 0a 57 65 64 20 4f 63 74 20 31 32 |date..Wed Oct 12| 00000010 20 32 32 3a 30 38 3a 34 31 20 42 53 54 20 32 30 | 22:08:41 BST 20| 00000020 31 31 0d 0a |11..| 00000024 45e 45o 00000000 57 65 64 20 4f 63 74 20 31 32 20 32 32 3a 30 38 |Wed Oct 12 22:08| 00000010 3a 34 31 20 42 53 54 20 32 30 31 31 0d 0a |:41 BST 2011..| 0000001e >How-To-Repeat: On a standard system, something like script -qa /tmp/55 date > /tmp/55o 2> /tmp/55e < /dev/null and inspection of the output files should show the problem >Fix: not known >Release-Note: >Audit-Trail: >Unformatted: