Subject: lib/32454: dbopen(3) creates temp file in CWD instead of $TMPDIR
To: None <email@example.com, firstname.lastname@example.org,>
From: Jeff Rizzo <email@example.com>
Date: 01/04/2006 23:35:00
>Synopsis: dbopen(3) creates temp file in CWD instead of $TMPDIR
>Arrival-Date: Wed Jan 04 23:35:00 +0000 2006
>Originator: Jeff Rizzo
>Release: NetBSD 3.0_STABLE
System: NetBSD boogers.sf.ca.us 3.0_STABLE NetBSD 3.0_STABLE (TYAN251X.MP) #3: Mon Jan 2 14:38:32 PST 2006 firstname.lastname@example.org:/space/releng/buildobj3/space/releng/src3/sys/arch/i386/compile/TYAN251X.MP i386
When calling dbopen() with a NULL file pointer ("files never intended
to be preserved on disk"), the temp file is created in the current
working directory, rather than in $TMPDIR. Thus, if $CWD is
read-only, it will fail unexpectedly.
I discovered this using tsort(1):
$ mkdir /tmp/foo
$ chmod -w /tmp/foo
$ cd /tmp/foo
$ tsort /usr/share/dict/words
tsort: db: acronical: Permission denied
(I would expect this to work, since output should be on stdout).
Looking into the tsort source code, I discovered it's the dbopen()
call which creates the tempfile...
I confirmed this is still an issue in -current.
None supplied. I glanced through the libc db code, but quickly