From: Johannes Sixt <j6t@kdbg.org>
To: Clemens Buchacher <drizzd@aon.at>
Cc: git@vger.kernel.org, torvalds@linux-foundation.org,
Junio C Hamano <gitster@pobox.com>
Subject: Re: [PATCH/RFC] notice error exit from pager
Date: Wed, 27 Jul 2011 21:36:52 +0200 [thread overview]
Message-ID: <4E3068D4.4050006@kdbg.org> (raw)
In-Reply-To: <20110726210401.GA25207@toss.lan>
Am 26.07.2011 23:04, schrieb Clemens Buchacher:
> If the pager fails to run, git produces no output, e.g.:
>
> $ GIT_PAGER=not-a-command git log
>
> The error reporting fails for two reasons:
>
> (1) start_command: There is a mechanism that detects errors during
> execvp introduced in 2b541bf8 (start_command: detect execvp
> failures early). ... This mechanism is
> incompatible with the workaround introduced in 35ce8622
> (pager: Work around window resizing bug in 'less')
You analysis is correct. I think the bug in less was fixed shortly after
this workaround was introduced. I would like to remove this workaround
for a different reason, but it seems there are people who are quite fond
of it ;)
> diff --git a/run-command.c b/run-command.c
> index 70e8a24..944a882 100644
> --- a/run-command.c
> +++ b/run-command.c
> @@ -127,9 +127,6 @@ static int wait_or_whine(pid_t pid, const char *argv0, int silent_exec_failure)
> if (code == 127) {
> code = -1;
> failed_errno = ENOENT;
> - if (!silent_exec_failure)
> - error("cannot run %s: %s", argv0,
> - strerror(ENOENT));
> }
> } else {
> error("waitpid is confused (%s)", argv0);
> @@ -287,10 +284,14 @@ fail_pipe:
> * Do not check for cmd->silent_exec_failure; the parent
> * process will check it when it sees this exit code.
> */
> - if (errno == ENOENT)
> + if (errno == ENOENT) {
> + if (!cmd->silent_exec_failure)
> + error("cannot run %s: %s", cmd->argv[0],
> + strerror(ENOENT));
This change is not good enough: There is no guarantee that this message
goes to the right channel (stderr in the child can be redirected). Look
carefully: We set a special die routine in the forked child that ensures
that the die() messages are written to the right channel; we do not have
a similar facility for error() messages (or do we?).
> exit(127);
> - else
> + } else {
> die_errno("cannot exec '%s'", cmd->argv[0]);
> + }
> }
> if (cmd->pid < 0)
> error("cannot fork() for %s: %s", cmd->argv[0],
-- Hannes
next prev parent reply other threads:[~2011-07-27 19:37 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-07-26 21:04 [PATCH/RFC] notice error exit from pager Clemens Buchacher
2011-07-26 21:35 ` Linus Torvalds
2011-07-27 19:36 ` Johannes Sixt [this message]
2011-07-27 21:32 ` [PATCH] error_routine: use parent's stderr if exec fails Clemens Buchacher
2011-08-01 17:59 ` [PATCH] notice error exit from pager Clemens Buchacher
2011-08-01 20:17 ` Junio C Hamano
2011-08-01 20:35 ` Clemens Buchacher
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=4E3068D4.4050006@kdbg.org \
--to=j6t@kdbg.org \
--cc=drizzd@aon.at \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=torvalds@linux-foundation.org \
/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).