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 106117 - Trailing slashes should not be used when creating directories
Trailing slashes should not be used when creating directories
Status: RESOLVED FIXED
Product: libgnome
Classification: Deprecated
Component: general
HEAD
Other All
: Normal normal
: ---
Assigned To: libgnome maintainer
libgnome maintainer
Depends on:
Blocks:
 
 
Reported: 2003-02-14 21:53 UTC by Julio Merino
Modified: 2004-12-22 21:47 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
This is the patch currently used in pkgsrc (using a function to create directories). (1.87 KB, patch)
2003-05-18 17:32 UTC, Julio Merino
none Details | Review
Patch that makes the compatibility mkdir function static. (1.27 KB, patch)
2004-02-13 12:06 UTC, Julio Merino
none Details | Review
Fix which I'm going to commit (2.97 KB, patch)
2004-05-02 10:27 UTC, Anders Carlsson
none Details | Review

Description Julio Merino 2003-02-14 21:53:01 UTC
When libgnome tries to create the directories specified in the GNOME_DOT_GNOME and GNOME_DOT_GNOME_PRIVATE macros, it passes a trailing slash to the mkdir(2) function. This trailing slash causes problems in some OSes, specially in NetBSD, which are unable to create a directory if a trailing slash is passed.

libgnome must be fixed in a way that this trailing slash is not passed to the mkdir(2) function.

Note that this may be fixed in NetBSD itself (which will be difficult). Fixing it in libgnome is the best solution as it will benefit other operating systems and work in older (unmaintained) versions of NetBSD.
Comment 1 Kjartan Maraas 2003-05-18 10:55:40 UTC
Havoc, are there issues with removing the trailing slashes from the
two defines in gnome-init.h?
Comment 2 Havoc Pennington 2003-05-18 17:15:32 UTC
Yes, it could break code using those macros
("GNOME_DOT_GNOME"session" is currently a valid filename)
Comment 3 Julio Merino 2003-05-18 17:32:40 UTC
Created attachment 16609 [details] [review]
This is the patch currently used in pkgsrc (using a function to create directories).
Comment 4 Julio Merino 2003-05-18 17:36:02 UTC
It may be interesting to implement the funcion proposed in bug #106160
(glib) in order to fix this one.
Comment 5 Jeffrey Stedfast 2003-07-24 02:56:36 UTC
note that this function should be declared 'static' or the symbol will
be exported and I don't think we want that.
Comment 6 Kjartan Maraas 2004-01-18 22:16:21 UTC
Is this ok with Jeff's suggested change?
Comment 7 Julio Merino 2004-02-13 11:47:21 UTC
It seems ok to me (declaring the function static).  I didn't do so 
because it's beeing used in two source files.  But solving this is 
simple: either duplicate it (ugly) or write it alone in its own 
source file and later '#include' that from multiple places... 
Comment 8 Julio Merino 2004-02-13 12:06:39 UTC
Created attachment 24382 [details] [review]
Patch that makes the compatibility mkdir function static.
Comment 9 Kjartan Maraas 2004-03-25 13:14:33 UTC
Ok. So the glib suggestion was closed as WONTFIX and a comment that calling
mkdir(2) with trailing slashes was bad behaviour. Is libgnome still doing this
and can we fix it in a sane way?
Comment 10 Anders Carlsson 2004-05-02 10:15:33 UTC
Looks to me like the code in libgnome_userdir_setup already chops off the
trailing slash before calling mkdir. Closing this as fixed.
Comment 11 Anders Carlsson 2004-05-02 10:16:57 UTC
No wait, it only does that if it's been overriden through the GNOME22_USER_DIR
environment variable.
Comment 12 Anders Carlsson 2004-05-02 10:27:10 UTC
Created attachment 27295 [details] [review]
Fix which I'm going to commit

I did something similar, about to commit it in a second.
Comment 13 Anders Carlsson 2004-05-02 10:27:50 UTC
OK, I've committed it.