Subject: pkg/11633: [rkb] librep trips over mkdir(2) with trailing slash failure
To: None <firstname.lastname@example.org>
From: None <email@example.com>
Date: 12/04/2000 12:07:14
>Synopsis: librep trips over mkdir(2) with trailing slash failure
>Arrival-Date: Mon Dec 04 12:07:00 PST 2000
>Release: pkgsrc CVS'ed 12/03/00 23:00EST
System: NetBSD cyclops.metatel.office 1.5L NetBSD 1.5L (CYCLOPS.4MB) #4: Mon Dec 4 00:08:38 EST 2000 firstname.lastname@example.org:/extra/src-current/sys/arch/i386/compile/CYCLOPS.4MB i386
librep's rep_make_directory (which is the C worker invoked by the lisp
`make-directory' function), falls over if passed a directory ending
with a slash [see the thread on mkdir(2)'s behaviour on the lists in
the recent past for the complete story 8-)].
Unfortunately, librep and its' users tend to do the following:
(make-directory (file-name-directory "/etc/passwd"))
Which ends up calling (make-directory "/etc/"), and this ends up
This is particularly nasty in the sawfish window manger, which beeps
at you everytime it fails to create the ~/.sawfish/ directory for its
configuration data. It generally isn't clear where the beeping is
coming from and it's annoying as hell.
Build sawfish and its' dependencies. Run sawfish for the first time
and try and change some of the configuration. Notice that each time
you invoke the WM in some manner something beeps your PC speaker.
Turn off all the sound-related options and find that it's still
Consider opening up the PC and ripping out the speaker.
Finally, ktruss the sawfish process and notice it's failing to create
~/.sawfish/. Once it's created by hand the beeping stops... And there
was much rejoicing!
Put 2 and 3 together to get 42 and figure the beeping on your speaker
must be caused by the mkdir(2) failure!
Add the following patch to librep's patches:
--- src/unix_files.c.orig Mon Dec 4 14:32:31 2000
+++ src/unix_files.c Mon Dec 4 14:38:06 2000
@@ -286,6 +286,12 @@
+ int len = rep_STRING_LEN(dir);
+ /* Trim trailing '/' to mkdir(2) since some OSes fail the call otherwise */
+ if (*(rep_STR(dir) + len - 1) == '/')
+ dir = rep_string_dupn(rep_STR(dir), len - 1);
if(mkdir(rep_STR(dir), S_IRWXU | S_IRWXG | S_IRWXO) == 0)