diff --git a/SC2174.md b/SC2174.md new file mode 100644 index 0000000..11b6b4b --- /dev/null +++ b/SC2174.md @@ -0,0 +1,13 @@ +## -m will be ignored for parent directories + +### Problematic code: + +```sh +mkdir -p -m 0755 foo/bar/baz +``` + +### Rationale: + +When using `-m 0755`, the mode of the directory created will be set to 0755. When using `-p`, parent directories which do not exist will be created, but the mode specified by `-m` will only be used on the non-parent directory. The parent directories will get their access mode the default way, via [umask(2)]. + +[umask(2)]: http://man7.org/linux/man-pages/man2/umask.2.html \ No newline at end of file