Public bug reported:

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/intermediate/destfile
install: creating directory 'existingdest/intermediate'
'sourcefile' -> 'existingdest/intermediate/destfile'

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/intermediate/
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://github.com/coreutils/coreutils/blob/master/src/install.c to see
if there was something obvious I was missing, but their coding style is
not easy to read on a webpage.)

** Affects: coreutils (Ubuntu)
     Importance: Undecided
         Status: New

** Description changed:

- This is on 22.04.2, using coreutils 8.32-4.1ubuntu1.
+ 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:
+ 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/intermediate/destfile
  install: creating directory 'existingdest/intermediate'
  'sourcefile' -> 'existingdest/intermediate/destfile'
  
  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/intermediate/
  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://github.com/coreutils/coreutils/blob/master/src/install.c to see
  if there was something obvious I was missing, but their coding style is
  not easy to read on a webpage.)

-- 
You received this bug notification because you are a member of Ubuntu
Touch seeded packages, which is subscribed to coreutils in Ubuntu.
https://bugs.launchpad.net/bugs/2035233

Title:
  install:  -D ignores --owner/--group for intermediate directories

Status in coreutils package in Ubuntu:
  New

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/intermediate/destfile
  install: creating directory 'existingdest/intermediate'
  'sourcefile' -> 'existingdest/intermediate/destfile'

  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/intermediate/
  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://github.com/coreutils/coreutils/blob/master/src/install.c to
  see if there was something obvious I was missing, but their coding
  style is not easy to read on a webpage.)

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/coreutils/+bug/2035233/+subscriptions


-- 
Mailing list: https://launchpad.net/~touch-packages
Post to     : touch-packages@lists.launchpad.net
Unsubscribe : https://launchpad.net/~touch-packages
More help   : https://help.launchpad.net/ListHelp

Reply via email to