bug-bash
[Top][All Lists]
Advanced

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

[bash-4.0 executes command without newline]


From: Arindam Sarkar - Sun Microsystems
Subject: [bash-4.0 executes command without newline]
Date: Wed, 16 Dec 2009 18:29:48 +0530
User-agent: Thunderbird 2.0.0.16 (X11/20080922)

Configuration Information [Automatically generated, do not change]:
Machine: sparc
OS: solaris2.11
Compiler: /ws/onnv-tools/SUNWspro/SS12/bin/c99
Compilation CFLAGS:  -DPROGRAM='bash' -DCONF_HOSTTYPE='sparc' 
-DCONF_OSTYPE='solaris2.11' -DCONF_MACHTYPE='sparc-sun-solaris2.11' 
-DCONF_VENDOR='sun' -DLOCALEDIR='/usr/share/locale' -DPACKAGE='bash' -Xc 
-features=extinl,extensions -xprefetch=auto -xbuiltin=%none -xnorunpath -xcsi 
-xinline=%auto -xustr=ascii_utf16_ushort -xF=%none -xthreadvar=%all -xspace 
-xldscope=symbolic -KPIC -mt -D_REENTRANT -D__EXTENSIONS__=1 
-D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -D_XOPEN_SOURCE=600 -D_XPG6 
-D_POSIX_PTHREAD_SEMANTICS -D_POSIX_C_SOURCE=200112L -D__XOPEN_OR_POSIX 
-D_STRICT_STDC -D_STRICT_STDC__ -D_STDC_C99 -D_ISOC99_SOURCE -D__C99FEATURES__ 
-DSOLARIS -m32 -xvis=yes -xmemalign=8i -xregs=appl -xtarget=ultra2 
-xarch=sparcvis -xchip=ultra2 -xO4 -s -DSHELL -DHAVE_CONFIG_H -DSOLARIS   -I.  
-I. -I./include -I./lib  -DTEXT_DOMAIN=  
-I/net/train/builds/arindam/6811876/sfwnv/proto/root_sparc/usr/include  
-I/net/train/builds/arindam/6811876/sfwnv/proto/root_sparc/usr/sfw/include  
-I/net/train/b!
uilds/arindam/6811876/sfwnv/proto/root_sparc/usr/include    -Xc 
-features=extinl,extensions -xprefetch=auto -xbuiltin=%none -xnorunpath -xcsi 
-xinline=%auto -xustr=ascii_utf16_ushort -xF=%none -xthreadvar=%all -xspace 
-xldscope=symbolic -KPIC -mt -D_REENTRANT -D__EXTENSIONS__=1 
-D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -D_XOPEN_SOURCE=600 -D_XPG6 
-D_POSIX_PTHREAD_SEMANTICS -D_POSIX_C_SOURCE=200112L -D__XOPEN_OR_POSIX 
-D_STRICT_STDC -D_STRICT_STDC__ -D_STDC_C99 -D_ISOC99_SOURCE -D__C99FEATURES__ 
-DSOLARIS -m32 -xvis=yes -xmemalign=8i -xregs=appl -xtarget=ultra2 
-xarch=sparcvis -xchip=ultra2 -xO4 -s
uname output: SunOS train 5.11 snv_125 sun4u sparc SUNW,Sun-Fire-V890
Machine Type: sparc-sun-solaris2.11

Bash Version: 4.0
Patch Level: 28
Release Status: release

Description:
   bash executes command without newline
   This bug was assumed to be fixed with the intregation
   of bash-4.0, but it is still reproducible.

Repeat-By:

- login to a system
- if your login shell is not bash, then enter bash shell
- do 'su -'
- once you are a super user, create a new user
- now, su to this new user.
- type 'date > /tmp/date.txt' (don't issue a carriage return)
- close the gnome-terminal/dtterm window
- login to the system again and ls /tmp/date.txt, and you
 will find that the file is created.

Fix:
The above problem only occurs when the parent process is running su(1M) 
program. So, when this process running su is sent a HUP signal from another 
window, then init process becomes the parent of the bash process. This is 
because bash belonged to an orphaned process group and was immediately parented 
to the init process.
 At this point, if the window running su program was closed, whatever characters that 
were accumulated in the buffer of the interactive bash program was sent for an I/O to 
the underlying file mapped to the stream. The problem here is that bash should check 
its buffer for a newline character, which is transferred by the tty driver (when it 
reads <CR>). If no newline was found, then the contents of the buffer should be 
discarded. The problem is with readline_internal_char()/readline_internal_charloop() 
which calls rl_read_key to fetch a key including pending input.
If the key is EOF, and length of the input line (i.e rl_end) was not 0, then this key is converted to a newline. Also rl_newline() should be called only if a newline has been detected
webrev location:
http://cr.opensolaris.org/~as158974/sfwnv/






reply via email to

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