Subject: lib/32454: dbopen(3) creates temp file in CWD instead of $TMPDIR
To: None <lib-bug-people@netbsd.org, gnats-admin@netbsd.org,>
From: Jeff Rizzo <riz@boogers.sf.ca.us>
List: netbsd-bugs
Date: 01/04/2006 23:35:00
>Number: 32454
>Category: lib
>Synopsis: dbopen(3) creates temp file in CWD instead of $TMPDIR
>Confidential: no
>Severity: non-critical
>Priority: medium
>Responsible: lib-bug-people
>State: open
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Wed Jan 04 23:35:00 +0000 2006
>Originator: Jeff Rizzo
>Release: NetBSD 3.0_STABLE
>Organization:
>Environment:
System: NetBSD boogers.sf.ca.us 3.0_STABLE NetBSD 3.0_STABLE (TYAN251X.MP) #3: Mon Jan 2 14:38:32 PST 2006 riz@coconut.tastylime.net:/space/releng/buildobj3/space/releng/src3/sys/arch/i386/compile/TYAN251X.MP i386
Architecture: i386
Machine: i386
>Description:
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.
>How-To-Repeat:
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.
>Fix:
None supplied. I glanced through the libc db code, but quickly
got lost...
>Unformatted: