home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!olivea!decwrl!csus.edu!netcom.com!elh
- From: elh@netcom.com (Ed Hudson)
- Newsgroups: comp.unix.bsd
- Subject: Re: apparent csh bug, 386bsd (WITH FIX)
- Keywords: free(), core.csh
- Message-ID: <-y9mcz-.elh@netcom.com>
- Date: 17 Aug 92 17:28:39 GMT
- References: <1992Aug15.201227.11858@noose.ecn.purdue.edu>
- Organization: Netcom - Online Communication Services (408 241-9760 guest)
- Lines: 62
-
-
- hi.
-
- /* many, many thanks to the jolitz's, gnu, cgd...
- * this stuff is really sex on wheels!
- */
-
- i ran into the same csh bug that bri@pegasus.mit.edu and
- tgt@neon.ecn.purdue.edu have reported (but for me, it was
- with 5 character directory names). what follows is a work-around,
- not a real fix - but solves all of the problems that i've had.
- i haven't posted this to the net before, because i wanted to post
- a real fix for the real problem.
-
- i believe that the 'csh' bug is a memory allocation problem
- of some kind.
-
- my 'fix' is to just allocated 4 additional bytes on each call to
- malloc. having done this, i have seen no other problems with
- the csh.
-
- *** /usr/src/bin/csh/alloc.c Mon Aug 10 21:14:15 1992
- --- /usr/src/bin/csh/Orig/alloc.c Mon Aug 10 21:08:09 1992
- ***************
- *** 156,163 ****
- register int bucket = 0;
- register unsigned shiftr;
-
- - nbytes= nbytes + 4;
- -
- /*
- * Convert amount of memory requested into closest block size stored in
- * hash buckets which satisfies request. Account for space used per block
- --- 156,161 ----
-
-
- in any event, here's my data on the bug problem:
-
-
- i've encountered a problem that i believe is a memory allocation bug
- in csh.
-
- i have a prompt setting alias in my .cshrc for "cd", that looks like:
-
- alias cd 'cd \,* > /dev/null; set noglob; set xdirs = `dirs`; set prompt = "$user@$hostname $xdirs[1]:q \, % "; unset noglob xdirs'
-
- the bug manifests itself when i type:
-
- cd
- cd bin01
-
- the csh says "Segmentation fault", and on a repeated attempt, dies.
-
- it seems to occur whenever the target directory is 5 characters in name length.
- i think that it is blowing up when the statement "set xdirs = `dirs`" is executed.
- if i modify /usr/src/bin/csh/alloc.c so that the number of bytes requested is automatically
- increased by 4 (on entry to malloc), then the problem goes away.
-
- i'm not sufficiently expert with gdb or the structure of csh to debug this
- properly.
-
- my hardware is: DTK 486-25, AD1542b, WD8013, 16meg, maxtor 8380.
-