install: -D ignores --owner/--group for intermediate directories
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
coreutils (Ubuntu) |
New
|
Undecided
|
Unassigned |
Bug Description
This is on 22.04.3, using coreutils 8.32-4.1ubuntu1.
We're wanting to populate an existing home directory with some starting example files. The system will be running on an AWS EC2 instance, so I'll use their default username "ubuntu" for this example:
# touch sourcefile
# mkdir -m 0755 existingdest
# chown ubuntu:ubuntu existingdest
We use install(1) to do the copying, permission and ownership management, and creating intermediate directories with its -D option:
# install -vD --owner=ubuntu --group=ubuntu --mode=0644 sourcefile existingdest/
install: creating directory 'existingdest/
'sourcefile' -> 'existingdest/
That part looks good, however...
# ls -lFd existingdest
drwxr-xr-x 3 ubuntu ubuntu 4096 Sep 12 15:54 existingdest/
# ls -lF existingdest
total 4
drwxr-xr-x 2 root root 4096 Sep 12 15:54 intermediate/
# ls -lF existingdest/
total 0
-rw-r--r-- 1 ubuntu ubuntu 0 Sep 12 15:54 destfile
...while the pre-existing directory was left alone (correct) and the newly-created file has the specified ownership and permissions (also correct), the intermediate directories it created are still owned by root.
I would not expect the creation of 'intermediate' to use the specified --mode because a directory with 0644 would be hilariously unhelpful. I would, however, expect the given --owner and --group to have played a part. That they didn't is violating the Law of Least Surprise, at least to me; if this isn't a bug, it should at least be documented.
(I tried looking around https:/
description: | updated |