Re: [PATCH 3/8] git-send-email.perl: Handle shell metacharacters in $EDITOR properly
- From
- Bryan Donlan <bdonlan@fushizen.net>
- Date
- Apr 9, 2008, 14:28 UTC
- Message-ID
- <20080409142808.GC24402@shion.is.fushizen.net>
- In-Reply-To
- <47FC62B6.9020304@viscovery.net>
On Wed, Apr 09, 2008 at 08:31:18AM +0200, Johannes Sixt wrote:
Show 7 quoted lines
> Bryan Donlan schrieb: > > Also, update t/t9001-send-email.sh to test for this bug. > > > > Signed-off-by: Bryan Donlan <bdonlan@fushizen.net> > > Your defintion of "properly"? I didn't immediately see what is wrong with > the status quo and, hence, why your fix would solve a problem.
This fixes the git-send-perl semantics for launching an editor when $GIT_EDITOR (or friends) contains shell metacharacters to match launch_editor() in builtin-tag.c. If we use the current approach (sh -c '$0 $@' "$EDITOR" files ...), we see it fails when $EDITOR has shell metacharacters:
$ sh -x -c '$0 $@' "$VISUAL" "foo" + "$FAKE_EDITOR" foo "$FAKE_EDITOR": 1: "$FAKE_EDITOR": not found
Whereas builtin-tag.c will invoke sh -c "$EDITOR \"$@\"".
Note that with the method git-send-perl uses currently, it's difficult (impossible?) to deal with a editor path that contains arbitrary shell metacharacters. It's certainly impossible when the various git tools use different semantics :)
I'll amend the commit message along with the other suggested changes.