Re: [PATCH 0/2] Make run-command.c honour SHELL_PATH
From: Jeff King <hidden>
Date: 2016-06-15 22:53:23
On Mon, Mar 26, 2012 at 09:38:45AM -0400, Ben Walton wrote:
quoted
A second reaction was to wonder why the usual fixup from v1.6.4-rc0~66^2~1 (Makefile: insert SANE_TOOL_PATH to PATH before /bin or /usr/bin, 2009-07-08) didn't apply. Should the git wrapper prepend the same magic to $PATH that git-sh-setup.sh does to make the behavior of scripted and unscripted commands a little more consistent?I did some poking at this before creating my patch as that is what I'd expected too. It would likely be a good idea, but in my case, even that wouldn't help. I add /opt/csw/gnu:/opt/csw/bin:/usr/xpg4/bin to the SANE_TOOL_PATH but set the SHELL_PATH to /opt/csw/bin/bash. Without my patch, but with SANE_TOOL_PATH honoured, I'd still see /opt/csw/bin/sh forked and that sh is crippled too. So that leads me to think that if we're going to fork a shell, it should be one that we know to be good...if the builder has provided that value. I think you agree with this based on your next comment.
What is /opt/csw/bin/sh? Is it a symlink to bash (which would mean bash running in POSIX mode)? Or is it a lightweight shell like ash? Or something else? The point of SHELL_PATH is to provide a POSIX shell. Generally, bash behavior is a superset of POSIX, so you will not run into any incompatibilities by running things with bash. But do be aware that you are slightly incompatible with the rest of the world (so things that work for you, for example, might not work for people using git with the stock "shell is /bin/sh" configuration). -Peff