bug-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

BUG REPORT: Bash read builtin not working correctly


From: John Mellor
Subject: BUG REPORT: Bash read builtin not working correctly
Date: Tue, 25 Feb 2003 12:42:20 -0500

Configuration Information [Automatically generated, do not change]:
Machine: sparc
OS: SunOS5
Compiler: cc
Compilation CFLAGS:   -DHAVE_VFPRINTF -DHAVE_UNISTD_H -DHAVE_STDLIB_H 
-DHAVE_LIMITS_H -HAVE_GETGROUPS -DHAVE_RESOURCE -DHAVE_SYS_PARAM 
-DVOID_SIGHANDLER -DUSGr4 -DUSG -DSolaris -DOPENDIR_NOT_ROBUST -DNO_SBRK_DECL 
-DINT_GROUPS_ARRAY -DHAVE_WAIT_H  -DHAVE_DUP2 -DHAVE_STRERROR  -DHAVE_DIRENT_H 
-DHAVE_STRING_H -DHAVE_VARARGS_H -DHAVE_STRCHR  -DHAVE_DEV_FD -Dsparc -DSunOS5 
-DSHELL -DHAVE_ALLOCA -DHAVE_ALLOCA_H  -O -g
uname output: SunOS tarpon 5.7 Generic_106541-19 sun4u sparc 
SUNW,Ultra-Enterprise

Bash Version: 1.14
Patch Level: 4

Description:
        The read builtin does not work correctly in most scenarios.
                If I read from stdin, where stdin is a pipe then nothing is 
read.
                However, if I read from a terminal, it behaves as expected.
                This makes virtually all scripts using read malfunction.  
Critical bug.

                Also shown to fail on:
                        bash 2.05b.0 on RedHat 8.0.93 (Phoebe beta-2)
                        bash 2.02 on RedHat 7.3
                        bash 1.14 on Solaris 9

Repeat-By:
                $ read a b c
                d e f
                $ echo $a $b $c
                d e f
                $ # note: this works as expected.
                $ echo x y z | read a b c
                $ echo $a $b $c
                d e f
                $ # note: dangerous bug, old values not even overwritten
                $ echo x y z | read u v w
                $ echo $u $v $w
                
                $ # note: bad bug, no values read in as per posix, ksh, etc. 
requirements
                $ echo x y z | read u v w
                $ echo $?
                0
                # note: RC should be nonzero if it didn't work.  Fatal bug 
breaks almost every script.


Fix:





reply via email to

[Prev in Thread] Current Thread [Next in Thread]