From: Thomas Rast <trast@student.ethz.ch>
To: Michele Ballabio <barra_cuda@katamail.com>
Cc: Peter Krefting <peter@softwolves.pp.se>,
Git Mailing List <git@vger.kernel.org>
Subject: Re: [PATCH] help.c: don't blame an user's typo when the system is at fault
Date: Mon, 20 Jul 2009 16:17:47 +0200 [thread overview]
Message-ID: <200907201617.48168.trast@student.ethz.ch> (raw)
In-Reply-To: <200907201545.06030.barra_cuda@katamail.com>
Michele Ballabio wrote:
> Is the call to strerror() useless anyway?
[...]
> + if (!strcmp(cmd, main_cmds.names[0]->name))
> + die("Failed to run command '%s': %s\n",
> + cmd, strerror(errno));
The invocation of help_unknown_cmd comes from
while (1) {
// ...
was_alias = run_argv(&argc, &argv);
if (errno != ENOENT)
break;
// ... side branch with an exit() ...
if (!done_help) {
cmd = argv[0] = help_unknown_cmd(cmd);
so errno is always ENOENT when help_unknown_cmd() is called.
(Furthermore, the function itself uses git_config() and
load_command_list(), both of which _probably_ clobber errno, I don't
really have the time for an in-depth check.)
It also seems that the 'errno != ENOENT' check was intended to catch
the case where the command failed for any reason other than that it
does not exist, but this collides with the kernel reporting ENOENT if
the _interpreter_ does not exist. Perhaps run_argv should
differentiate the case where a command executable exists but cannot be
run?
[I started writing a reply because I wanted to ask for a conversion to
die_errno() in the spirit of d824cbb (Convert existing die(...,
strerror(errno)) to die_errno(), 2009-06-27). Please keep that in
mind if you put in another die() that mentions errno.]
--
Thomas Rast
trast@{inf,student}.ethz.ch
next prev parent reply other threads:[~2009-07-20 14:18 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-07-20 12:11 Bad DWIM response when git gui cannot start Peter Krefting
2009-07-20 13:45 ` [PATCH] help.c: don't blame an user's typo when the system is at fault Michele Ballabio
2009-07-20 14:17 ` Thomas Rast [this message]
2009-07-20 15:12 ` Jeff King
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=200907201617.48168.trast@student.ethz.ch \
--to=trast@student.ethz.ch \
--cc=barra_cuda@katamail.com \
--cc=git@vger.kernel.org \
--cc=peter@softwolves.pp.se \
/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).