Re: [RFC PATCH 0/3] git-p4: move to toplevel

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

 



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
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[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]