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

Re: confused about preserved permissions

From
René Scharfe <rene.scharfe@lsrfire.ath.cx>
Date
Aug 21, 2007, 18:01 UTC
Message-ID
<46CB285D.3010909@lsrfire.ath.cx>
In-Reply-To
<20070820174142.GA7943@glandium.org>
Mike Hommey schrieb:
Show 14 quoted lines
> On Mon, Aug 20, 2007 at 06:44:11PM +0200, martin f krafft <madduck@madduck.net> wrote:
>> Why does git bother saving a mode when later it never seems to use
>> it again?
> 
> Same applies to git-archive, which generates files with mode 666 and
> directories with 777, while it could follow the modes in the
> repository... or at least, that's what the manpage claims, but facts
> seem to be quite different...
> 
> mh@namakemono:~/git/git$ git-archive --format=tar HEAD | tar -tvf -
> -rw-rw-r-- root/root      2365 2007-08-19 20:45 .gitignore
> -rw-rw-r-- root/root      1973 2007-08-19 20:45 .mailmap
> -rw-rw-r-- root/root     18787 2007-08-19 20:45 COPYING
> drwxrwxr-x root/root         0 2007-08-19 20:45 Documentation/
> mh@namakemono:~/git/git$ umask
> 0022
> 
> And no value is set for umask in git config...

In that case the default value for tar.umask applies, which is 002. The manpage needs an update.. Thanks for spotting this.

You can set it to 022 explicitly or to "user" to restrict permissions:
   $ git config tar.umask 022		# -rw-r--r--
   $ git config tar.umask user		# your Unix umask applies

Originally file permissions were simply copied into the archive, but this was inconvenient for users that needed more permission bits set, e.g. to share an extracted archive with with others by default.

Also please note that tar applies your umask when extracting files (exception: GNU tar doesn't do that by default if run as root), so the permissions of extracted files may look different from the output of "tar -t".

René
Previous: David KastrupNext: René Scharfe
Message 8 of 39 in “confused about preserved permissions”
  1. martin f krafftAug 20, 2007
  2. Pierre HabouzitAug 20, 2007
  3. martin f krafftAug 20, 2007
  4. Mike HommeyAug 20, 2007
  5. David KastrupAug 20, 2007
  6. Mike HommeyAug 20, 2007
  7. David KastrupAug 20, 2007
  8. René ScharfeAug 21, 2007
  9. Documentation: update tar.umask defaultRené Scharfe, Aug 21, 2007
  10. Mike HommeyAug 21, 2007
  11. René ScharfeAug 22, 2007
  12. Alex RiesenAug 20, 2007
  13. Benoit SIGOUREAug 22, 2007
  14. Johannes SixtAug 22, 2007
  15. Junio C HamanoAug 22, 2007
  16. martin f krafftAug 23, 2007
  17. David KastrupAug 23, 2007
  18. martin f krafftAug 23, 2007
  19. Benoit SIGOUREAug 23, 2007
  20. Junio C HamanoAug 23, 2007
  21. David KastrupAug 23, 2007
  22. Jan HudecSep 3, 2007
  23. Junio C HamanoAug 23, 2007
  24. Mike HommeyAug 20, 2007
  25. Jan HudecAug 20, 2007
  26. Mike HommeyAug 20, 2007
  27. Alex RiesenAug 20, 2007
  28. Mike HommeyAug 20, 2007
  29. Jan HudecAug 20, 2007
  30. David KastrupAug 20, 2007
  31. Mike HommeyAug 20, 2007
  32. Jan HudecAug 20, 2007
  33. David KastrupAug 20, 2007
  34. Mike HommeyAug 20, 2007
  35. David KastrupAug 20, 2007
  36. Shawn O. PearceAug 21, 2007
  37. Junio C HamanoAug 21, 2007
  38. Mike HommeyAug 21, 2007
  39. David KastrupAug 21, 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.