Re: errno oversight
- From
Ævar Arnfjörð Bjarmason <avarab@gmail.com>
- Date
- Dec 8, 2021, 13:00 UTC
- Message-ID
- <211208.86o85rl07m.gmgdl@evledraar.gmail.com>
- In-Reply-To
- <211208.86sfv3l0op.gmgdl@evledraar.gmail.com>
On Wed, Dec 08 2021, Ævar Arnfjörð Bjarmason wrote:
Show 20 quoted lines
> On Wed, Dec 08 2021, Han-Wen Nienhuys wrote:
>
>> In refs.c in origin/next and origin/seen, we have the following fragment:
>
> It's in "master".
>
>> 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.Urg, sorry. Yes obviously that should use the failure_errno from refs_read_raw_ref().
I'll submit a fix for this soon. There's some good post-cleanup to be done here, it seems only one upstream caller of refs_resolve_ref_unsafe() cares about the failure_errno currently (but I didn't look into your reftable code).