From: Jeff King Date: Tue, 14 Feb 2012 19:05:15 GMT Subject: Re: [RFC PATCH 0/3] git-p4: move to toplevel Message-ID: <20120214190515.GB12072@sigill.intra.peff.net> In-Reply-To: <7vaa4l8diz.fsf@alter.siamese.dyndns.org> On Tue, Feb 14, 2012 at 10:40:04AM -0800, Junio C Hamano wrote: > I do not think tilde in $PATH is expanded by exec*p family to begin with, > so it is not "dash" but POSIX, I would think. It is bash that is harming > other programs, by trying to be more helpful, encouraging this user > mistake to add ~ literally on the PATH. Hmm. There is an interesting ramification for run-command's "use_shell" optimization. Typically, git runs all of the user-provided commands given to it via the shell. But if the command contains no meta-characters, we skip the shell invocation as an optimization, since the shell should simply be word-splitting and calling exec, and the behavior will be identical. But if your shell handles PATH entries differently, then there is a difference. I.e., doing this: mkdir junk ln -s /usr/bin/vi junk/my-editor export PATH=~/junk:$PATH export GIT_EDITOR=my-editor git commit might work without the optimization, but not with. We could check PATH and disable the optimization in that case, but I suspect it is not worth it, as: 1. People who put a literal "~" in their PATH get what they deserve anyway. :) 2. We explicitly run "sh" in such situations, not SHELL_PATH. Even if "sh" is bash, I believe it should look at its own argv[0] and put itself into a more POSIX-y mode (but I didn't test). -Peff