-
Notifications
You must be signed in to change notification settings - Fork 60
Open
Description
Steps to reproduce:
ln -s nonexists alink.nonexistsis a non-existing file.- Create a clean task
cleanBrokenLink: ['alink']and run it. The output should be:Running "clean:cleanBrokenLink" (clean) task >> 1 path cleaned. ls -l alinkoutput:alink -> nonexists, showing thatalinkis not cleaned.
Note that broken symlinks could show up easily when cleaning a dir containing symlinks: if a link target was removed before the link is tried to remove, the link becomes broken.
Root cause: clean() in tasks/clean.js tests a filepath with grunt.file.exists() before trying to remove it, but grunt.file.exists() return false for a broken symbolic link (because of fs.exists() it calling), so clean() skips to remove it.
Possible solution: replace grunt.file.exists() with a fs.lstatSync() based solution, because it doesn't follow links. Additionally, grunt.file.isPathInCwd() also suffers from broken-symbolic-link problem.
Metadata
Metadata
Assignees
Labels
No labels