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

Re: Git changes permissions on directories when deleting files.

From
Jeff King <peff@peff.net>
Date
Mar 3, 2011, 15:16 UTC
Message-ID
<20110303151608.GD1074@sigill.intra.peff.net>
In-Reply-To
<AANLkTi=nFMDHR5WL=TiFmshFkxLMF9N4dNEjqw+r7wyh@mail.gmail.com>
On Wed, Mar 02, 2011 at 10:48:00PM -0500, Chad Joan wrote:
> It seems to be working!  I've tried it with 'git rm' and when pulling
> deletions.
Great.
> I imagine that race condition can happen if files in the directory are
> being modified while git does an rmdir?  If that's the case then I'm
> not too worried.  There is only one other programmer that might be
> working with me at the same time on an infrequently used directory.

The race condition I mentioned earlier was for a different workaround. Basically there are two strategies, each with a difference race:

  1. Don't rmdir on non-empty directories. This means we have to opendir
     the directory and look for entries before rmdir(). If there is file
     activity in the directory while we are looking we may think it is
     empty when it's not and rmdir(), screwing up the permissions.
  2. Before any rmdir, check permissions. Do the rmdir, and then restore
     the permissions if rmdir fails. The race here is if somebody is
     modifying the permissions on a non-empty directory, we may
     overwrite their changes.
Obviously the patch does (2), so there is still that race.
> diff -crB git-1.7.3.4/dir.c git-1.7.3.4-new/dir.c

Context diff? Eww. There is this awesome tool called "git" that can help you with managing versions of software. :)

-Peff
Previous: Chad JoanNext: Chad Joan
Message 18 of 19 in “Git changes permissions on directories when deleting files.”
  1. Chad JoanMar 1, 2011
  2. Chad JoanMar 1, 2011
  3. Computer DruidMar 1, 2011
  4. Chad JoanMar 1, 2011
  5. Chad JoanMar 1, 2011
  6. Computer DruidMar 1, 2011
  7. Chad JoanMar 1, 2011
  8. Jeff KingMar 1, 2011
  9. Chad JoanMar 1, 2011
  10. Jeff KingMar 1, 2011
  11. Chad JoanMar 1, 2011
  12. Computer DruidMar 1, 2011
  13. Jeff KingMar 1, 2011
  14. Matthieu MoyMar 1, 2011
  15. Chad JoanMar 1, 2011
  16. Jeff KingMar 1, 2011
  17. Chad JoanMar 3, 2011
  18. Jeff KingMar 3, 2011
  19. Chad JoanMar 11, 2011

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.