Subject: bug#11043: chmod - new feature - restore default mode regarding the umask value

From: Julien Blitte <[email-masked]>
Date: Sun, 18 Mar 2012 21:31:02 +0100

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