[comp.sys.sun] ndbm bug on Sun4 architecture running 4.1?

winnie@elroy.jpl.nasa.gov (Winnie Williams) (08/14/90)

I have a small program that is using the ndbm functions: dbm_firstkey(db)
and dbm_nextkey(db).  In a loop something like:

    for (key = dbm_firstkey(db); key.dptr != NULL; key = dbm_nextkey(db))

the first time throught the loops is fine, the second time through the
loop dbm_nextkey() gets the same key as dbm_firstkey() just got, and then
dbm_nextkey() proceeds to get the rest of the keys in the database.  We
just upgraded to 4.1.  The problem *does not* occur on sparcstation sun4c
architectures; it *does* occur on other sun4 - 4/280, 4/110, 4/370.
However, on the sun4 architectures, if I save the output to a file (
my_exec >& junk ) or pipe it to more ( my_exec | more ) the problem
disappears.  I've run my executable under trace to verify what is
happening.  Does anyone know what is happening or had any similar
experiences?  I'd appreciate any information you could give me.

Winifred I. Williams
Image Analysis Systems Group
Jet Propulsion Laboratory
winnie@elroy.jpl.nasa.gov