git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jonathan Nieder <jrnieder@gmail.com>
To: Junio C Hamano <gitster@pobox.com>
Cc: git@vger.kernel.org, "Johannes Sixt" <j6t@kdbg.org>,
	"Nguyễn Thái Ngọc Duy" <pclouds@gmail.com>
Subject: Re: [PATCH] report which $PATH entry had trouble running execvp(3)
Date: Wed, 20 Apr 2011 06:21:22 -0500	[thread overview]
Message-ID: <20110420112122.GA6580@elie> (raw)
In-Reply-To: <7vaafl371q.fsf_-_@alter.siamese.dyndns.org>

Hi,

Junio C Hamano wrote:

> You can add your own custom subcommand 'frotz' to the system by adding
> 'git-frotz' in a directory somewhere in your $PATH environment variable.
> When you ask "git frotz" from the command line, "git-frotz" is run via
> execvp(3).
>
> Three plausible scenarios that the execvp(3) would fail for us are:
[...]
> The first one is easy to understand and to rectify.  Most likely, the user
> made a typo, either on the command line, or when creating the custom
> subcommand.  However, the latter two cases are harder to notice, as we do
> not report 'git-frotz' in which directory we had trouble with.  We could
> do better if we implemented the command search behaviour of execvp(3)
> ourselves.

My first reaction was the same as Hannes's.  I suppose I would be
happier about something like an optional dependency on something
generic like libexplain[1] (though I'm not thrilled about the style of
its error messages).  If we are to implement it ourselves, using
standard execvp and then trying to track down a guess for the cause
after it fails might be okay.

[1] http://libexplain.sourceforge.net/

I was also reminded that anyone writing scripts following the advice
of POSIX (meaning no #!) would find their custom git commands broken.
Luckily that is easily fixed by using execvp with absolute path.

A part of this is tempting: as Jeff mentioned, it would be nice to
avoid commit_pager_choice when checking for a dashed external before
executing an alias to an internal command that doesn't want a pager
(see v1.7.2~16^2, git --paginate: paginate external commands again,
2010-07-14).  Hm.

      parent reply	other threads:[~2011-04-20 11:21 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-04-18 20:54 [REGRESSION] git-wrapper to run-commands codepath regression Junio C Hamano
2011-04-18 21:11 ` Jeff King
2011-04-18 21:18   ` Jeff King
2011-04-18 21:40     ` Junio C Hamano
2011-04-18 21:43       ` Jeff King
2011-04-18 22:10         ` Junio C Hamano
2011-04-18 22:11       ` Andreas Schwab
2011-04-18 21:16 ` Junio C Hamano
2011-04-18 22:17   ` Jonathan Nieder
2011-04-19  7:05   ` [PATCH] run-command: write full error message in die_child Jonathan Nieder
2011-04-20  7:42     ` Johannes Sixt
2011-04-20 10:33       ` [PATCH v2 0/2] " Jonathan Nieder
2011-04-20 10:35         ` [PATCH 1/2] tests: check error message from run_command Jonathan Nieder
2011-04-20 10:40         ` [PATCH 2/2] run-command: handle short writes and EINTR in die_child Jonathan Nieder
2011-04-19  0:07 ` [REGRESSION] git-wrapper to run-commands codepath regression Junio C Hamano
2011-04-20  4:01   ` [PATCH] report which $PATH entry had trouble running execvp(3) Junio C Hamano
2011-04-20  5:51     ` Jeff King
2011-04-21  0:00       ` Junio C Hamano
2011-04-20  7:37     ` Johannes Sixt
2011-04-20 11:21     ` Jonathan Nieder [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20110420112122.GA6580@elie \
    --to=jrnieder@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=j6t@kdbg.org \
    --cc=pclouds@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).