Bug 42510 - Fix build of news/knews on -current
Summary: Fix build of news/knews on -current
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: Normal Affects Only Me
Assignee: Kris Kennaway
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2002-09-07 18:10 UTC by Steven G. Kargl
Modified: 2002-10-12 23:14 UTC (History)
1 user (show)

See Also:


Attachments
file.diff (817 bytes, patch)
2002-09-07 18:10 UTC, Steven G. Kargl
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Steven G. Kargl 2002-09-07 18:10:02 UTC
The news/knews port no longer builds because the visibility of
P_tmpdir in /usr/include/stdio.h has been changed.  From stdio.h
we have

/* System V/ANSI C; this is the wrong way to do this, do *not* use these. */
#if __XSI_VISIBLE
#define P_tmpdir        "/var/tmp/"
#endif

Fix: Replace knews/files/patch-file.c with the following patch.

How-To-Repeat: 
cd /usr/ports/news/knews
make
Comment 1 Alan Eldridge freebsd_committer freebsd_triage 2002-09-07 18:21:16 UTC
Responsible Changed
From-To: freebsd-ports->kde

over to maintainer
Comment 2 Giorgos Keramidas freebsd_committer freebsd_triage 2002-09-08 22:34:54 UTC
Adding to audit trail:
:
: Message-Id: <20020907200926.GB3699@xor.obsecurity.org>
: Date: Sat, 7 Sep 2002 13:09:26 -0700
: From: Kris Kennaway <kris@obsecurity.org>
:
: On Sat, Sep 07, 2002 at 10:06:50AM -0700, Steven G. Kargl wrote:
:
: > The news/knews port no longer builds because the visibility of
: > P_tmpdir in /usr/include/stdio.h has been changed.  From stdio.h
: > we have
:
: Hi Steven,
:
: Thanks for the patch.  Wouldn't it be better to use _PATH_TMP from
: <paths.h> for this purpose, though?
:
Comment 3 Giorgos Keramidas freebsd_committer freebsd_triage 2002-09-08 22:36:09 UTC
Adding to audit trail:
:
: Message-Id: <200209072100.g87L04Kb023312@troutmask.apl.washington.edu>
: Date: Sat, 7 Sep 2002 14:00:04 -0700 (PDT)
: From: "Steven G. Kargl" <kargl@troutmask.apl.washington.edu>
:
: Kris Kennaway said:
: > On Sat, Sep 07, 2002 at 10:06:50AM -0700, Steven G. Kargl wrote:
: > > The news/knews port no longer builds because the visibility of
: > > P_tmpdir in /usr/include/stdio.h has been changed.  From stdio.h
: > > we have
: >
: > Thanks for the patch.  Wouldn't it be better to use _PATH_TMP from
: > <paths.h> for this purpose, though?
:
: I didn't know about _PATH_TMP.  I guess everywhere I
: hardcoded "/var/tmp", one can use _PATH_TMP.
:
Comment 4 Alan Eldridge 2002-09-08 22:47:09 UTC
On Sun, Sep 08, 2002 at 02:40:04PM -0700, Giorgos Keramidas wrote:
>The following reply was made to PR ports/42510; it has been noted by GNATS.
>
>From: Giorgos Keramidas <keramida@FreeBSD.org>
>To: bug-followup@FreeBSD.org
>Cc:  
>Subject: Re: ports/42510: Fix build of news/knews on -current
>Date: Mon, 9 Sep 2002 00:34:54 +0300
>
> Adding to audit trail:
> :
> : Message-Id: <20020907200926.GB3699@xor.obsecurity.org>
> : Date: Sat, 7 Sep 2002 13:09:26 -0700
> : From: Kris Kennaway <kris@obsecurity.org>
> :
> : On Sat, Sep 07, 2002 at 10:06:50AM -0700, Steven G. Kargl wrote:
> :
> : > The news/knews port no longer builds because the visibility of
> : > P_tmpdir in /usr/include/stdio.h has been changed.  From stdio.h
> : > we have
> :
> : Hi Steven,
> :
> : Thanks for the patch.  Wouldn't it be better to use _PATH_TMP from
> : <paths.h> for this purpose, though?
> :

Once this is decided (I'm staying out of it), I'll commit a patch. I'm
handling matters (while I'm recovering from illness) since Will has a
heavy school load for the next week.
-- 
Alan Eldridge
Unix/C(++) IT Pro, 20 yrs, seeking new employment.
(http://wwweasel.geeksrus.net/~alane/resume.txt)
KDE, KDE-FreeBSD Teams (http://www.kde.org, http://freebsd.kde.org/)
Comment 5 Steven G. Kargl 2002-09-08 23:46:08 UTC
No wonder I stopped maintaining ports.  It's
a PITA to get a simple fix committed.

Here a new patch that also fixes the port.

-- 
Steve
http://troutmask.apl.washington.edu/~kargl/


--- src/file.c.orig	Fri Jan  9 09:16:19 1998
+++ src/file.c	Sun Sep  8 15:22:11 2002
@@ -6,6 +6,7 @@
 #include <sys/stat.h>
 #include "expand.h"
 #include "file.h"
+#include <paths.h>
 
 #if 0
 #  define FILE_MASK	0666
@@ -185,16 +186,24 @@
 int create_temp_fd(char **name)
 {
     int	fd;
-
-    *name = tmpnam(NULL);
-    if (!*name)
-	fd = -1;
-    else {
-	unlink(*name);
-	fd = open(*name, O_RDWR|O_CREAT|O_EXCL, S_IRUSR|S_IWUSR);
-	if (fd < 0)
-	    *name = NULL;
-    }
+    char filename[FILENAME_MAX];
+    
+    if (getenv("TMPDIR") != NULL) {
+    	strlcpy(filename, getenv("TMPDIR"), FILENAME_MAX);
+	strlcat(filename, "/tmp.XXXXXX", FILENAME_MAX); 
+    } else if (access(_PATH_VARTMP, (R_OK|W_OK)) == 0) {
+	strlcpy(filename, _PATH_VARTMP, FILENAME_MAX); 
+	strlcat(filename, "/tmp.XXXXXX", FILENAME_MAX); 
+    } else if (access(_PATH_TMP, (R_OK|W_OK)) == 0) {
+	strlcpy(filename, _PATH_TMP, FILENAME_MAX); 
+	strlcat(filename, "/tmp.XXXXXX", FILENAME_MAX); 
+    } else
+	strlcpy(filename, "tmp.XXXXXX", FILENAME_MAX);
+	
+    if ((fd = mkstemp(filename)) == -1)
+	*name = NULL;
+    else
+        *name = filename;
 
     return fd;
 }
Comment 6 Alan Eldridge 2002-09-09 00:00:00 UTC
On Sun, Sep 08, 2002 at 03:50:03PM -0700, Steven G. Kargl wrote:
>The following reply was made to PR ports/42510; it has been noted by GNATS.
>
>From: "Steven G. Kargl" <kargl@troutmask.apl.washington.edu>
>To: bug-followup@freebsd.org
>Cc:  
>Subject: Subject: Re: ports/42510: Fix build of news/knews on -current
>Date: Sun, 8 Sep 2002 15:46:08 -0700 (PDT)
>
> No wonder I stopped maintaining ports.  It's
> a PITA to get a simple fix committed.
> 
> Here a new patch that also fixes the port.

If you guys (especially Kris K) can't agree on a patch, I'm just going
to say fsck it and write my own, OK?

I'm recovering from pneumonia and I don't have time for this.

So, Kris, why don't you decide what to use?
-- 
Alan Eldridge
Unix/C(++) IT Pro, 20 yrs, seeking new employment.
(http://wwweasel.geeksrus.net/~alane/resume.txt)
KDE, KDE-FreeBSD Teams (http://www.kde.org, http://freebsd.kde.org/)
Comment 7 Alan Eldridge freebsd_committer freebsd_triage 2002-09-18 19:07:30 UTC
Responsible Changed
From-To: kde->freebsd-ports

Not a kde port.
Comment 8 Kris Kennaway freebsd_committer freebsd_triage 2002-09-18 19:13:37 UTC
Responsible Changed
From-To: freebsd-ports->kris

I'm testing the fix for this
Comment 9 Kris Kennaway freebsd_committer freebsd_triage 2002-10-12 23:14:12 UTC
State Changed
From-To: open->closed

Patch committed, thanks!