git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: "Rubén Justo" <rjusto@gmail.com>
Cc: Git List <git@vger.kernel.org>,  Jeff King <peff@peff.net>,
	Johannes Sixt <j6t@kdbg.org>
Subject: Re: [PATCH] pager: die when paging to non-existing command
Date: Thu, 20 Jun 2024 12:04:03 -0700	[thread overview]
Message-ID: <xmqqsex7tp0c.fsf@gitster.g> (raw)
In-Reply-To: <f7106878-5ec5-4fe7-940b-2fb1d9707f7d@gmail.com> ("Rubén Justo"'s message of "Thu, 20 Jun 2024 19:25:43 +0200")

Rubén Justo <rjusto@gmail.com> writes:

> Finally, it's worth noting that we are not changing the behavior if the
> command specified in GIT_PAGER is a shell command.  In such cases, it
> is:
>
>     $ GIT_PAGER=:\;non-existent t/test-terminal.perl git log
>     :;non-existent: 1: non-existent: not found
>     died of signal 13 at t/test-terminal.perl line 33.

IOW, the behaviours between the case where pager is spawned via the
shell and bypassing the shell are different , and the case where the
shell is involved behaves in a way that is easier to realize the
mistake, so change the other case to match.  WHich makes sense.

This seems to be an ancient regression introduced in bfdd9ffd
(Windows: Make the pager work., 2007-12-08), which did not really
affect anybody but MinGW users, but ea27a18c (spawn pager via
run_command interface, 2008-07-22) inherited the "if we failed to
start the pager, just silently return" from it when non-MinGW code
was unified to use the run_command() codepath (the latter is
attributed to Peff, which I presume is the reason why you cc'ed
him?).

> Signed-off-by: Rubén Justo <rjusto@gmail.com>
> ---
>  pager.c          |  2 +-
>  t/t7006-pager.sh | 15 +++------------
>  2 files changed, 4 insertions(+), 13 deletions(-)
>
> diff --git a/pager.c b/pager.c
> index e9e121db69..e4291cd0aa 100644
> --- a/pager.c
> +++ b/pager.c
> @@ -137,7 +137,7 @@ void setup_pager(void)
>  	pager_process.in = -1;
>  	strvec_push(&pager_process.env, "GIT_PAGER_IN_USE");
>  	if (start_command(&pager_process))
> -		return;
> +		die("unable to start the pager: '%s'", pager);

If this error string is not used elsewhere, it probably is a good
idea to "revert" to the original error message lost by ea27a18c,
which was:

		die("unable to execute pager '%s'", pager);

But I do not think of a reason why we want to avoid dying here.

Just in case there is a reason why we should instead silently return
on MinGW, I'll Cc the author of bfdd9ffd, though.

Will queue.  Thanks.

  reply	other threads:[~2024-06-20 19:04 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-06-20 17:25 [PATCH] pager: die when paging to non-existing command Rubén Justo
2024-06-20 19:04 ` Junio C Hamano [this message]
2024-06-20 20:22   ` Rubén Justo
2024-06-20 21:03     ` Junio C Hamano
2024-06-20 22:17   ` Johannes Sixt
2024-06-20 22:35     ` Junio C Hamano
2024-06-21  6:51       ` Jeff King
2024-06-21 17:11       ` Dragan Simic
2024-06-24  7:35     ` Johannes Schindelin
2024-06-21 11:28   ` Phillip Wood
2024-06-21 23:21     ` Junio C Hamano
2024-06-21  6:40 ` Jeff King
2024-06-21 21:11   ` Rubén Justo
2024-06-21 21:29 ` [PATCH v2] " Rubén Justo
2024-06-21 23:31   ` [PATCH v3] " Rubén Justo
2024-06-22  7:08     ` Johannes Sixt
2024-06-23  7:09     ` [PATCH v4] " Rubén Justo

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=xmqqsex7tp0c.fsf@gitster.g \
    --to=gitster@pobox.com \
    --cc=git@vger.kernel.org \
    --cc=j6t@kdbg.org \
    --cc=peff@peff.net \
    --cc=rjusto@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).