[KLUG Members] RE: Re: A [simple?] question (Robert G. Brown)

Bruce Smith members@kalamazoolinux.org
Tue, 25 May 2004 08:55:44 -0400


> There does not seem to be any substantial disagreement with the notion that
> it is a good, safe, and normal practice to presume that the umask will be 
> the controlling factor in determining how permissions are set for newly
> created files.
> 
> There have been two exceptions noted, one for cp and another for tar; both of
> these are reasonable and ordinary exceptions needed for file management, but
> they are not typical of most applications.
> 
> Are there some additional remarks anyone cares to add to the above?

Technically there not any exceptions to the umask rule.

Some programs like cp/tar may call chmod(2) to change the defaults 
after the file is created (with the umask rule).

Digression follows:  (replies to advocacy please)   :-)

The one thing that impressed me after learning Unix, was how consistent
Unix was compared to MSDOS.  Everything low level in Unix follows strict
rules, without exception, and anything that _seems_ like an exception
can be logically explained (like cp/tar above).  This was especially
refreshing when using the command line compared to DOS, where sometimes
an argument was a file, and other times it was not, and exceptions were
based on the name of the file!   i.e.  If you do the following command
in Unix:  "cp infile lpr"  both arguments are ALWAYS filenames.  In this
case it copied "infile" to the name named "lpr".  You don't have to
worry about "lpr" being a special name and having it go to a printer
port instead of a file (like a similar command in DOS behaves).

Some people disagree with me on the consistency issue, with the argument
that Unix commands are not consistent, using the commands "cp" & "dd" as
an example.  And they have a point that not all commands use the same
syntax, but I can live with that since I need to learn any command's
syntax before I can use it.  My consistency concerns go much deeper,
into the shell and deeper.

</digress>

 - BS