misc/161526: script outputs corrupt if input is not from a terminal

Adrian Wontroba aw1 at stade.co.uk
Wed Oct 12 22:10:08 UTC 2011


>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 at 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 at awbsd ~/script]$ /home/aw1/script/1.24.30.5/script -qa /tmp/56 date > /tmp/56o 2> /tmp/56e
[aw1 at awbsd ~/script]$
[aw1 at 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 at 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 at awbsd ~/script]$ /home/aw1/script/1.24.30.5/script -qa /tmp/55 date > /tmp/55o 2> /tmp/55e < /dev/null
[aw1 at awbsd ~/script]$
[aw1 at 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 at 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 at awbsd ~/script]$ /home/aw1/script/1.24.30.4/script -qa /tmp/46 date > /tmp/46o 2> /tmp/46e
[aw1 at awbsd ~/script]$

[aw1 at 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 at 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 at awbsd ~/script]$ /home/aw1/script/1.24.30.4/script -qa /tmp/45 date > /tmp/45o 2> /tmp/45e < /dev/null
[aw1 at awbsd ~/script]$

[aw1 at 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 at 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:


More information about the freebsd-bugs mailing list