Subject: bug#6524: [PATCH] hash: extend module to deal with non-pointer keys

From: Paul Eggert <[email-masked]>
Date: Thu, 01 Jul 2010 17:07:00 -0700

On 07/01/10 15:59, Jim Meyering wrote:

> Can you give me a backtrace?
> Even if your patch is clearly better, I'd like to know
> how my code is malfunctioning.

Sure.  This uses your older patch, not the newer gnulib one.

Program received signal SIGABRT, Aborted.
0x0012d422 in __kernel_vsyscall ()
(gdb) where
#0  0x0012d422 in __kernel_vsyscall ()
#1  0x00158651 in *__GI_raise (sig=6) at ../nptl/sysdeps/unix/sysv/linux/raise.c:64
#2  0x0015ba82 in *__GI_abort () at abort.c:92
#3  0x08054826 in hash_insert0 (table=0x805f208, entry=0x8017384d, matched_ent=0x0) at hash.c:1078
#4  0x0804bdba in di_set_insert (dis=0x805e2f4, dev=2049, ino=380435) at di-set.c:264
#5  0x0804ab0f in hash_ins (argc=52, argv=0xbffff304) at du.c:335
#6  process_file (argc=52, argv=0xbffff304) at du.c:467
#7  du_files (argc=52, argv=0xbffff304) at du.c:592
#8  main (argc=52, argv=0xbffff304) at du.c:962

The test case, by the way, is "./du ../../cu*", where the
globbing pattern expands to 51 directories, each a copy of coreutils,
with several hard links because many are git clones of each other.
Arf arf!  (I'm eating my own dog food.)

> Using unions is one way to avoid casts (and certain warnings).

Yes; but ouch!  That's jumping into the fire!  I suspect it's even less
likely to work on weird architectures.  I'd rather stay in the frying pan.