git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Jeff King <peff@peff.net>
To: Enzo Matsumiya <ematsumiya@suse.de>
Cc: git@vger.kernel.org
Subject: Re: [PATCH] pager: fix crash when pager program doesn't exist
Date: Fri, 19 Nov 2021 22:38:14 -0500	[thread overview]
Message-ID: <YZhtplvcVkY0Yzmt@coredump.intra.peff.net> (raw)
In-Reply-To: <20211120030621.2xbcz5usaqkh2ald@cyberdelia>

On Sat, Nov 20, 2021 at 12:06:21AM -0300, Enzo Matsumiya wrote:

> On 11/19, Enzo Matsumiya wrote:
> > > When pager setup succeeds, the second run is a noop, because isatty(1)
> > > is no longer true. But for the case you're interested in, the first one
> > > fails, so we do try again. And I can reproduce your problem with:
> > 
> > No, it's not a noop such as that it's clear that things are different on
> > the second call.
> 
> Here I meant that setup_pager() is effectivelly called from 2 different places:
> 
> First backtrace:
> setup_pager()
> commit_pager_choice()
> run_builtin()
> handle_builtin()
> run_argv()
> cmd_main()
> 
> Second backtrace:
> setup_pager()
> cmd_log_init_finish()
> cmd_log_init()
> cmd_show()
> run_builtin()
> handle_builtin()
> run_argv()
> cmd_main()
> 
> Also, isatty(1) is not false in neither of the calls. Otherwise I
> wouldn't hit this bug (pager would be NULL and setup_pager() a noop as
> you said).

Right, I mean in the "normal" case that the pager actually starts, the
second call hits isatty(1), then git_pager() returns NULL, and we return
from setup_pager() immediately.

It is only in the broken-pager case that the bug you found is triggered
(which is probably why nobody has really noticed it).

-Peff

  reply	other threads:[~2021-11-20  3:38 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-11-19 23:47 [PATCH] pager: fix crash when pager program doesn't exist Enzo Matsumiya
2021-11-20  1:53 ` Jeff King
2021-11-20  2:32   ` Enzo Matsumiya
2021-11-20  3:06     ` Enzo Matsumiya
2021-11-20  3:38       ` Jeff King [this message]
2021-11-20  3:42     ` 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

  List information: http://vger.kernel.org/majordomo-info.html

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

  git send-email \
    --in-reply-to=YZhtplvcVkY0Yzmt@coredump.intra.peff.net \
    --to=peff@peff.net \
    --cc=ematsumiya@suse.de \
    --cc=git@vger.kernel.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.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

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 read-only IMAP folder(s) and NNTP newsgroup(s).