Subject: pkg/10191: bfd-crunchide creates temporary files in the wrong directory
To: None <gnats-bugs@gnats.netbsd.org>
From: None <rearnsha@arm.com>
List: netbsd-bugs
Date: 05/24/2000 03:36:13
>Number:         10191
>Category:       pkg
>Synopsis:       bfd-crunchide creates temporary files in the wrong directory
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    pkg-manager
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Wed May 24 03:37:00 PDT 2000
>Closed-Date:
>Last-Modified:
>Originator:     Richard Earnshaw
>Release:        NetBSD-current
>Organization:
ARM
>Environment:
port-arm32 1.4X (I think)

>Description:
pkgsrc/cross/bfd-crunchide, which is needed for building cross distributions of NetBSD, 
uses tempnam(3) to create a temporary in the current directory, so that it can 
rename(2) it over the original file after the mangling has been finished.

tempnam(3) however, will ignore the suggested directory if TMPDIR is set
in the environment, so the subsequent rename(2) call can fail because 
the the two files are not on the same device.

>How-To-Repeat:
setenv TMPDIR /tmp
cd some-dir-on-another-disk
crunchgen <some-file>
--> rename: cross-device link
>Fix:
Unset the environment variable (or set it to ".") before calling 
tempnam(3)

>Release-Note:
>Audit-Trail:
>Unformatted: