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

Re: [PATCH] rerere: make rr-cache fanout directory honor umask

From
Jeff King <peff@peff.net>
Date
Jul 10, 2012, 06:37 UTC
Message-ID
<20120710063721.GA6347@sigill.intra.peff.net>
In-Reply-To
<7vsjd0ikfe.fsf_-_@alter.siamese.dyndns.org>
On Mon, Jul 09, 2012 at 04:28:21PM -0700, Junio C Hamano wrote:
Show 5 quoted lines
> This is the last remaining call to mkdir(2) that restricts the permission
> bits by passing 0755.  Just use the same mkdir_in_gitdir() used to create
> the leaf directories.
> 
> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Looks obviously correct to me.

I notice that grepping finds a few 0644 modes, too. Most of them are false-positives (e.g., we store and transmit 100644 as a shorthand for "normal non-executable permissions"). This is the only one that looked legitimate to me:

-- >8 --
Subject: [PATCH] add: create ADD_EDIT.patch with mode 0666

We should be letting the user's umask take care of restricting permissions. Even though this is a temporary file and probably nobody would notice, this brings us in line with other temporary file creations in git (e.g., choosing "e"dit from git-add--interactive).

Signed-off-by: Jeff King <peff@peff.net>
---
 builtin/add.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/builtin/add.c b/builtin/add.c
index 41edd63..815ac4b 100644
--- a/builtin/add.c
+++ b/builtin/add.c
@@ -287,7 +287,7 @@ static int edit_patch(int argc, const char **argv, const char *prefix)
 	argc = setup_revisions(argc, argv, &rev, NULL);
 	rev.diffopt.output_format = DIFF_FORMAT_PATCH;
 	DIFF_OPT_SET(&rev.diffopt, IGNORE_DIRTY_SUBMODULES);
-	out = open(file, O_CREAT | O_WRONLY, 0644);
+	out = open(file, O_CREAT | O_WRONLY, 0666);
 	if (out < 0)
 		die (_("Could not open '%s' for writing."), file);
 	rev.diffopt.file = xfdopen(out, "w");
-- 
1.7.10.5.16.ga1c6f1c
Previous: Junio C Hamano
Message 10 of 10 in “git-clone ignores umask for working tree”
  1. Alex RiesenJul 6, 2012
  2. Daniel BarkalowJul 6, 2012
  3. Restore umasks influence on the permissions of work tree created by cloneAlex Riesen, Jul 7, 2012
  4. Junio C HamanoJul 9, 2012
  5. Alex RiesenJul 9, 2012
  6. Jeff KingJul 9, 2012
  7. Junio C HamanoJul 9, 2012
  8. Junio C HamanoJul 9, 2012
  9. rerere: make rr-cache fanout directory honor umaskJunio C Hamano, Jul 9, 2012
  10. Jeff KingJul 10, 2012

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.