cp preserves mode with --no-preserve=mode

Bug #379233 reported by ceg
12
This bug affects 2 people
Affects Status Importance Assigned to Milestone
coreutils
New
Undecided
auto-bug-coreutils
coreutils (Debian)
Fix Released
Unknown
coreutils (Ubuntu)
Fix Released
Undecided
Unassigned

Bug Description

Binary package hint: coreutils

Example: copying files from CD/vfat/etc. into the filesystem.

The files (all) will keep their executable bit and stay read only.

Even with the --no-preserver=mode option the current umask is ignored (or only used in a substracting way when creating the new copy), instead of using the umask for newly created files.

Tags: patch udd-find
Revision history for this message
C de-Avillez (hggdh2) wrote :

Thank you for opening this bug and helping make Ubuntu better. Can you please state your Ubuntu and coreutils versions?

Also, can you please show an example?

Changed in coreutils (Ubuntu):
status: New → Incomplete
Revision history for this message
ceg (ceg) wrote :

Hi there, it's now a vfat fs plugged into a 9.10 system:
ii coreutils 7.4-2ubuntu1 The GNU core utilities

$ ls -l /media/USB/
-rwxr-xr-x 1 test.txt1
-rwxr-xr-x 1 test.txt2

$ cp /media/USB/test.txt1 .
$ ls -l
-rwxr-xr-x 1 test.txt1

$ cp --no-preserve=mode /media/USB/test.file2 .
$ ls -l
-rwxr-xr-x 1 test.txt1
-rwxr-xr-x 1 test.txt2

With --no-preserve I'd expect the new file to have the same permissions as a newly created file (umask dependent) but this is not the case.

Revision history for this message
C de-Avillez (hggdh2) wrote :

Thank you. Now, the only thing missing is your umask ;-)

I do not have, right now, a vfat I can mount & test -- will find where I stowed one, I *know* I should have it. I tested under an etx4, and it works as expected.

Revision history for this message
ceg (ceg) wrote :

yeah, right a umask setting the exec bit ;-)

Changed in coreutils (Ubuntu):
status: Incomplete → Confirmed
tags: added: udd-find
Changed in coreutils (Debian):
status: Unknown → New
Revision history for this message
ceg (ceg) wrote :

Regarding comments in debbugs #488024

cp --no-preserve=mode ... should be different to cp ...! This is really a bug, because the option does not create the new copy with standard new file permission (not preserving the mode of the original file).

This --no-preserve=mode is a standard use case, for example, when copying files from an iso CD (all "executable") to a filesystem with more attributes.

Revision history for this message
ceg (ceg) wrote :

Attatched the patch from Jim Meyering

tags: added: patch
Changed in coreutils (Debian):
status: New → Fix Released
Revision history for this message
Colin Watson (cjwatson) wrote :

This appears to be fixed in 8.20, now on its way into raring. From the NEWS file:

  cp --no-preserve=mode now no longer preserves the original file's
  permissions but correctly sets mode specified by 0666 & ~umask

Changed in coreutils (Ubuntu):
status: Confirmed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.