Bug 7368 - mkdir -p builtin fails when a part of the path is a symlink
Summary: mkdir -p builtin fails when a part of the path is a symlink
Status: CLOSED FIXED
Alias: None
Product: Sisyphus
Classification: Development
Component: zsh (show other bugs)
Version: unstable
Hardware: all Linux
: P2 normal
Assignee: Fr. Br. George
QA Contact: qa-sisyphus
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-07-14 23:04 MSD by Fr. Br. George
Modified: 2005-08-26 12:10 MSD (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Fr. Br. George 2005-07-14 23:04:50 MSD
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 at@altlinux.org 2005-07-21 23:35:59 MSD
Fixed in zsh-4.3.0-alt0.2.