Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

zsh/files.so: `mkdir -p' fails on symlinks



Hello,

I've got a bug report on built-in mkdir command:
https://bugzilla.altlinux.org/show_bug.cgi?id=7368

$ mkdir dir
$ mkdir dir/subdir
$ ln -s dir dirp
$ zmodload zsh/files
$ which mkdir
mkdir: shell built-in command
$ mkdir -p dirp/subdir/subdir2
mkdir: cannot make directory `dirp': file exists
$ /bin/mkdir -p dirp/subdir/subdir2
$

Proposed fix is as follows:

--- zsh-4.3.0-20050712/Src/Modules/files.c-	2004-10-19 19:09:50 +0000
+++ zsh-4.3.0-20050712/Src/Modules/files.c	2005-07-15 06:55:52 +0000
@@ -127,7 +127,7 @@ domkdir(char *nam, char *path, mode_t mo
     if(p) {
 	struct stat st;
 
-	if(!lstat(rpath, &st) && S_ISDIR(st.st_mode))
+	if(!stat(rpath, &st) && S_ISDIR(st.st_mode))
 	    return 0;
     }
     oumask = umask(0);
End of patch

-- 
Alexey Tourbin
ALT Linux Team

Attachment: pgpg4ozcqMVd5.pgp
Description: PGP signature



Messages sorted by: Reverse Date, Date, Thread, Author