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

Re: odb_mkstemp's 0444 permission broke write/delete access on AFP

From
Matthieu Moy <matthieu.moy@grenoble-inp.fr>
Date
Feb 17, 2015, 08:51 UTC
Message-ID
<vpqr3tozzs5.fsf@anie.imag.fr>
In-Reply-To
<13683B35-70A8-4D9E-80E1-440E4E0DC7F0@gmail.com>
Fairuzan Roslan <fairuzan.roslan@gmail.com> writes:
Show 7 quoted lines
> $ git clone https://github.com/robbyrussell/oh-my-zsh.git
> Cloning into 'oh-my-zsh'...
> remote: Counting objects: 11830, done.
> remote: Total 11830 (delta 0), reused 0 (delta 0)
> Receiving objects: 100% (11830/11830), 2.12 MiB | 481.00 KiB/s, done.
> Resolving deltas: 100% (6510/6510), done.
> warning: unable to unlink /Volumes/installer/oh-my-zsh/.git/objects/pack/tmp_pack_zjPxuc: Operation not permitted

This should be fixable from Git itself, by replacing the calls to "unlink" with something like

int unlink_or_chmod(...) {
	if (unlink(...)) {
		chmod(...); // give user write permission
		return unlink(...);
	}
}

This does not add extra cost in the normal case, and would fix this particular issue for afp shares. So, I think that would fix the biggest problem for afp-share users without disturbing others. It seems reasonable to me to do that unconditionnally.

> $ rm -rf oh-my-zsh/.git/objects/pack/tmp_*
> rm: oh-my-zsh/.git/objects/pack/tmp_idx_oUN1sb: Operation not permitted
> rm: oh-my-zsh/.git/objects/pack/tmp_pack_zjPxuc: Operation not permitted

What happens if you do "rm -fr oh-my-zsh/.git/objects/pack/" (i.e. remove the directory, not the files)?

If you can still remove the directory, then I'd say the solution above could be sufficient: the user isn't supposed to interfer with the content of .git/objects other than by using Git, and if he or she does, then asking a chmod prior to an rm seems reasonable.

If you can't, then it's another problematic use-case (basically, you can't just "rm -fr" a whole clone), and then it deserves at least an opt-in configuration to get writable pack files.

(Unfortunately, I suspect we're in the later case)
> If you insist on setting the tmp idx & pack file permission to 0444 at
> least give it a u+w permission whenever you try to unlink and rename
> it so it won’t fail.

Yes. In case you hadn't guessed, this is precisely what I had in mind when I asked "Is it a problem when using Git [...] or when trying to remove files outside Git?".

-- 
Matthieu Moy
http://www-verimag.imag.fr/~moy/
Previous: Fairuzan RoslanNext: Fairuzan Roslan
Message 8 of 22 in “odb_mkstemp's 0444 permission broke write/delete access on AFP”
  1. Fairuzan RoslanFeb 16, 2015
  2. Matthieu MoyFeb 16, 2015
  3. Fairuzan RoslanFeb 16, 2015
  4. Matthieu MoyFeb 16, 2015
  5. Fairuzan RoslanFeb 17, 2015
  6. Torsten BögershausenFeb 17, 2015
  7. Fairuzan RoslanFeb 17, 2015
  8. Matthieu MoyFeb 17, 2015
  9. Fairuzan RoslanFeb 17, 2015
  10. Torsten BögershausenFeb 17, 2015
  11. Matthieu MoyFeb 18, 2015
  12. Fairuzan RoslanFeb 18, 2015
  13. Matthieu MoyFeb 18, 2015
  14. Fairuzan RoslanFeb 18, 2015
  15. Junio C HamanoFeb 17, 2015
  16. Matthieu MoyFeb 18, 2015
  17. Junio C HamanoFeb 18, 2015
  18. Junio C HamanoFeb 18, 2015
  19. brian m. carlsonFeb 19, 2015
  20. Matthieu MoyFeb 20, 2015
  21. Junio C HamanoFeb 16, 2015
  22. Torsten BögershausenFeb 16, 2015

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.