Re: [PATCH] rebase-i-exec: Allow space in SHELL_PATH
- From
Fredrik Medley <fredrik.medley@gmail.com>
- Date
- Nov 13, 2015, 15:25 UTC
- Message-ID
- <CABA5-zk+RVBxfmuLyK8CcCFUpMXEzbHRKeWWV2SKsJqjnG-nfA@mail.gmail.com>
- In-Reply-To
- <20151113062534.GE32157@sigill.intra.peff.net>
2015-11-13 7:25 GMT+01:00 Jeff King <peff@peff.net>:
Show 35 quoted lines
> On Fri, Nov 13, 2015 at 07:03:19AM +0100, Fredrik Medley wrote:
>
>> On Windows, when Git is installed under "C:\Program Files\Git", SHELL_PATH
>> will include a space. Fix "git rebase --interactive --exec" so that it
>> works with spaces in SHELL_PATH.
>>
>> Signed-off-by: Fredrik Medley <fredrik.medley@gmail.com>
>> ---
>> git-rebase--interactive.sh | 2 +-
>> 1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/git-rebase--interactive.sh b/git-rebase--interactive.sh
>> index 30edb17..b938a6d 100644
>> --- a/git-rebase--interactive.sh
>> +++ b/git-rebase--interactive.sh
>> @@ -610,7 +610,7 @@ do_next () {
>> read -r command rest < "$todo"
>> mark_action_done
>> printf 'Executing: %s\n' "$rest"
>> - ${SHELL:-@SHELL_PATH@} -c "$rest" # Actual execution
>> + "${SHELL:-@SHELL_PATH@}" -c "$rest" # Actual execution
>
> I think this is the right thing to do (at least I could not think of a
> case that would be harmed by it, and it certainly fixes your case). It
> looks like filter-branch would need a similar fix?
>
> I think this still isn't resilient to weird meta-characters in the
> @SHELL_PATH@, but as this is a build-time option, I think it's OK to let
> people who do
>
> make SHELL_PATH='}"; rm -rf /'
>
> hang themselves.
>
> -PeffOkay, that's what @SHELL_PATH@ stands for. I just read the result in the Windows installation that is something like ${SHELL:-/bin/sh}. The shell script processor then replaces /bin/sh with C:\Program Files\...\bin\sh.
I assume the Windows compilation does not fail in building this. I've never tried building git for Windows, though.
/Fredrik