NetBSD Problem Report #47155

From www@NetBSD.org  Sat Nov  3 04:43:09 2012
Return-Path: <www@NetBSD.org>
Received: from mail.netbsd.org (mail.netbsd.org [149.20.53.66])
	by www.NetBSD.org (Postfix) with ESMTP id 7738F63D527
	for <gnats-bugs@gnats.NetBSD.org>; Sat,  3 Nov 2012 04:43:09 +0000 (UTC)
Message-Id: <20121103044308.87B5F63D527@www.NetBSD.org>
Date: Sat,  3 Nov 2012 04:43:08 +0000 (UTC)
From: lists@eitanadler.com
Reply-To: lists@eitanadler.com
To: gnats-bugs@NetBSD.org
Subject: add mktemp zero arguments extension
X-Send-Pr-Version: www-1.0

>Number:         47155
>Category:       bin
>Synopsis:       add mktemp zero arguments extension
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    bin-bug-people
>State:          closed
>Class:          change-request
>Submitter-Id:   net
>Arrival-Date:   Sat Nov 03 04:45:00 +0000 2012
>Closed-Date:    Sat Nov 03 13:46:59 +0000 2012
>Last-Modified:  Sat Nov 03 13:46:59 +0000 2012
>Originator:     Eitan Adler
>Release:        trunk
>Organization:
FreeBSD
>Environment:
N/A
>Description:
FreeBSD and OpenBSD have already implemented the Sun/GNU extension of mktemp returning a path to a file in /tmp if mktemp is called without arguments.
>How-To-Repeat:

>Fix:
! Bring in a GNU/Sun/FreeBSD extension:
! If mktemp is called without an argument
! Return with a file in TMPDIR.
!
! Submitted by: Eitan Adler
!
Index: mktemp.1
===================================================================
RCS file: /cvsroot/src/usr.bin/mktemp/mktemp.1,v
retrieving revision 1.19
diff -u -r1.19 mktemp.1
--- mktemp.1	15 Aug 2009 20:44:56 -0000	1.19
+++ mktemp.1	3 Nov 2012 04:41:57 -0000
@@ -115,11 +115,12 @@
 .Fl t
 option value as filename prefix.
 .Pp
-At least one
-.Ar template
-argument or the
-.Fl t
-option must be present.
+If no arguments are passed or if only the
+.Fl d
+flag is passed
+.Nm behaves as if
+.Fl t Li tmp
+was supplied.
 .Pp
 .Nm
 is provided to allow shell scripts to safely use temporary files.
Index: mktemp.c
===================================================================
RCS file: /cvsroot/src/usr.bin/mktemp/mktemp.c,v
retrieving revision 1.11
diff -u -r1.11 mktemp.c
--- mktemp.c	15 Aug 2009 20:02:28 -0000	1.11
+++ mktemp.c	3 Nov 2012 04:41:57 -0000
@@ -100,6 +100,9 @@
 	argc -= optind;
 	argv += optind;

+	if (tflag == 0 && argc < 1)
+		tflag = 1;
+
 	if (tflag) {
 		if (tmpdir == NULL)
 			tmpdir = getenv("TMPDIR");

>Release-Note:

>Audit-Trail:
From: "Christos Zoulas" <christos@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc: 
Subject: PR/47155 CVS commit: src/usr.bin/mktemp
Date: Sat, 3 Nov 2012 09:34:09 -0400

 Module Name:	src
 Committed By:	christos
 Date:		Sat Nov  3 13:34:08 UTC 2012

 Modified Files:
 	src/usr.bin/mktemp: mktemp.1 mktemp.c

 Log Message:
 PR/47155: Eitan Adler: add mktemp zero arguments extension


 To generate a diff of this commit:
 cvs rdiff -u -r1.19 -r1.20 src/usr.bin/mktemp/mktemp.1
 cvs rdiff -u -r1.11 -r1.12 src/usr.bin/mktemp/mktemp.c

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

State-Changed-From-To: open->closed
State-Changed-By: wiz@NetBSD.org
State-Changed-When: Sat, 03 Nov 2012 13:46:59 +0000
State-Changed-Why:
Committed by christos, thanks!


>Unformatted:

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.39 2013/11/01 18:47:49 spz Exp $
$NetBSD: gnats_config.sh,v 1.8 2006/05/07 09:23:38 tsutsui Exp $
Copyright © 1994-2007 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.