home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #18 / NN_1992_18.iso / spool / comp / unix / bsd / 4283 < prev    next >
Encoding:
Internet Message Format  |  1992-08-17  |  2.4 KB

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