Re: errno oversight
From: Ævar Arnfjörð Bjarmason <hidden>
Date: 2021-12-08 13:01:40
On Wed, Dec 08 2021, Ævar Arnfjörð Bjarmason wrote:
On Wed, Dec 08 2021, Han-Wen Nienhuys wrote:quoted
In refs.c in origin/next and origin/seen, we have the following fragment:It's in "master".quoted
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).