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

Re: [PATCH v2 1/2] format-patch: create leading components of output directory

From
Junio C Hamano <gitster@pobox.com>
Date
Oct 6, 2019, 00:57 UTC
Message-ID
<xmqqa7ae667i.fsf@gitster-ct.c.googlers.com>
In-Reply-To
<2b8b000d76a20349f1f9e09260eff91429beebfb.1570264824.git.bert.wesarg@googlemail.com>
Bert Wesarg <bert.wesarg@googlemail.com> writes:
Show 11 quoted lines
> +		switch (safe_create_leading_directories_const(output_directory)) {
> +		case SCLD_OK:
> +		case SCLD_EXISTS:
> +			break;
> +		default:
> +			die(_("could not create leading directories "
> +			      "of '%s'"), output_directory);
> +		}
>  		if (mkdir(output_directory, 0777) < 0 && errno != EEXIST)
>  			die_errno(_("could not create directory '%s'"),
>  				  output_directory);

There is a slight discrepancy here in that mkdir(..., 0777) is to honor the umask setting of the user who is running the command and does not care about anybody else being able to (or unable to) access the resulting directory. On the other hand, s-c-l-d is (as you can guess from the location the function is defined, sha1-file.c) meant to be used to create hierarchy _inside_ $GIT_DIR/ in such a way that anybody who needs to access the repository can access it (via core.sharedrepository config).

I do not think it matters too much in practice, but
	$ git format-patch -o $HOME/my/patch/depot

that creates intermediate levels that can be writable by other users, only because the repository you took the patches from was shared with other users, may probably be seen as a security bug.

Previous: Bert WesargNext: SZEDER Gábor
Message 3 of 7 in “format-patch: create leading components of output directory”
  1. 1/2 format-patch: create leading components of output directoryBert Wesarg, Oct 5, 2019
  2. 2/2 [RFC] format-patch: configure a command to generate the output directory nameBert Wesarg, Oct 5, 2019
  3. Junio C HamanoOct 6, 2019
  4. SZEDER GáborOct 7, 2019
  5. Junio C HamanoOct 8, 2019
  6. Bert WesargOct 8, 2019
  7. t4014: treat rev-list output as the expected valueDenton Liu, Oct 8, 2019

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.