git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Han-Wen Nienhuys <hanwen@google.com>
To: "Ævar Arnfjörð Bjarmason" <avarab@gmail.com>
Cc: git <git@vger.kernel.org>
Subject: Re: errno oversight
Date: Wed, 8 Dec 2021 14:05:10 +0100	[thread overview]
Message-ID: <CAFQ2z_MmWywH2AH3YaB+v67e-0jNsH9sz8dgqYenQNM6Gqz_Hw@mail.gmail.com> (raw)
In-Reply-To: <211208.86sfv3l0op.gmgdl@evledraar.gmail.com>

On Wed, Dec 8, 2021 at 1:51 PM Ævar Arnfjörð Bjarmason <avarab@gmail.com> wrote:
> > In refs.c in origin/next and origin/seen, we have the following fragment:
>
> It's in "master".

Correct, but it's also in seen.

> >                    if (refs_read_raw_ref(refs, refname, oid, &sb_refname,
> >                                       &read_flags, failure_errno)) {
> >                         *flags |= read_flags;
> >                         if (errno)
> >                                 *failure_errno = errno;
> >
> > overwriting failure_errno looks like an oversight?
>
> This is from my ef18119dec8 (refs API: add a version of
> refs_resolve_ref_unsafe() with "errno", 2021-10-16).
>
> I don't see the bug here, overwriting *failure_errno is the point of
> that variable. We're keeping the right errno value right after a
> failure, and passing it up to our caller.

The reftable code for refs_read_raw_ref places a sensible value into
its failure_errno argument. Then the "if (errno)" replaces it with
whatever the outcome of the last syscall was. I started the errno work
to get rid of this kind of global state manipulation; am I missing
something?

-- 
Han-Wen Nienhuys - Google Munich
I work 80%. Don't expect answers from me on Fridays.
--

Google Germany GmbH, Erika-Mann-Strasse 33, 80636 Munich

Registergericht und -nummer: Hamburg, HRB 86891

Sitz der Gesellschaft: Hamburg

Geschäftsführer: Paul Manicle, Halimah DeLaine Prado

      parent reply	other threads:[~2021-12-08 13:05 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-12-08 11:38 errno oversight Han-Wen Nienhuys
2021-12-08 12:47 ` Ævar Arnfjörð Bjarmason
2021-12-08 13:00   ` Ævar Arnfjörð Bjarmason
2021-12-08 19:02     ` Junio C Hamano
2021-12-09  5:02       ` [PATCH 0/3] refs: ab/refs-errno-cleanup fixup + remove "failure_errno" Ævar Arnfjörð Bjarmason
2021-12-09  5:02         ` [PATCH 1/3] refs API: use "failure_errno", not "errno" Ævar Arnfjörð Bjarmason
2021-12-09  5:02         ` [PATCH 2/3] sequencer: don't use die_errno() on refs_resolve_ref_unsafe() failure Ævar Arnfjörð Bjarmason
2021-12-09  5:02         ` [PATCH 3/3] refs API: remove "failure_errno" from refs_resolve_ref_unsafe() Ævar Arnfjörð Bjarmason
2021-12-12 19:53         ` [PATCH v2 0/3] refs: ab/refs-errno-cleanup fixup + remove "failure_errno" Ævar Arnfjörð Bjarmason
2021-12-12 19:53           ` [PATCH v2 1/3] refs API: use "failure_errno", not "errno" Ævar Arnfjörð Bjarmason
2021-12-12 19:53           ` [PATCH v2 2/3] sequencer: don't use die_errno() on refs_resolve_ref_unsafe() failure Ævar Arnfjörð Bjarmason
2021-12-12 19:53           ` [PATCH v2 3/3] refs API: remove "failure_errno" from refs_resolve_ref_unsafe() Ævar Arnfjörð Bjarmason
2022-01-12 12:36           ` [PATCH v3 0/3] For v2.35.0: refs: ab/refs-errno-cleanup fixup + remove "failure_errno" Ævar Arnfjörð Bjarmason
2022-01-12 12:36             ` [PATCH v3 1/3] refs API: use "failure_errno", not "errno" Ævar Arnfjörð Bjarmason
2022-01-12 19:59               ` Junio C Hamano
2022-01-13 12:14                 ` Ævar Arnfjörð Bjarmason
2022-01-12 12:36             ` [PATCH v3 2/3] sequencer: don't use die_errno() on refs_resolve_ref_unsafe() failure Ævar Arnfjörð Bjarmason
2022-01-12 20:02               ` Junio C Hamano
2022-01-12 12:36             ` [PATCH v3 3/3] refs API: remove "failure_errno" from refs_resolve_ref_unsafe() Ævar Arnfjörð Bjarmason
2022-01-12 19:34             ` [PATCH v3 0/3] For v2.35.0: refs: ab/refs-errno-cleanup fixup + remove "failure_errno" Junio C Hamano
2022-01-13 12:22               ` Ævar Arnfjörð Bjarmason
2022-01-13 18:54                 ` Junio C Hamano
2022-01-14 12:21                   ` Ævar Arnfjörð Bjarmason
2022-01-26 14:36               ` [PATCH v4 0/2] refs: remove the last use of "errno" from the public API Ævar Arnfjörð Bjarmason
2022-01-26 14:37                 ` [PATCH v4 1/2] sequencer: don't use die_errno() on refs_resolve_ref_unsafe() failure Ævar Arnfjörð Bjarmason
2022-01-26 23:57                   ` Junio C Hamano
2022-01-26 14:37                 ` [PATCH v4 2/2] refs API: remove "failure_errno" from refs_resolve_ref_unsafe() Ævar Arnfjörð Bjarmason
2021-12-08 13:05   ` Han-Wen Nienhuys [this message]

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=CAFQ2z_MmWywH2AH3YaB+v67e-0jNsH9sz8dgqYenQNM6Gqz_Hw@mail.gmail.com \
    --to=hanwen@google.com \
    --cc=avarab@gmail.com \
    --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).