Bug 7368 - mkdir -p builtin fails when a part of the path is a symlink
: mkdir -p builtin fails when a part of the path is a symlink
Status: CLOSED FIXED
: Sisyphus
(All bugs in Sisyphus/zsh)
: unstable
: all Linux
: P2 normal
Assigned To:
:
:
:
:
:
  Show dependency tree
 
Reported: 2005-07-14 23:04 by
Modified: 2005-08-26 12:10 (History)


Attachments


Note

You need to log in before you can comment on or make changes to this bug.


Description From 2005-07-14 23:04:50
Zsh have "files" plugin includeing "mkdir" buiiltin.
When using mkdir -p then, the builtin version fails on partially symlik-ed path.
E. g. when /home  is symlink-> /var/home, any first completion spams a
"_store_cache:mkdir:16: cannot make directory `/home': file exists" message when
trying to create $HOME/.zcompcache.

Look at this part of zsh-4.3.0-20050611/Src/Modules/files.c:

    121 domkdir(char *nam, char *path, mode_t mode, int p)
    122 {
    123     int err;
    124     mode_t oumask;
    125     char const *rpath = unmeta(path);
    126 
    127     if(p) {
    128         struct stat st;
    129 
    130         if(!lstat(rpath, &st) && S_ISDIR(st.st_mode))
    131             return 0;
    132     }

Here must be "stat" instead of "lstat", mustn't it?
Steps to Reproduce:
0. mv /home /var/home; ln -s /var/home /home # do it carefully :)
1. rm -rf ~/.zcompcache
2. apt-cache search a<TAB>

Actual Results:  
see message, no ~/.zcompcache is created

Expected Results:  
see no messages, ~/.zcompcache is created
------- Comment #1 From 2005-07-21 23:35:59 -------
Fixed in zsh-4.3.0-alt0.2.