After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 623890 - brasero-session.c uses mkdtemp(), which is not a standard function
brasero-session.c uses mkdtemp(), which is not a standard function
Status: RESOLVED FIXED
Product: brasero
Classification: Applications
Component: libbrasero-burn
2.30.x
Other Solaris
: Normal normal
: 2.26
Assigned To: Brasero maintainer(s)
Brasero maintainer(s)
Depends on: 118563
Blocks:
 
 
Reported: 2010-07-08 22:54 UTC by Tim Mooney
Modified: 2011-10-21 06:51 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Adding HAVE_MKDTEMP to configure.in (704 bytes, patch)
2010-10-04 11:28 UTC, Daniel Vergien
none Details | Review
Add mkdtemp fix to libbrasero-burn/Makefile.am (865 bytes, patch)
2010-10-04 11:30 UTC, Daniel Vergien
none Details | Review
Adding mkdtemp.h to libbrasero-burn/brasero-session.c (440 bytes, patch)
2010-10-04 11:31 UTC, Daniel Vergien
none Details | Review
mkdtemp implementation from gdm/gnu c library (5.20 KB, patch)
2010-10-04 11:32 UTC, Daniel Vergien
none Details | Review
mkdtemp.h implementation from gdm/gnu c library (1.55 KB, patch)
2010-10-04 11:33 UTC, Daniel Vergien
none Details | Review
use GLib g_mkdtemp() rather than mkdtemp() (773 bytes, patch)
2011-10-20 19:19 UTC, David King
committed Details | Review

Description Tim Mooney 2010-07-08 22:54:46 UTC
building brasero 2.30.2 on x86_64-sun-solaris2.10.

I get a link failure when building libbrasero-burn because brasero-session uses mkdtemp, which is not a standardized symbol (yet, it looks like it's due in the next X/Open standard).

I just hacked this into brasero-session.c to get around the problem:
 
#if defined(__sun)
char *mkdtemp(char * template) {
       if (!mktemp(template) || mkdir(template,0700))
               return NULL;
       return template;
}
#endif


Obviously that's not a good permanent fix.  If I add a HAVE_MKDTEMP autoconf check and wrap that function with that, would it be sufficient?
Comment 1 Luis Medinas 2010-07-09 09:32:56 UTC
I don't agree with adding HAVE_MKDTEMP conditional, solaris have any problem compiling brasero ?
Comment 2 Tim Mooney 2010-07-12 19:39:20 UTC
I'm not certain I understand the question.  Other than the fact that Solaris doesn't have mkdtemp so some type of replacement is needed, the rest of brasero compiles just fine on x86_64-sun-solaris2.10, and I'm using the Sun compiler suite, which is generally a little more picky than gcc.

I haven't yet tested how well brasero works, but with the exception of the missing mkdtemp(), it compiles fine.

So that I might understand, what's wrong with adding an autoconf check for mkdtemp() and providing a replacement function on platforms where mkdtemp is missing?
Comment 3 Philippe Rouquier 2010-07-17 13:52:25 UTC
Note to improve your patch slightly. Building on Solaris is already checked with  HAVE_USCSI_H which indicates that we are building against the Solaris SCSI interface; so you do not have to add another check at configure time.

The other problem (inherent to the use of mktemp ()) is that in between mktemp () and mkdir () a malicious app could create a directory or open file and "steal" the location... Not that it seems a big risk for brasero (I admit =)) which is not a big target for malicious code provided their programmers ever heard of it.
Comment 4 Daniel Vergien 2010-10-04 11:27:40 UTC
Checking if you compile on solaris is not a good idea, since opensolaris does have mkdtemp in the standard library. Adding a HAVE_MKDTEMP conditional seems the clean way to solve this. I attach patches against brasero-2.30.2. They are made the way the problem is solved in gdm.
Comment 5 Daniel Vergien 2010-10-04 11:28:46 UTC
Created attachment 171688 [details] [review]
Adding HAVE_MKDTEMP to configure.in
Comment 6 Daniel Vergien 2010-10-04 11:30:20 UTC
Created attachment 171689 [details] [review]
Add mkdtemp fix to libbrasero-burn/Makefile.am
Comment 7 Daniel Vergien 2010-10-04 11:31:04 UTC
Created attachment 171690 [details] [review]
Adding mkdtemp.h to libbrasero-burn/brasero-session.c
Comment 8 Daniel Vergien 2010-10-04 11:32:12 UTC
Created attachment 171691 [details] [review]
mkdtemp implementation from gdm/gnu c library
Comment 9 Daniel Vergien 2010-10-04 11:33:00 UTC
Created attachment 171692 [details] [review]
mkdtemp.h implementation from gdm/gnu c library
Comment 10 David Woodhouse 2011-05-09 10:12:49 UTC
This should be fixed in glib, not locally in every application that needs it.
Comment 11 Luis Medinas 2011-08-17 21:19:11 UTC
(In reply to comment #10)
> This should be fixed in glib, not locally in every application that needs it.

Sounds a better way but how should it be fixed in glib ? adding a new function providing mkdtemp ? Should we forward to glib maintainers ?
Comment 12 David King 2011-10-20 19:19:28 UTC
Created attachment 199572 [details] [review]
use GLib g_mkdtemp() rather than mkdtemp()

There is already g_mkdtemp(), which was added for GLib 2.26:

http://developer.gnome.org/glib/unstable/glib-File-Utilities.html#g-mkdtemp

The attached patch make Brasero use the GLib version, rather than a local implementation.
Comment 13 David King 2011-10-21 06:50:50 UTC
Comment on attachment 199572 [details] [review]
use GLib g_mkdtemp() rather than mkdtemp()

Pushed to master as commit 5f6524df57094b0fea5e3c55e5d79eef85b226a0.