Subject: Re: broken in 4.02

From: Edan Idzerda <[email-masked]>
Date: Thu, 23 Jul 1998 14:52:39 -0400 (EDT)

On Thu, 23 Jul 1998, Steve Hubert wrote:

> We haven't been able to reproduce this problem or understand what is
> happening. I am guessing that it is happening on Linux and Solaris systems
> newer than the ones we have available. We have Linux 2.0.33 and Solaris
> 5.4. From Jauder's traces it looks like the problem is happening in the
> opendir call in getfnames in pico/pico_os.c. If someone has a system
> capable of reproducing the problem and you can step through it to see
> what's happening, please let us know what the problem is! Thanks.

I'm not exactly sure what Jauder's problem is, but running pilot 
from 4.00 under Solaris 2.6 compiled with gcc 2.8.0 (from Solaris 2.5.1)
I can get pilot to consistency get a BUS error (A)dding a file 
when I'm in a big directory (big dir == >1500 entries):

Program received signal SIGBUS, Bus error.
0xef745a18 in _smalloc ()
(gdb) where
#0  0xef745a18 in _smalloc ()
#1  0xef745a60 in malloc ()
#2  0x33410 in register_key (i=4, rval=2303, label=0x501b8 "", label_printer=0, 
    row=0, col=0, len=0) at pico.c:1245
#3  0x24598 in wkeyhelp (keymenu=0xefffeb90) at display.c:2405
#4  0x215ec in mlreplyd (prompt=0x4f998 "Name of file to add: ", buf=0xefffee00 "", 
    nbuf=256, flg=3, extras=0x0) at display.c:1378
#5  0x210dc in mlreply (prompt=0x4f998 "Name of file to add: ", buf=0xefffee00 "", 
    nbuf=256, flg=1, extras=0x0) at display.c:1250
#6  0x1a3bc in FileBrowse (dir=0xefffefa8 "/home/cael", fn=0xeffff0a8 "", sz=0x0, 
    flags=0) at browse.c:968
#7  0x174c8 in main (argc=2, argv=0xeffff22c) at pilot.c:131

Or, sometimes it will seg fault when just entering a big directory, as shown
below.  It's the same place in the code.

Program terminated with signal 11, Segmentation fault.
Reading symbols from /usr/lib/libc.so.1...done.
Reading symbols from /usr/lib/libdl.so.1...done.
Reading symbols from /usr/platform/SUNW,Ultra-5_10/lib/libc_psr.so.1...done.
#0  0xef7460d8 in realfree ()
(gdb) where
#0  0xef7460d8 in realfree ()
#1  0xef7468fc in cleanfree ()
#2  0xef745b58 in _malloc_unlocked ()
#3  0xef745a60 in malloc ()
#4  0x33410 in register_key (i=6, rval=2303, label=0x501b8 "", label_printer=0, 
    row=0, col=0, len=0) at pico.c:1245
#5  0x24598 in wkeyhelp (keymenu=0x63f3c) at display.c:2405
#6  0x1ce10 in BrowserKeys () at browse.c:1799
#7  0x1cba0 in PaintBrowser (mp=0x7b810, level=0, row=0xefffef48, col=0xefffef44)
    at browse.c:1768
#8  0x1b5e8 in FileBrowse (dir=0xefffefe0 "/home/mefac/edan", fn=0xeffff0e0 "", 
    sz=0x0, flags=0) at browse.c:1345
#9  0x174c8 in main (argc=1, argv=0xeffff264) at pilot.c:131

Cheers :)

- edan

---

From: Jauder Ho <[email-masked]>
Date: Fri, 24 Jul 1998 14:45:29 -0700 (PDT)

okay this is strange... running with gdb

0x40046c4d in __libc_free ()Where is   Spc Next Pg  R Rename     E Edit       
(gdb) where
#0  0x40046c4d in __libc_free ()
#1  0x400a3d88 in __DTOR_END__ ()
#2  0xffffffff in ?? ()
Cannot access memory at address 0x72656475.
(gdb) 

If I step through it, it seems to die around the lines

   1398 #else
   1399     while((dp = readdir(dirp)) != NULL)
   1400       if(!pat || !*pat || !strncmp(dp->d_name, pat, strlen(pat))){
   1401           (*n)++;
   1402           p = dp->d_name;
   1403           while(*np++ = *p++)
   1404             ;
   1405       }
   1406 #endif
   1407 
   1408     closedir(dirp);                                     /* shut
down */
   1409     return(names);

in pico_os.c

	 hope this helps.

--jauder