Bug 221381

Summary: [RHEL4] Crash when doing ls with loads of files
Product: Red Hat Enterprise Linux 4 Reporter: Bastien Nocera <bnocera>
Component: bashAssignee: Tim Waugh <twaugh>
Status: CLOSED ERRATA QA Contact: Ben Levenson <benl>
Severity: medium Docs Contact:
Priority: medium    
Version: 4.0CC: csnook, tao, twaugh
Target Milestone: ---Keywords: Reopened
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: RHBA-2007-0680 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2007-11-15 15:57:38 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On: 209283    
Bug Blocks:    

Description Bastien Nocera 2007-01-04 09:20:57 UTC
+++ This bug was initially created as a clone of Bug #209283 +++

DIR=`mktemp -d`
cd $DIR
for f in {0,1,2,3,4}{0,1,2,3,4,5,6,7,8,9}
do
      echo $f
      touch
f${f}{0,1,2,3,4,5,6,7,8,9}{0,1,2,3,4,5,6,7,8,9}{0,1,2,3,4,5,6,7,8,9}{0,1,2,
3,4,5,6,7,8,9}
done

cd $DIR
ls *
<segfault>

-- Additional comment from jakub on 2006-10-04 06:48 EST --
This sounds familiar:

http://sources.redhat.com/bugzilla/show_bug.cgi?id=3253

2006-09-30  Ulrich Drepper  <drepper>

        * posix/glob.c (glob_in_dir): Add some comments and asserts to
        explain why there are no leaks.

2006-09-25  Jakub Jelinek  <jakub>

        [BZ #3253]
        * posix/glob.c (glob_in_dir): Don't alloca one struct globlink at a
        time, rather allocate increasingly bigger arrays of pointers, if
        possible with alloca, if too large with malloc.

http://sourceware.org/cgi-bin/cvsweb.cgi/libc/posix/glob.c.diff?cvsroot=glibc&r1=1.69&r2=1.72

-- Additional comment from jakub on 2006-10-16 03:43 EST --
Should be fixed in glibc-2.3.4-2.28 in dist-4E-qu-candidate.

-- Additional comment from bnocera on 2006-12-19 12:19 EST --
With glibc-2.3.4-2.28 and bash-3.0-19.3, on an i386, I get a quite different
crash now:
#0  __gconv_transform_utf8_internal (step=0x9df9c30, data=0xbf40011c, 
    inptrp=0xbf400110, inend=0x9dfe974 "/tmp.Bqlwb28746/", outbufstart=0x0, 
    irreversible=0xbf400114, do_flush=0, consume_incomplete=1)
    at ../iconv/skeleton.c:401
#1  0x00180beb in *__GI___mbrtowc (pwc=0xbf40018c, s=0x9dfe964 "*", n=16, 
    ps=0xbf400190) at mbrtowc.c:76
#2  0x080c2fdb in xdupmbstowcs (destp=0xbf4001c8, indicesp=0x0, 
    src=0x9dfe964 "*") at xmbsrtowcs.c:188
#3  0x080c2cc9 in xstrmatch (pattern=0x9dfe964 "*", 
    string=0x9e0c96f "f370729", flags=5) at smatch.c:371
#4  0x080bfe09 in glob_vector (pat=0x9dfe964 "*", 
    dir=0x9dfe970 "/tmp/tmp.Bqlwb28746/", flags=0) at glob.c:489
#5  0x080c060b in glob_filename (pathname=0x9dfe950 "/tmp/tmp.Bqlwb28746/*", 
    flags=0) at glob.c:782
#6  0x08086cb3 in shell_glob_filename (
    pathname=0x9e02d10 "/tmp/tmp.Bqlwb28746/*") at pathexp.c:254
#7  0x08083a89 in expand_word_list_internal (list=Variable "list" is not available.
) at subst.c:7200
#8  0x0806a8f2 in execute_command_internal (command=0x9e03090, asynchronous=0, 
    pipe_in=-1, pipe_out=-1, fds_to_close=0x9dfad38) at execute_cmd.c:2797
#9  0x0806c670 in execute_command (command=0x9e03090) at execute_cmd.c:351
#10 0x0805dd7b in reader_loop () at eval.c:146
#11 0x0805ce42 in main (argc=1, argv=0xbff954a4, env=0xbff954ac) at shell.c:714

Bash issue?

-- Additional comment from bnocera on 2007-01-03 10:38 EST --
Created an attachment (id=144715)
bash-segv.patch

Patch from Yves Begrand <yves.begrand>:

- backported changes appearing in glob_vector() routine on bash-3.0-31
- backported changes brought with patch bash31-016
- removed the use of alloca() routine and associated test, because:
 from alloca(3):  "The alloca function is machine and compiler dependent.
			On many systems its implementation is buggy.
			Its use is discouraged"

I've mentioned to Yves that it would be better to not make any changes
regarding alloca usage, as it would make the codebase drift more from upstream.

The patch fixes the problem encountered.

Comment 1 RHEL Program Management 2007-01-04 09:24:28 UTC
The component this request has been filed against is not planned for inclusion
in the next update. The decision is based on weighting the priority and number
of requests for a component as well as the impact on the Red Hat Enterprise
Linux user-base: other components are considered having higher priority and the
number of changes we intend to include in update cycles is limited.

Comment 3 RHEL Program Management 2007-01-04 09:44:35 UTC
The component this request has been filed against is not planned for inclusion
in the next update. The decision is based on weighting the priority and number
of requests for a component as well as the impact on the Red Hat Enterprise
Linux user-base: other components are considered having higher priority and the
number of changes we intend to include in update cycles is limited.

Comment 4 RHEL Program Management 2007-01-04 10:00:55 UTC
Product Management has reviewed and declined this request.  You may appeal this
decision by reopening this request. 

Comment 7 RHEL Program Management 2007-05-09 08:24:16 UTC
This request was evaluated by Red Hat Product Management for inclusion in a Red
Hat Enterprise Linux maintenance release.  Product Management has requested
further review of this request by Red Hat Engineering, for potential
inclusion in a Red Hat Enterprise Linux Update release for currently deployed
products.  This request is not yet committed for inclusion in an Update
release.

Comment 12 Michal Nowak 2007-07-17 15:16:25 UTC
Working on RHTS script to take care of regressions according to this bug.

Comment 15 errata-xmlrpc 2007-11-15 15:57:38 UTC
An advisory has been issued which should help the problem
described in this bug report. This report is therefore being
closed with a resolution of ERRATA. For more information
on the solution and/or where to find the updated files,
please follow the link below. You may reopen this bug report
if the solution does not work for you.

http://rhn.redhat.com/errata/RHBA-2007-0680.html


Comment 17 Roman Rakus 2008-06-02 10:10:51 UTC
*** Bug 160214 has been marked as a duplicate of this bug. ***