NetBSD Problem Report #39717

From www@NetBSD.org  Wed Oct  8 12:59:58 2008
Return-Path: <www@NetBSD.org>
Received: from mail.netbsd.org (mail.netbsd.org [204.152.190.11])
	by narn.NetBSD.org (Postfix) with ESMTP id 52A2E63BA54
	for <gnats-bugs@gnats.netbsd.org>; Wed,  8 Oct 2008 12:59:58 +0000 (UTC)
Message-Id: <20081008125958.196BA63B88A@narn.NetBSD.org>
Date: Wed,  8 Oct 2008 12:59:58 +0000 (UTC)
From: joern.clausen@uni-bielefeld.de
Reply-To: joern.clausen@uni-bielefeld.de
To: gnats-bugs@NetBSD.org
Subject: patch-ae in sysutils/gentoo uses mkdtemp
X-Send-Pr-Version: www-1.0

>Number:         39717
>Category:       pkg
>Synopsis:       patch-ae in sysutils/gentoo uses mkdtemp
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    pkg-manager
>State:          closed
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Wed Oct 08 13:00:00 +0000 2008
>Closed-Date:    Sun May 17 22:06:09 +0000 2009
>Last-Modified:  Sun May 17 22:06:09 +0000 2009
>Originator:     Jörn Clausen
>Release:        
>Organization:
University of Bielefeld
>Environment:
SunOS spare4200 5.10 Generic_120012-14 i86pc i386 i86pc
>Description:
patch-ae in sysutils/gentoo replaces tmpnam with mkdtemp. NetBSD's man-page of mkdtemp warns:

     The mkdtemp() function is nonstandard and should not be used
     if portability is required.

I think "portability" is a given for pkgsrc.
>How-To-Repeat:
Compile under a OS that does not provide mkdtemp().
>Fix:
This should probably get fixed upstream and decided by configure. The function seems important enough to be added to other OSes:

http://docs.sun.com/app/docs/doc/820-0724/gchsv

>Release-Note:

>Audit-Trail:
From: "OBATA Akio" <obache@netbsd.org>
To: gnats-bugs@netbsd.org
Cc: 
Subject: Re: pkg/39717: patch-ae in sysutils/gentoo uses mkdtemp
Date: Sun, 02 Nov 2008 20:44:25 +0900

 On Wed, 08 Oct 2008 22:00:00 +0900, <joern.clausen@uni-bielefeld.de> wrote:

 > patch-ae in sysutils/gentoo replaces tmpnam with mkdtemp. NetBSD's man-page of mkdtemp warns:
 >
 >      The mkdtemp() function is nonstandard and should not be used
 >      if portability is required.
 >
 > I think "portability" is a given for pkgsrc.

 Aside from portability, patch-ae replace tmpnam with mkdtemp.
  tmpnam() returns a pointer to the file name
  mkdtemp() creates a mode 0700 directory and returns the path
 Then, create temporary directory, and use it as regular file...
 It is probably completely mistaken.
 But I don't know what this patch try to fix, because it exists since initial import with no reason.

State-Changed-From-To: open->closed
State-Changed-By: obache@NetBSD.org
State-Changed-When: Sun, 25 Jan 2009 13:14:25 +0000
State-Changed-Why:
patch-ae was removed from pkgsrc.


From: OBATA Akio <obache@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc: 
Subject: PR/39717 CVS commit: pkgsrc/sysutils/gentoo
Date: Sun, 25 Jan 2009 13:12:44 +0000 (UTC)

 Module Name:	pkgsrc
 Committed By:	obache
 Date:		Sun Jan 25 13:12:44 UTC 2009

 Modified Files:
 	pkgsrc/sysutils/gentoo: Makefile distinfo
 Removed Files:
 	pkgsrc/sysutils/gentoo/patches: patch-ae

 Log Message:
 Remove patch-ae.
 It replace tmpnam() with mkdtemp(), but
  * It exists since initial import, but no reason.
  * mkdtemp(3) is not portable, but used unconditionally, reported by PR 39717.
  * tmpnam(3) is used to get temp filename, but mkdtemp(3) create temp directory,
    and return the path.  So, the replacement is completely mistaken.

 Bump PKGREVISION.

 While here, marked as DESTDIR ready.


 To generate a diff of this commit:
 cvs rdiff -r1.30 -r1.31 pkgsrc/sysutils/gentoo/Makefile
 cvs rdiff -r1.23 -r1.24 pkgsrc/sysutils/gentoo/distinfo
 cvs rdiff -r1.3 -r0 pkgsrc/sysutils/gentoo/patches/patch-ae

 Please note that diffs are not public domain; they are subject to the
 copyright notices on the relevant files.

State-Changed-From-To: closed->feedback
State-Changed-By: dholland@NetBSD.org
State-Changed-When: Mon, 26 Jan 2009 05:07:49 +0000
State-Changed-Why:
patch-ae was restored in a new form, because without it the package has a
security problem. Does the new form compile/work for you?


From: =?ISO-8859-1?Q?J=F6rn_Clausen?= <joern@uni-bielefeld.de>
To: gnats-bugs@NetBSD.org
Cc: pkg-manager@NetBSD.org, pkgsrc-bugs@NetBSD.org, gnats-admin@NetBSD.org,
 dholland@NetBSD.org
Subject: Re: pkg/39717 (patch-ae in sysutils/gentoo uses mkdtemp)
Date: Mon, 26 Jan 2009 10:02:43 +0100

 After removing

     #include <paths.h>

 again (does not exist on Solaris, and mkstemp(3C) mentions only 
 stdlib.h), and changing

     strcpy(tempnamebuf, _PATH_TMP "gentoo.XXXXXX");

 to

     strcpy(tempnamebuf, "gentoo.XXXXXX");

 the package did compile. Does paths.h define _PATH_TMP and this provides 
 an appropriate directory for temporary files? The better function in 
 Solaris for this task is tmpfile, but it returns a file handle, not a 
 descriptor. I know no other easy fix than to hardcode "/tmp":

     strcpy(tempnamebuf, "/tmp/gentoo.XXXXXX");

 -- 
   Jörn Clausen                             joern.clausen@uni-bielefeld.de
   Hochschulrechenzentrum                 http://www.uni-bielefeld.de/hrz/
   Universität Bielefeld

From: Joerg Sonnenberger <joerg@britannica.bec.de>
To: gnats-bugs@NetBSD.org
Cc: 
Subject: Re: pkg/39717 (patch-ae in sysutils/gentoo uses mkdtemp)
Date: Mon, 26 Jan 2009 11:55:12 +0100

 On Mon, Jan 26, 2009 at 09:05:03AM +0000, J?rn Clausen wrote:
 >  again (does not exist on Solaris, and mkstemp(3C) mentions only 
 >  stdlib.h), and changing
 >  
 >      strcpy(tempnamebuf, _PATH_TMP "gentoo.XXXXXX");
 >  
 >  to
 >  
 >      strcpy(tempnamebuf, "gentoo.XXXXXX");

 const char *tmpdir = "/tmp";
 if (getenv("TMPDIR"))
 	tmpdir = getenv("TMPDIR");
 snprintf(tempnamebuf, sizeof(tempnamebuf), "%s/%s");

 or something like that.

 Joerg

From: =?ISO-8859-1?Q?J=F6rn_Clausen?= <joern@uni-bielefeld.de>
To: gnats-bugs@NetBSD.org
Cc: 
Subject: Re: pkg/39717
Date: Thu, 05 Mar 2009 10:14:46 +0100

 Either apply Joerg's patch or don't, but please close this PR.

 -- 
   Jörn Clausen                             joern.clausen@uni-bielefeld.de
   Hochschulrechenzentrum                 http://www.uni-bielefeld.de/hrz/
   Universität Bielefeld

From: "OBATA Akio" <obache@netbsd.org>
To: gnats-bugs@netbsd.org
Cc: 
Subject: Re: pkg/39717 (patch-ae in sysutils/gentoo uses mkdtemp)
Date: Mon, 09 Mar 2009 10:51:52 +0900

 Gentoo-0.15.2 will be no longer uses tmpnam().
 http://sourceforge.net/tracker/?func=detail&atid=406763&aid=2537314&group_id=32880

From: "David A. Holland" <dholland@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc: 
Subject: PR/39717 CVS commit: pkgsrc/sysutils/gentoo
Date: Sun, 17 May 2009 22:04:11 +0000

 Module Name:	pkgsrc
 Committed By:	dholland
 Date:		Sun May 17 22:04:11 UTC 2009

 Modified Files:
 	pkgsrc/sysutils/gentoo: distinfo
 	pkgsrc/sysutils/gentoo/patches: patch-ae

 Log Message:
 Solaris doesn't have <paths.h>. Should fix the last traces of PR 39717.


 To generate a diff of this commit:
 cvs rdiff -u -r1.26 -r1.27 pkgsrc/sysutils/gentoo/distinfo
 cvs rdiff -u -r1.6 -r1.7 pkgsrc/sysutils/gentoo/patches/patch-ae

 Please note that diffs are not public domain; they are subject to the
 copyright notices on the relevant files.

State-Changed-From-To: feedback->closed
State-Changed-By: dholland@NetBSD.org
State-Changed-When: Sun, 17 May 2009 22:06:09 +0000
State-Changed-Why:
should build on solaris now.

sorry I dropped this on the floor for the past four months :(
(let me know if there's any further problem!)


>Unformatted:

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.51 2026/08/10 02:28:17 riastradh Exp $
$NetBSD: gnats_config.sh,v 1.10 2026/05/13 22:00:09 riastradh Exp $
Copyright © 1994-2026 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.