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
FRFairuzan Roslan <fairuzan.roslan@gmail.com>
Date
Feb 16, 2015, 18:41 UTC
Message-ID
<340435D1-2FEB-4A4A-BBD2-E301096C72D8@gmail.com>
In-Reply-To
<vpqtwyl90mx.fsf@anie.imag.fr>

I don’t see the issue for the owner of his/her own file to have write access. Setting tmp idx & pack files to read-only even for the file owner is not a safety feature.

The real issue here is that in AFP file system can’t even unlink or rename or delete the tmp idx and pack file with no write access after it done, while other file system like ext4,hfs+, etc can.
You should at least give the user the option to set the permission in the config file and not hardcoded the permission in the binary.

Regards, Fairuzan

Show 39 quoted lines
> On Feb 17, 2015, at 2:23 AM, Matthieu Moy <Matthieu.Moy@grenoble-inp.fr> wrote:
> 
> Fairuzan Roslan <fairuzan.roslan@gmail.com> writes:
> 
>> Hi,
>> 
>> Somehow the “int mode = 0444;” in odb_mkstemp (environment.c) are
>> causing a lot of issues (unable to unlink/write/rename) to those
>> people who use AFP shares.
> 
> Is it a problem when using Git (like "git gc" failing to remove old
> packs), or when trying to remove files outside Git?
> 
>> The issue was first introduced in
>> https://github.com/git/git/blob/f80c7ae8fe9c0f3ce93c96a2dccaba34e456e33a/wrapper.c
>> line 284.
> 
> I don't think so. The code before this commit did essentially a chmod
> 444 on the file, so object files were already read-only before.
> 
> The pack files have been read-only since d83c9af5c6a437ddaa9dd27 (Junio,
> Apr 22 2007).
> 
>> To fix these issues the permission need to be adjusted to “int mode =
>> 0644;” in odb_mkstemp (environment.c)
> 
> The issue is that having object and pack files read-only on the
> filesystem is a safety feature to prevent accidental modifications (even
> though it's actually not that effective, since brute-force "sed -i" or
> "perl -i" still accept to modify read-only files).
> 
> So, I'd be a bit reluctant to remove this safety feature for all users
> if it's only for the benefit of a minority of users. Not that I think
> the problem shouldn't be fixed, but I'd rather investigate alternate
> solutions before using this mode = 0644.
> 
> --
> Matthieu Moy
> http://www-verimag.imag.fr/~moy/
Previous: Matthieu MoyNext: Matthieu Moy
Message 3 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.