GNU bug report logs - #11043
chmod - new feature - restore default mode regarding the umask value

Previous Next

Package: coreutils;

Reported by: Julien Blitte <julien.blitte <at> gmail.com>

Date: Mon, 19 Mar 2012 07:47:02 UTC

Severity: normal

Tags: fixed

Done: Assaf Gordon <assafgordon <at> gmail.com>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 11043 in the body.
You can then email your comments to 11043 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-coreutils <at> gnu.org:
bug#11043; Package coreutils. (Mon, 19 Mar 2012 07:47:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Julien Blitte <julien.blitte <at> gmail.com>:
New bug report received and forwarded. Copy sent to bug-coreutils <at> gnu.org. (Mon, 19 Mar 2012 07:47:03 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Julien Blitte <julien.blitte <at> gmail.com>
To: bug-coreutils <at> gnu.org
Subject: chmod - new feature - restore default mode regarding the umask value
Date: Sun, 18 Mar 2012 21:31:02 +0100
[Message part 1 (text/plain, inline)]
Hello,

I have used for a while a modified chmod for my own use, I think it could
be usefull to other people.
The option --umask is added to chmod to be used in order to restore default
mode to files and directories regarding the current umask value.

Attached, the up to date implementation (git format-patch)  for last
version of coreutils and gnulib.
It save some time for me.

Some use cases for this feature:
You have just changed your umask value and you want to update your home's
files:
$ umask 0027
$ chmod --umask --recursive ~

You are a beginer, you have performed mode changes - a mistake - a and you
want to restore default mode:
$ chmod 3106 my_file.ext
$ chmod --umask my_file.ext

You copied data from on other file system (e.g. usb key, ntfs) witch does
not support rigths
(and you forgot to mount with correct fmask / dmask options):
$ cp -R /media/usb/data_dir/ ~
$ chmod --umask --recursive ~/data_dir/

You are a system administrator and you want to reset users' files:
# umask 0022
# chmod --umask --recursive ~/home/*

etc.

Regards,
-- 
Julien Blitte
[Message part 2 (text/html, inline)]
[chmod-umask-coreutils.patch.gz (application/x-gzip, attachment)]
[chmod-umask-gnulib.patch.gz (application/x-gzip, attachment)]

Information forwarded to bug-coreutils <at> gnu.org:
bug#11043; Package coreutils. (Mon, 19 Mar 2012 15:27:02 GMT) Full text and rfc822 format available.

Message #8 received at 11043 <at> debbugs.gnu.org (full text, mbox):

From: Paul Eggert <eggert <at> cs.ucla.edu>
To: Julien Blitte <julien.blitte <at> gmail.com>
Cc: 11043 <at> debbugs.gnu.org
Subject: Re: bug#11043: chmod - new feature - restore default mode regarding
	the umask value
Date: Mon, 19 Mar 2012 07:56:15 -0700
Isn't the proposed "chmod --umask FILES" almost the
same as "chmod a=,+rwX FILES"?  If so, perhaps all we need
to do is to update the documentation to mention this
already-standardized solution to a common problem.




Information forwarded to bug-coreutils <at> gnu.org:
bug#11043; Package coreutils. (Tue, 20 Mar 2012 14:26:02 GMT) Full text and rfc822 format available.

Message #11 received at 11043 <at> debbugs.gnu.org (full text, mbox):

From: Julien Blitte <julien.blitte <at> gmail.com>
To: Paul Eggert <eggert <at> cs.ucla.edu>
Cc: 11043 <at> debbugs.gnu.org
Subject: Re: bug#11043: chmod - new feature - restore default mode regarding
	the umask value
Date: Tue, 20 Mar 2012 14:54:50 +0100
[Message part 1 (text/plain, inline)]
Hello,

You are right.
To be exact, it's the same as "chmod a=,-s,+rwX FILES" (to handle
directories SGID and SUID also).
Then, these patchs are not usefull, but yes, a few lines more - with this
example - in documentation would help some guys like me.

Thanks,
Julien


Le 19 mars 2012 15:56, Paul Eggert <eggert <at> cs.ucla.edu> a écrit :

> Isn't the proposed "chmod --umask FILES" almost the
> same as "chmod a=,+rwX FILES"?  If so, perhaps all we need
> to do is to update the documentation to mention this
> already-standardized solution to a common problem.
>
[Message part 2 (text/html, inline)]

Information forwarded to bug-coreutils <at> gnu.org:
bug#11043; Package coreutils. (Tue, 27 Mar 2012 16:27:01 GMT) Full text and rfc822 format available.

Message #14 received at 11043 <at> debbugs.gnu.org (full text, mbox):

From: Paul Eggert <eggert <at> cs.ucla.edu>
To: Julien Blitte <julien.blitte <at> gmail.com>
Cc: 11043 <at> debbugs.gnu.org
Subject: Re: bug#11043: chmod - new feature - restore default mode regarding
	the umask value
Date: Tue, 27 Mar 2012 08:54:04 -0700
Here's a proposed patch to document the
already-existing feature on this point.

From 2defd3856672bacf5c422e616625f13e3a56d9e9 Mon Sep 17 00:00:00 2001
From: Paul Eggert <eggert <at> cs.ucla.edu>
Date: Tue, 27 Mar 2012 08:52:20 -0700
Subject: [PATCH] doc: add chmod examples

* doc/coreutils.texi (chmod invocation): Add examples.
---
 doc/coreutils.texi |   18 ++++++++++++++++++
 1 files changed, 18 insertions(+), 0 deletions(-)

diff --git a/doc/coreutils.texi b/doc/coreutils.texi
index 835c245..da1ecc5 100644
--- a/doc/coreutils.texi
+++ b/doc/coreutils.texi
@@ -10299,6 +10299,24 @@ Recursively change permissions of directories and their contents.
 
 @exitstatus
 
+Examples:
+
+@smallexample
+# Change file permissions of FOO to be world readable
+# and user writable, with no other permissions.
+chmod 644 foo
+chmod a=r,u+w foo
+
+# Add user and group execute permissions to FOO.
+chmod +110 file
+chmod ug+x file
+
+# Set file permissions of DIR and subsidiary files to
+# be the umask default, assuming execute permissions for
+# directories and for files already executable.
+chmod -R a=,+rwX dir
+@end smallexample
+
 
 @node touch invocation
 @section @command{touch}: Change file timestamps
-- 
1.7.6.5





Information forwarded to bug-coreutils <at> gnu.org:
bug#11043; Package coreutils. (Mon, 15 Oct 2018 16:30:02 GMT) Full text and rfc822 format available.

Message #17 received at 11043 <at> debbugs.gnu.org (full text, mbox):

From: Assaf Gordon <assafgordon <at> gmail.com>
To: Paul Eggert <eggert <at> cs.ucla.edu>
Cc: 11043 <at> debbugs.gnu.org
Subject: Re: bug#11043: chmod - new feature - restore default mode regarding
 the umask value
Date: Mon, 15 Oct 2018 10:28:56 -0600
(triaging old bugs)

On 27/03/12 09:54 AM, Paul Eggert wrote:
> Here's a proposed patch to document the
> already-existing feature on this point.

Seems like the patch in https://bugs.gnu.org/11043#14
was ready but never committed.

OK to commit?

-assaf






Information forwarded to bug-coreutils <at> gnu.org:
bug#11043; Package coreutils. (Mon, 15 Oct 2018 23:57:01 GMT) Full text and rfc822 format available.

Message #20 received at 11043 <at> debbugs.gnu.org (full text, mbox):

From: Paul Eggert <eggert <at> cs.ucla.edu>
To: Assaf Gordon <assafgordon <at> gmail.com>
Cc: 11043 <at> debbugs.gnu.org
Subject: Re: bug#11043: chmod - new feature - restore default mode regarding
 the umask value
Date: Mon, 15 Oct 2018 16:55:55 -0700
On 10/15/18 9:28 AM, Assaf Gordon wrote:
> On 27/03/12 09:54 AM, Paul Eggert wrote:
>> Here's a proposed patch to document the
>> already-existing feature on this point.
>
> Seems like the patch in https://bugs.gnu.org/11043#14
> was ready but never committed.
>
> OK to commit? 

Yes, and thanks.





Information forwarded to bug-coreutils <at> gnu.org:
bug#11043; Package coreutils. (Wed, 17 Oct 2018 21:46:02 GMT) Full text and rfc822 format available.

Message #23 received at 11043 <at> debbugs.gnu.org (full text, mbox):

From: Assaf Gordon <assafgordon <at> gmail.com>
To: Paul Eggert <eggert <at> cs.ucla.edu>, 11043 <at> debbugs.gnu.org
Subject: Re: bug#11043: chmod - new feature - restore default mode regarding
 the umask value
Date: Wed, 17 Oct 2018 15:45:31 -0600
tags 11043 fixed
close 11043
stop

On 15/10/18 05:55 PM, Paul Eggert wrote:
> On 10/15/18 9:28 AM, Assaf Gordon wrote:
>> On 27/03/12 09:54 AM, Paul Eggert wrote:
>>> Here's a proposed patch to document the
>>> already-existing feature on this point.
>>
>> Seems like the patch in https://bugs.gnu.org/11043#14
>> was ready but never committed.
>>
>> OK to commit? 
> 
> Yes, and thanks.
> 

Pushed here:
https://git.savannah.gnu.org/cgit/coreutils.git/commit/?id=4d5db7193c956a8fc33b57456cf51d7bca17e586




Added tag(s) fixed. Request was from Assaf Gordon <assafgordon <at> gmail.com> to control <at> debbugs.gnu.org. (Wed, 17 Oct 2018 21:46:02 GMT) Full text and rfc822 format available.

bug closed, send any further explanations to 11043 <at> debbugs.gnu.org and Julien Blitte <julien.blitte <at> gmail.com> Request was from Assaf Gordon <assafgordon <at> gmail.com> to control <at> debbugs.gnu.org. (Wed, 17 Oct 2018 21:46:03 GMT) Full text and rfc822 format available.

bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Thu, 15 Nov 2018 12:24:05 GMT) Full text and rfc822 format available.

This bug report was last modified 5 years and 164 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.