git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: Default "tar" umask..

From
Junio C Hamano <junkio@cox.net>
Date
Jan 5, 2007, 22:15 UTC
Message-ID
<7vmz4xdssh.fsf@assigned-by-dhcp.cox.net>
In-Reply-To
<Pine.LNX.4.64.0701051336000.3661@woody.osdl.org>
Linus Torvalds <torvalds@osdl.org> writes:
Show 7 quoted lines
> On Fri, 5 Jan 2007, Junio C Hamano wrote:
>> ...
>> On the other hand, I can explain 002 fairly easily and
>> consistently.
>
> No you can't. 002 makes no sense at all in a very common old-fashioned 
> setup with a "user" group. 
I do not think so (see below).
Show 7 quoted lines
> Maybe I'm old, and these days most setups seem to give people their own 
> group (so I'm "torvalds:torvalds" on all the machines I have access to), 
> but it used to be _very_ common to have just a "user" group that all 
> normal users were part of (or have the default gid depend on something 
> like which department you are in).
>
> In that situation, 002 is really effectively no different at all from 000.

I remember those days. People had 022 umask for that exact reason, as you said, in such a setup. It was quite common. On the other hand, modern setups often use "own" group and people often use 002 umask.

If you extract as a normal user (i.e. without -p) then 002 is
really effectively no different at all from 000 because umask
kicks in and give the results the user would expect in either
setups, which is good.  In "user" group setup, umask 022 makes
files to 0644, in "own" group setup, umask 002 makes files to
0664.  All is good.  If the archive is made with 022, that would
break expectation of users whose umask is 002 (a sane value in
modern "own" group setups).

The current 000 was bad for users who work as root and do not know about implied -p (which is not their fault). When extracting as root, the files and directories are owned by 'root' and its group.

Even in the old "user" group setups, I _thought_ the root was in his own group or wheel in BSD, and the group was not shared with Joe Random users, so if that is the case, group writability is not an problem. In the modern "own" group setups, the root user is in its own his group 'root', so group writability is not an issue either.

Show 5 quoted lines
> 022 really is very easy to explain: "readability (and executability) is a 
> lot less dangerous than writability, and by default we only give 
> writability to the user". That's why we _don't_ commonly have 066 or 077 
> as the umask, and also why 002 is the default umask ONLY on systems where 
> users have their own individual groups by default.
077 was a tongue-in-cheek comment.

I think we are basing our reasoning with the same shared understanding of historical practice of "user" group. I wonder why the differenece in conclusions.

Maybe my recollection of historical practice was faulty and the root shared its group with Joe Random users? If so, I would agree that 002 makes no sense at all, as you said.

Previous: Linus TorvaldsNext: Krzysztof Halasa
Message 6 of 10 in “Default "tar" umask..”
  1. Linus TorvaldsDec 30, 2006
  2. Junio C HamanoDec 30, 2006
  3. René ScharfeJan 5, 2007
  4. Junio C HamanoJan 5, 2007
  5. Linus TorvaldsJan 5, 2007
  6. Junio C HamanoJan 5, 2007
  7. Krzysztof HalasaJan 7, 2007
  8. Junio C HamanoJan 7, 2007
  9. René ScharfeJan 5, 2007
  10. Junio C HamanoJan 5, 2007

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.