Re: [PATCH] rebase: exec leaks GIT_DIR to environment

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Phillip,

On Mon, 30 Oct 2017, Phillip Wood wrote:

> On 30/10/17 06:26, Jacob Keller wrote:
> > On Sun, Oct 29, 2017 at 8:36 PM, Junio C Hamano <gitster@xxxxxxxxx> wrote:
> >> Jacob Keller <jacob.keller@xxxxxxxxx> writes:
> >>
> >>> I am pretty confident we can fix it....
> >>
> >> I am sure we can eventually, but 3 hours is not enough soak time.
> >>
> >> I am inclined to leave the fix for 2.15.1/2.16.0 instead of delaying
> >> the release by 10 more days.
> > 
> > That's fair. I'm not even sure it was introduced since the last
> > release (I tried 2.12, but not 2.13 or 2.14 manually). Thus, it likely
> > wasn't noticed for at least a release, meaning it's less important (to
> > me at least) that we provide a fix immediately, since it went
> > unnoticed this long, likely that means few people will be impacted.
> 
> It is in 2.14.3, I haven't bisected but I suspect it was introduced by
> 311af5266b sequencer (rebase -i): implement the 'exec' command
> 
> Running
> git rebase -x'perl -e '\''$,=$\="\n"; print  grep { /^GIT_/ } sort keys
> %ENV'\' @
> Shows that the rebase--helper version also sets GIT_PREFIX as well as
> GIT_DIR, I suspect the difference is coming from differences in the
> setup for builtin commands vs external commands. The shell version and
> the rebase--helper version set GIT_CHERRY_PICK_HELP, GIT_EDITOR,
> GIT_INTERNAL_GETTEXT_SH_SCHEME, GIT_REFLOG_ACTION

Indeed, when you look at git_dir_init in git-sh-setup, you will see that
Unix shell scripts explicitly get their GIT_DIR turned into an absolute
path.

So my suggested patch is wrong, and it should be more along the lines of

	struct strbuf buf = STRBUF_INIT;
	const char *child_env[] = { NULL, NULL };

	strbuf_addf(&buf, "GIT_DIR=%s", absolute_path(get_git_dir()));
	child_env[0] = buf.buf;

	...

	strbuf_release(&buf);

Jake, can I still take you up on taking it from here?

Ciao,
Dscho



[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux