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

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

From
IPIvan Pozdeev <vano@mail.mipt.ru>
Date
Jul 3, 2024, 13:40 UTC
Message-ID
<20240703134028.876-1-vano@mail.mipt.ru>

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.
Signed-off-by: Ivan Pozdeev <vano@mail.mipt.ru>
---
 object-file.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/object-file.c b/object-file.c
index 610b1f465c..bc71106ea8 100644
--- a/object-file.c
+++ b/object-file.c
@@ -2002,7 +2002,7 @@ static int create_tmpfile(struct strbuf *tmp, const char *filename)
 	strbuf_reset(tmp);
 	strbuf_add(tmp, filename, dirlen);
 	strbuf_addstr(tmp, "tmp_obj_XXXXXX");
-	fd = git_mkstemp_mode(tmp->buf, 0444);
+	fd = git_mkstemp_mode(tmp->buf, 0644);
 	if (fd < 0 && dirlen && errno == ENOENT) {
 		/*
 		 * Make sure the directory exists; note that the contents
@@ -2019,7 +2019,7 @@ static int create_tmpfile(struct strbuf *tmp, const char *filename)
 
 		/* Try again */
 		strbuf_addstr(tmp, "/tmp_obj_XXXXXX");
-		fd = git_mkstemp_mode(tmp->buf, 0444);
+		fd = git_mkstemp_mode(tmp->buf, 0644);
 	}
 	return fd;
 }
-- 
2.36.1.windows.1
Next: brian m. carlson
Message 1 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.