git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: Derrick Stolee <derrickstolee@github.com>
Cc: Patrick Steinhardt <ps@pks.im>, git@vger.kernel.org
Subject: Re: [PATCH] upload-pack: fix exit code when denying fetch of unreachable object ID
Date: Wed, 16 Aug 2023 22:12:18 -0700	[thread overview]
Message-ID: <xmqqa5uqckwd.fsf@gitster.g> (raw)
In-Reply-To: <CABQH79pick0c1UVc+W8n2QtVmSJAjqXcJGtYSm0aahAFDNvE1g@mail.gmail.com> (Derrick Stolee's message of "Wed, 16 Aug 2023 13:16:29 -0400")

Derrick Stolee <derrickstolee@github.com> writes:

[jc: the message I am responding to may not be on the list archive,
 as it was multipart/alternative with text/html in it, but I think
 the main point from you can be seen by others only from the parts
 I quoted here].

> While I don't think we should document that the exit code has
> a special meaning for the builtin, adding the test will help
> prevent another accidental change in the future. If the patch is
> worth taking (to fix the accidental change) then I think the test
> should stay, so we don't make this change accidentally again.

I think my stance is a bit more nuanced, in that the first half of
the patch to make us exit with 128 is worth taking, simply because
we did not have to and did not intend to change the exit status, but
the other half of the patch, using test_expect_code in the test
suite, sends a wrong message that somehow exact value of non-zero
exit status in this particular case matters.

To put it another way, if your patch to shuffle the calls for two
error messages, concluded with a call to exit(), were written in the
ideal world, you would have passed 128 to exit(), *and* you wouldn't
have added any test that says "fetch should exit with 128 and not 1
when it fails".  I aimed to massage Patrick's patch so that the
original patch from you will become that patch in the ideal world
when it is squashed in.

> To my view, test cases can change in the future as long as
> there is good justification in doing so. Having existing tests
> helps to demonstrate a change in behavior.

I agree with that 100%, but the thing is that the error shuffling
patch will not escape 'next' until the upcoming release, at which
time we can rewind and redo 'next'.  I think the first half of
Patrick's fix would be a good material to squash into that patch,
which would make the result identical to the one that would have
been written in the ideal world I described above.

And the other half would not have a place to be in that patch in the
ideal world.  IOW, there is no "change in behaviour" we want to
demonstrate here, as we will pretend nothing bad happened after the
upcoming release ;-)

Thanks.

  parent reply	other threads:[~2023-08-17  5:13 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-08-10 14:40 [PATCH] upload-pack: fix race condition in error messages Derrick Stolee via GitGitGadget
2023-08-10 16:14 ` Junio C Hamano
2023-08-16  6:06 ` [PATCH] upload-pack: fix exit code when denying fetch of unreachable object ID Patrick Steinhardt
2023-08-16 16:16   ` Junio C Hamano
2023-08-16 16:44     ` Junio C Hamano
     [not found]       ` <CABQH79pick0c1UVc+W8n2QtVmSJAjqXcJGtYSm0aahAFDNvE1g@mail.gmail.com>
2023-08-17  5:12         ` Junio C Hamano [this message]
2023-08-17 10:07           ` Patrick Steinhardt
2023-08-17  5:27       ` Jeff King
2023-08-16 17:04     ` [Leftoverbits] exit code clean-up? Junio C Hamano
2023-08-17  5:36       ` Jeff King
2023-08-17 16:03         ` Junio C Hamano
2023-08-17  9:24       ` Oswald Buddenhagen

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=xmqqa5uqckwd.fsf@gitster.g \
    --to=gitster@pobox.com \
    --cc=derrickstolee@github.com \
    --cc=git@vger.kernel.org \
    --cc=ps@pks.im \
    /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).