URL: <http://savannah.gnu.org/bugs/?27146>
Summary: cp --no-preserve=mode is counter-intuitive Project: GNU Core Utilities Submitted by: None Submitted on: Чтв 30 Июл 2009 23:57:13 Category: None Severity: 3 - Normal Item Group: None Status: None Privacy: Public Assigned to: None Open/Closed: Open Discussion Lock: Any _______________________________________________________ Details: Currently cp option --no-preserve=mode behavior is counter-intuitive. What one would expect is that --no-preserve=mode should set mode to (0666 & ~umask). See below for a shell transcript (coreutils 7.4). $ umask 0002 $ mkdir 1 $ cd 1 $ touch file1 $ ls -l total 0 -rw-rw-r-- 1 grib grib 0 Jul 19 21:48 file1 $ touch ../file2 $ chmod 0644 ../file2 $ ls -l ../file2 -rw-r--r-- 1 grib grib 0 Jul 19 21:48 ../file2 $ cp ../file2 . $ cp --no-preserve=all ../file2 ./file2-no-preserve-all $ ls -l total 0 -rw-rw-r-- 1 grib grib 0 Jul 19 21:48 file1 -rw-r--r-- 1 grib grib 0 Jul 19 21:50 file2 -rw-r--r-- 1 grib grib 0 Jul 19 21:50 file2-no-preserve-all There is a usecase for behavior I'm requesting (but I can't think of a usecase for current behavior). For example, a shared directory on a multiuser computer could set-group-id and owned by group users. If appropriate umask value (0002) is used, then all new files created in the shared directory would be owned by group users and group-writable. All new directories would be set-group-id. But files copied (with cp) to the shared directory won't get such treatment. It would be great if cp --no-preserve=mode set new file's mode like for plain new files (e. g. created with touch). Then cp --no-preserve=mode could be used to copy files to the shared directory. There is a couple of discussions on this topic, so I'm not alone in thinking that current behavior makes little sense. [1] http://lists.gnu.org/archive/html/bug-coreutils/2003-02/msg00033.html [2] http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=488024 [3] https://bugs.launchpad.net/ubuntu/+source/coreutils/+bug/144024 [4] http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=402332 [5] http://karapuz.habrahabr.ru/blog/64868/ Excuse me for linking [5], it is in Russian, but it describes the options to create a shared directory on a Linux computer. Because cp doesn't support behavior I'm requesting, the author had to conclude that the only working solution is fam (monitoring new files and changing their permissions). _______________________________________________________ Reply to this item at: <http://savannah.gnu.org/bugs/?27146> _______________________________________________ Message sent via/by Savannah http://savannah.gnu.org/ _______________________________________________ Bug-coreutils mailing list Bug-coreutils@gnu.org http://lists.gnu.org/mailman/listinfo/bug-coreutils