-
Notifications
You must be signed in to change notification settings - Fork 53
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
mkdir: suppress multiple errors for non-directory argument #893
Conversation
mknos
commented
Jan 2, 2025
- Previously if running "mkdir -p" and the 1st part of an argument is not a directory, the program would incorrectly call mkdir() on the intermediate paths under it
- If I have a regular file 0, "mkdir -p 0/1/2" would show 3 errors because of mkdir("0/1") and mkdir("0/1/2")
- Restructure the program so ARGV can remain as a list of directories (now we don't need the explanation comment for the old confusing code)
- For -p flag, split directory into parts, calling a create_dir() function for each part
- split_dir() handles the case where the 1st part is not a directory, and drops the sub-directory parts
* Previously if running "mkdir -p", and the 1st part of an argument is not a directory, the program would attempt to call mkdir() on the intermediate paths under it * So if I have regular file 0, "mkdir -p 0/1/2" would show 3 errors because of mkdir("0/1") and mkdir("0/1/2") * Restructure the program so ARGV can remain as a list of directories (now we don't need the explanation comment for the old confusing code) * For -p flag, split directory into parts, calling a create_dir() function for each part * split_dir() handles the case where the 1st part is not a directory, and drops the sub-directory parts %touch 0 %perl mkdir -p 0/1/2 00 aa/bb/cc mkdir: cannot create directory '0': File exists %find 00 aa # everything was created except for 0/... 00 aa aa/bb aa/bb/cc
Pull Request Test Coverage Report for Build 12578806958Warning: This coverage report may be inaccurate.This pull request's base commit is no longer the HEAD commit of its target branch. This means it includes changes from outside the original pull request, including, potentially, unrelated coverage changes.
Details
💛 - Coveralls |
Thanks for the suggestion. I added a new commit which rewrites split_dir() using File::Spec.
|
changes: suppress multiple errors for non-directory argument |