Closed IronCore864 closed 4 months ago
Manual test results:
Tests | Before | After |
---|---|---|
mkdir ~/normal | 755, same user/group as pebble, exist not ok | same behaviour |
mkdir -p ~/nested/folder; mkdir -p ~/nested1 | 755, parent/child both the same user/group as pebble, exist ok | same behaviour |
mkdir ~/normal-chown --user test --group test | 755, user/group changed exist not ok, error: rename /root/normal-chown.mkdir-new /root/normal-chown: file exists | same behaviour, better error msg: error: mkdir /root/normal-chown: file exists |
mkdir -p ~/nested1/folder-chown --user test --group test | 755, parent/child user/group both changed, exist OK | same behaviour |
Implement a unified
osutil.Mkdir
API, refactor existingosutil.MkdirChown
andosutil.MkdirAllChown
.Closes #372.
Background
There is an issue (372) where umask settings would affect the permissions of the newly created directories.
There was originally a PR to implement the feature (see here), but the code became even more complicated. As per our discussion (see here), we decide to refactor Mkdir and implement the required feature.
The original PR was closed, using this one instead. This PR only refactors the existing code, the support for chmod will come in a separate PR.
Spec
See here.
API
Options
Manual Tests