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

Re: tracking perms/ownership

From
JEJosh England <jjengla@sandia.gov>
Date
Aug 24, 2007, 07:22 UTC
Message-ID
<1187940171.6357.59.camel@beauty>
In-Reply-To
<7vtzqpsy3q.fsf@gitster.siamese.dyndns.org>
On Thu, 2007-08-23 at 15:08 -0700, Junio C Hamano wrote: 
Show 13 quoted lines
> "Josh England" <jjengla@sandia.gov> writes:
> 
> > Looking at the index struct, it already has fields in it for file mode
> > uid and gid (woohoo!).
> 
> I can see that storing textual names in gitattributes and having
> the root user run git so that it can chown(), would work.
> 
> But this is only about checkout.  After you chown a file in the
> work tree and run update-index, next write-tree would not record
> it, as there is no place in tree objects to record uid/gid.
> You would need to arrange so that a matching change is made in
> the gitattributes file if you go that route.

That's ok. Any place to store the data is fine by me. I'm just concerned about some comments I saw in attrs.c <line13>: /* The basic design decision here is that we are not going to have insanely large number of attributes. This is a randomly chosen prime. */ #define HASHSIZE 257

Using a brute force perm/ownership attribute set for every file, assuming a modestly populated linux distribution image having upwards of 150,000 files/directories in it, thats sticking over 100,000 attributes into some .gitattributes file somewhere. Do you think the gitattributes system can handle this kind of abuse?

Show 11 quoted lines
> If you had:
> 
> 	etc/*		owner=root
>         etc/frotz	owner=nobody
> 
> in gitattributes, and you did a checkout.  You chown etc/nitfol
> with "chown printer etc/nitfol".  Somebody needs to add a line
> 
> 	etc/nitfol	owner=printer
> 
> to gitattributes before you make the commit.

Unless this 'somebody' is an automated process that will never fly. I want git to do it for me when the right config/attr is set (maybe at update_index time). Thats where my concern about the gitattributes system comes from. What's going to happen when I stick 150,000 (est) attributes in there?

Show 6 quoted lines
> Maybe the chown
> was not about etc/nitfol but about making etc/frotz owned by
> root.  Then you would, instead of adding the etc/nitfol line,
> remove existing etc/frotz line so that earlier glob would
> capture and express the idea of making everything owned by
> root.  I suspect this would get rather tricky quickly.

Maybe doable though. Starting from the root of the tree, traverse downwards and only add new attributes when a file or dir's ownership has changed from the parent, maybe. This could optimize away many of the attributes needed. I think a good place might be right in index_path() because the lstat data is fresh and accessible. Writing attrs out to file if necessary should hopefully not add too much overhead.

-JE
Previous: David KastrupNext: Junio C Hamano
Message 22 of 41 in “empty directories”
  1. Josh EnglandAug 21, 2007
  2. SeanAug 21, 2007
  3. Josh EnglandAug 22, 2007
  4. Linus TorvaldsAug 22, 2007
  5. David KastrupAug 22, 2007
  6. Josh EnglandAug 23, 2007
  7. tracking perms/ownership [was: empty directories]Josh England, Aug 23, 2007
  8. Junio C HamanoAug 23, 2007
  9. Linus TorvaldsAug 23, 2007
  10. David KastrupAug 24, 2007
  11. Linus TorvaldsAug 24, 2007
  12. Josh EnglandAug 24, 2007
  13. David KastrupAug 24, 2007
  14. Linus TorvaldsAug 24, 2007
  15. Josh EnglandAug 24, 2007
  16. Linus TorvaldsAug 24, 2007
  17. Josh EnglandAug 24, 2007
  18. Junio C HamanoAug 24, 2007
  19. Josh EnglandAug 24, 2007
  20. Robin RosenbergAug 24, 2007
  21. David KastrupAug 24, 2007
  22. Josh EnglandAug 24, 2007
  23. Junio C HamanoAug 24, 2007
  24. Josh EnglandAug 24, 2007
  25. Josh EnglandAug 24, 2007
  26. Josh EnglandAug 24, 2007
  27. Johannes SchindelinAug 24, 2007
  28. Jeff KingAug 24, 2007
  29. Josh EnglandAug 24, 2007
  30. Jeff KingAug 24, 2007
  31. Johannes SchindelinAug 25, 2007
  32. Junio C HamanoAug 25, 2007
  33. Junio C HamanoAug 25, 2007
  34. Jeff KingAug 24, 2007
  35. Johannes SchindelinAug 25, 2007
  36. Jason GarberAug 24, 2007
  37. Jakub NarebskiAug 22, 2007
  38. Jakub NarebskiAug 22, 2007
  39. Salikh ZakirovAug 22, 2007
  40. Linus TorvaldsAug 22, 2007
  41. David KastrupAug 22, 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.