All of lore.kernel.org
 help / color / mirror / Atom feed
From: Johannes Schindelin <Johannes.Schindelin@gmx.de>
To: Johannes Sixt <j6t@kdbg.org>
Cc: git@vger.kernel.org, Junio C Hamano <gitster@pobox.com>,
	Jeff King <peff@peff.net>
Subject: Re: [PATCH 2/6] t1406: prepare for the refs code to fail with BUG()
Date: Tue, 1 May 2018 13:04:14 +0200 (DST)	[thread overview]
Message-ID: <nycvar.QRO.7.76.6.1805011257400.79@tvgsbejvaqbjf.bet> (raw)
In-Reply-To: <7087f0b9-1362-f8ca-315d-96d27b91b26b@kdbg.org>

Hi Hannes,

On Mon, 30 Apr 2018, Johannes Sixt wrote:

> Am 30.04.2018 um 00:17 schrieb Johannes Schindelin:
> > t1406 specifically verifies that certain code paths fail with a BUG: ...
> > message.
> > 
> > In the upcoming commit, we will convert that message to be generated via
> > BUG() instead of die("BUG: ..."), which implies SIGABRT instead of a
> > regular exit code.
> >
> > [...]
> >
> >   test_expect_success 'create-reflog() not allowed' '
> > -	test_must_fail $RUN create-reflog HEAD 1
> > +	test_must_fail ok=sigabrt $RUN create-reflog HEAD 1
> >   '
> 
> I can't quite follow the rationale for this change. A 'BUG' error exit must
> never be reached, otherwise it is a bug in the program by definition. It
> cannot be OK that SIGABRT is a valid result from Git.

I thought so at first, too. However, what these test cases run is not Git
itself. Instead, they run a t/helper/ command *specifically* designed to
hit the BUG code path, probably to ensure that bugs in future code will
actually not be silently ignored, but do exit with an error.

> If SIGABRT occurs as a result of BUG(), and we know that this happens for
> certain cases, it means we have an unfixed bug.

Not in this case: The code in question is in
https://github.com/git/git/blob/v2.17.0/t/helper/test-ref-store.c#L190-L201
and it is called in a way that fails to have the required flags for the
operation. This would normally indicate a bug, but in this case, that is
exactly what the regression test tries to trigger: we *want* such a bug to
cause a failure.

I'll do my best to clarify that in the commit message.

Ciao,
Dscho

  reply	other threads:[~2018-05-01 11:04 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-04-29 22:17 [PATCH 0/6] Finish the conversion from die("BUG: ...") to BUG() Johannes Schindelin
2018-04-29 22:17 ` [PATCH 1/6] test_must_fail: support ok=sigabrt Johannes Schindelin
2018-04-29 22:17 ` [PATCH 2/6] t1406: prepare for the refs code to fail with BUG() Johannes Schindelin
2018-04-30 19:32   ` Johannes Sixt
2018-05-01 11:04     ` Johannes Schindelin [this message]
2018-05-01 11:22       ` Duy Nguyen
2018-05-01 11:26   ` Duy Nguyen
2018-05-02  3:40     ` Junio C Hamano
2018-05-02  7:41       ` Johannes Schindelin
2018-05-02 10:41         ` Junio C Hamano
2018-04-29 22:18 ` [PATCH 3/6] refs/*: report bugs using the BUG() macro Johannes Schindelin
2018-04-29 22:18 ` [PATCH 4/6] run-command: use BUG() to report bugs, not die() Johannes Schindelin
2018-04-29 22:19 ` [PATCH 5/6] Replace all die("BUG: ...") calls by BUG() ones Johannes Schindelin
2018-04-29 22:19 ` [PATCH 6/6] Convert remaining die*(BUG) messages Johannes Schindelin
2018-04-30  2:53   ` Eric Sunshine

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=nycvar.QRO.7.76.6.1805011257400.79@tvgsbejvaqbjf.bet \
    --to=johannes.schindelin@gmx.de \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=j6t@kdbg.org \
    --cc=peff@peff.net \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.