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

Re: [PATCH] unpack-objects: Fix EACCES pushing to remote on vmhgfs

From
brian m. carlson <sandals@crustytoothpaste.net>
Date
Jul 3, 2024, 22:40 UTC
Message-ID
<ZoXTWECfLzaA-tmU@tapette.crustytoothpaste.net>
In-Reply-To
<20240703134028.876-1-vano@mail.mipt.ru>
On 2024-07-03 at 13:40:28, Ivan Pozdeev wrote:
Show 8 quoted lines
> Creating files with 0444 mode causes EACCES opening them for writing
> in some setups where the creating user does not automatically have
> write access.
> E.g. on a vmhgfs (VMWare shared folders) with Windows host, this causes
> the file on the host to be created with the read-only attribute set
> which prohibits writing for everyone.
> 
> Change the mode to 0644, explicitly signaling we want write access.

But we don't. We don't want people to write to these files, since they're objects and modifying them corrupts the repository. The 0444 mode is completely intentional here.

What you're reporting actually also occurs on some broken NFS implementations as well. POSIX requires that implementations accept O_RDWR with 0444[0], and we require POSIX compliance from file systems. The solution here is to fix this in the file system so it behaves as POSIX requires[1], which I admit may be difficult.

In addition, I'll mention that what you're doing is likely to cause you a bunch of pain. A Unix system is going to store different data in the index from a Windows system, so when you do `git status` on one system after having done it on the other, Git is going to re-read the entire working tree, including re-hashing it, to fix the data in the index. That's one of the reasons we don't recommend sharing a working tree between different OSes.

[0] From https://pubs.opengroup.org/onlinepubs/9699919799/functions/open.html:
    “The argument following the oflag argument does not affect whether the
    file is open for reading, writing, or for both.”
[1] There are a lot of instances where Git fails when the file system is
    not POSIX compliant on Unix.  Notably, I believe chmod operations fail
    under WSL for Windows partitions, so doing a `git init` under WSL on a
    Windows mount tends to fail when it writes the config since the file
    system isn't POSIX compliant.
-- 
brian m. carlson (they/them or he/him)
Toronto, Ontario, CA
Previous: Ivan Pozdeev
Message 2 of 2 in “unpack-objects: Fix EACCES pushing to remote on vmhgfs”
  1. unpack-objects: Fix EACCES pushing to remote on vmhgfsIvan Pozdeev, Jul 3, 2024
  2. brian m. carlsonJul 3, 2024

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.