From: Jeff King <peff@peff.net>
To: "SZEDER Gábor" <szeder.dev@gmail.com>
Cc: "Junio C Hamano" <gitster@pobox.com>,
git@vger.kernel.org, "Ævar Arnfjörð Bjarmason" <avarab@gmail.com>
Subject: Re: Is t7006-pager.sh racy?
Date: Thu, 28 Oct 2021 18:10:05 -0400 [thread overview]
Message-ID: <YXsfvU+faPH6m/m/@coredump.intra.peff.net> (raw)
In-Reply-To: <20211028195527.GA2574@szeder.dev>
On Thu, Oct 28, 2021 at 09:55:27PM +0200, SZEDER Gábor wrote:
> >
> > My usual test for an intentional SIGPIPE is "yes". So something like:
> >
> > git -p \
> > -c core.pager='exit 0' \
> > -c alias.yes='!yes' \
> > yes
> >
> > will reliably trigger SIGPIPE from yes, which git.c will then translate
> > into an exit code of 141.
>
> Oh, that's clever. Alas it's not applicable to our tests, because
> 'yes' is not portable; 8648732e29 (t/test-lib.sh: provide a shell
> implementation of the 'yes' utility, 2009-08-28).
True, though it would be easy enough to do:
git -c alias.yes='!while true; do echo y; done' yes
> > So something like "git log --stdin" works, but you have to contort
> > yourself a bit to make it race-free:
> [...]
> Ugh. I think this would work reliably, but... ugh :)
Yes. :)
> I wonder whether we could do this as a new pair of 'test-tool'
> helpers, one to run the pager through the usual pager-invoking
> machinery and to generate a lot of output, the other to be used as the
> early-exiting pager, with a pipe between the two to ensure that the
> SIGPIPE does happen. Well, essentially the same that you outlined
> above but in C instead of shell, which I somehow find less "ugh".
Maybe, though now we may be diverging from how git.c uses the pager. As
gross as what I wrote is, it is testing the code we want to test, I
think. I am not sure that the alias vs builtin thing is worth caring
about anyway, though, in which case the alias.yes thing above would be
fine.
-Peff
next prev parent reply other threads:[~2021-10-28 22:10 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-10-24 0:04 Is t7006-pager.sh racy? Junio C Hamano
2021-10-24 17:03 ` SZEDER Gábor
2021-10-25 17:41 ` Jeff King
2021-10-28 19:55 ` SZEDER Gábor
2021-10-28 22:10 ` Jeff King [this message]
2021-11-21 18:40 ` Jeff King
2021-11-21 22:05 ` Jeff King
2021-11-21 22:54 ` [PATCH] t7006: clean up SIGPIPE handling in trace2 tests Jeff King
2021-11-21 23:10 ` Jeff King
2021-11-22 2:17 ` Junio C Hamano
2021-11-22 4:51 ` Jeff King
2021-11-22 4:54 ` Jeff King
2021-11-22 5:49 ` Junio C Hamano
2021-11-22 6:05 ` Junio C Hamano
2021-11-22 19:11 ` Jeff King
2021-11-22 21:28 ` [PATCH] run-command: unify signal and regular logic for wait_or_whine() Jeff King
2021-12-01 14:03 ` Is t7006-pager.sh racy? Ævar Arnfjörð Bjarmason
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=YXsfvU+faPH6m/m/@coredump.intra.peff.net \
--to=peff@peff.net \
--cc=avarab@gmail.com \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=szeder.dev@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.
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).