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

Re: [PATCH 1/2] index-pack: Create .keep files with same permissions and .pack/.idx

From
Johan Herland <johan@herland.net>
Date
Apr 3, 2011, 01:01 UTC
Message-ID
<201104030301.29923.johan@herland.net>
In-Reply-To
<7v39m1e110.fsf@alter.siamese.dyndns.org>
On Saturday 02 April 2011, Junio C Hamano wrote:
Show 11 quoted lines
> Johan Herland <johan@herland.net> writes:
> > While pushing to a remote repo, Git transiently adds a .keep file for
> > the pack being pushed, to protect it from a concurrent "git gc".
> > Sometimes, when the push fails or is aborted, the .keep file is left
> > stale in the repo. This causes problems for other users of the same
> > repo, since the permissions on the .keep file (0600) make it
> > inaccessible even though the rest of the repo is accessible (0444
> > modulo shared_repository setting).
> 
> I was also wondering why you initialized with 0444 in your patch and then
> even adjusted for shared repository settings.

I was simply emulating what is currently done for idx and pack files (see below).

> This is a tangent, but wouldn't it be wrong for index-pack to always
> leave the idx and pack files in 0444 with an explicit chmod() in the
> first place?  I suspect that we simply forgot to fix it when we
> introduced adjust_shared_perm().

Yeah, probablby, but AFAICS in the receive-pack case, final_pack_name and final_index_name are both NULL (neither are specified on the index-pack command line passed from receive-pack), so the explicit chmod(..., 0444) is never called. Instead the pack and idx files are both opened from odb_mkstemp() (via open_pack_file() and write_idx_file(), respectively), which uses mode 0444. We then call move_temp_to_file(), which calls adjust_shared_perm().

...Johan
-- 
Johan Herland, <johan@herland.net>
www.herland.net
Previous: Junio C HamanoNext: Johan Herland
Message 10 of 14 in “Problems with stale .keep files on git server”
  1. Johan HerlandMar 31, 2011
  2. Jeff KingMar 31, 2011
  3. 1/2 index-pack: Create .keep files with same permissions and .pack/.idxJohan Herland, Apr 1, 2011
  4. Junio C HamanoApr 1, 2011
  5. Jeff KingApr 1, 2011
  6. Shawn PearceApr 1, 2011
  7. Junio C HamanoApr 1, 2011
  8. Johan HerlandApr 1, 2011
  9. Junio C HamanoApr 2, 2011
  10. Johan HerlandApr 3, 2011
  11. Johan HerlandApr 1, 2011
  12. 2/2 repack: Remove stale .keep files before repackingJohan Herland, Apr 1, 2011
  13. Jeff KingApr 1, 2011
  14. Johan HerlandApr 1, 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.