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

Junio C Hamano <gitster@pobox.com> writes:

> The change to the code sounds sensible in that it is a move to
> restore the status quo, and we know that the original never intended
> to "fix" the exit status from 128 to 1.  The test change etches the
> status quo in stone, which is a bit more than that and might be
> debatable, but when we someday formally declare that users should
> not be relying on the exit status that are not documented, we would
> hunt for the uses of test_expect_code in the tests and turn this one
> back, and probably do the same to others that are too strict on the
> exact exit status, so I think that half of the change is OK, at
> least for now.
>
> Comments?

An alternative to make this "fix" without setting any policy is to
do this.  That is, to remove the change to the test part and then to
rephrase the tail end of the proposed commit log message.

I can go either way.  I personally prefer our tests not to be overly
strict about behaviors they test, especially the ones we do not
document.

1:  77d0f01405 ! 1:  5f33a843de upload-pack: fix exit code when denying fetch of unreachable object ID
    @@ Commit message
         seems rather clear that this is an unintended side effect of the change
         given that this change in behaviour was not mentioned at all.
     
    -    Fix this regression by exiting with 128 again and tighten one of our
    -    tests to catch such unintended side effects.
    +    Restore the status-quo by exiting with 128.  The test in t5703 to
    +    ensure that "git fetch" fails by using test_must_fail, which does
    +    not care between exiting 1 and 128, so this changes will not affect
    +    any test.
     
         Signed-off-by: Patrick Steinhardt <ps@pks.im>
         Signed-off-by: Junio C Hamano <gitster@pobox.com>
     
    - ## t/t5703-upload-pack-ref-in-want.sh ##
    -@@ t/t5703-upload-pack-ref-in-want.sh: test_expect_success 'server is initially ahead - no ref in want' '
    - 	rm -rf local &&
    - 	cp -r "$LOCAL_PRISTINE" local &&
    - 	inconsistency main $(test_oid numeric) &&
    --	test_must_fail git -C local fetch 2>err &&
    -+	test_expect_code 128 git -C local fetch 2>err &&
    - 	test_i18ngrep "fatal: remote error: upload-pack: not our ref" err
    - '
    - 
    -
      ## upload-pack.c ##
     @@ upload-pack.c: static void check_non_tip(struct upload_pack_data *data)
      			packet_writer_error(&data->writer,

  reply	other threads:[~2023-08-16 16:45 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 [this message]
     [not found]       ` <CABQH79pick0c1UVc+W8n2QtVmSJAjqXcJGtYSm0aahAFDNvE1g@mail.gmail.com>
2023-08-17  5:12         ` Junio C Hamano
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=xmqq8rabey3v.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).