Wrong permissions on directories when invoking `uu-install -Dm644`
Issue
The uu-install implementation handles the argument combination of -Dm644 which is commonly use in C/C++ install tools differently then coreutils.
The uu-install implementation sets the -m644 permissions on the directories it creates and fails to copy the file as the execute bit is mentioning on the directories.
Meanwhile, install creates directories with 755 and then creates the final file with 644 permissions as specified.
Example test cases
uutils
$ /usr/bin/uu-install --version
/usr/bin/uu-install 0.0.17
$ /usr/bin/uu-install -Dm644 file.txt uutils644/a/b/c/d
/usr/bin/uu-install: cannot install 'file.txt' to 'uutils644/a/b/c/d': Permission denied
$ exa --no-user -l --tree uu*
drwxr-xr-x - 13 Feb 17:34 uutils644
drwxr-xr-x - 13 Feb 17:34 └── a
drwxr-xr-x - 13 Feb 17:34 └── b
drw-r--r-- - 13 Feb 17:34 └── c
$ /usr/bin/install --version | head -n1
install (GNU coreutils) 9.1
$ /usr/bin/install -Dm644 file.txt core644/a/b/c/d
$ exa --no-user -l --tree core*
drwxr-xr-x - 13 Feb 17:36 core644
drwxr-xr-x - 13 Feb 17:36 └── a
drwxr-xr-x - 13 Feb 17:36 └── b
drwxr-xr-x - 13 Feb 17:36 └── c
.rw-r--r-- 0 13 Feb 17:36 └── d
It appears the default behavior without -m644 matches coreutils as expected:
$ /usr/bin/uu-install -D file.txt uutils/a/b/c/d
$ exa --no-user -l --tree uu*
drwxr-xr-x - 13 Feb 17:34 uutils
drwxr-xr-x - 13 Feb 17:34 └── a
drwxr-xr-x - 13 Feb 17:34 └── b
drwxr-xr-x - 13 Feb 17:34 └── c
.rwxr-xr-x 0 13 Feb 17:34 └── d
$ /usr/bin/install -Dm644 file.txt core644/a/b/c/d
$ exa --no-user -l --tree core*
drwxr-xr-x - 13 Feb 17:36 core
drwxr-xr-x - 13 Feb 17:36 └── a
drwxr-xr-x - 13 Feb 17:36 └── b
drwxr-xr-x - 13 Feb 17:36 └── c
.rwxr-xr-x 0 13 Feb 17:36 └── d
Thanks for the clear report!
Found another issue that's probably related, I can create another issue if you like or update the description.
Running install -o $UID -g $GID -d dir/a/b fails to set the permissions on the final directory (b) in this case.
Arch Linux uses this in makechrootpkg which is broken by this. Code for usage is here.
$ sudo /usr/bin/install -o 1000 -g 1000 -d core/a/b
$ sudo /usr/bin/uu-install -o 1000 -g 1000 -d uu/a/b
$ exa -lng --tree core uu
drwxr-xr-x - 0 0 13 Feb 18:28 core
drwxr-xr-x - 0 0 13 Feb 18:28 └── a
drwxr-xr-x - 1000 1000 13 Feb 18:28 └── b
drwxr-xr-x - 0 0 13 Feb 18:28 uu
drwxr-xr-x - 0 0 13 Feb 18:28 └── a
drwxr-xr-x - 0 0 13 Feb 18:28 └── b
Note that coreutils implementation sets the requested permissions of core/a/b to the uid+gid passed in but uu-install does not.
It's probably a slightly different codepath so I think a separate issue makes sense. Thanks!
Created #4361 to track the -o -g -d issue.