From: Thomas Rast <trast@inf.ethz.ch>
To: <git@vger.kernel.org>
Cc: Junio C Hamano <gitster@pobox.com>
Subject: Bug: bad errno report from lock_ref_sha1_basic() when contents bad
Date: Mon, 2 Apr 2012 12:04:29 +0200 [thread overview]
Message-ID: <878viephzm.fsf@thomas.inf.ethz.ch> (raw)
Hi Junio,
User "mbrochh" on IRC reported a result along the lines of
error: unable to resolve reference refs/remotes/origin/master: Success
! [new branch] master -> origin/master (unable to update local ref)
from 'git fetch' (or pull actually, but clearly it's the fetch part
failing). This error message is from lock_ref_sha1_basic(), and
suggests a confused error exit taken with errno=0.
I can reproduce the problem by writing a bit of garbage to a remote ref
and then fetching, though I usually get some other error in the message
(usually ENOENT, which is equally wrong).
As far as I can tell it's caused by resolve_ref_unsafe() returning NULL
when the content checks fail:
if (get_sha1_hex(buffer, sha1) || (buffer[40] != '\0' && !isspace(buffer[40]))) {
if (flag)
*flag |= REF_ISBROKEN;
return NULL;
}
This used to warn before your 5595635 (resolve_ref(): report breakage to
the caller without warning, 2011-10-19), but otherwise suffered from the
same problem.
As far as I can see lock_ref_sha1_basic() needs a similar check for
REF_ISBROKEN (and presumably the only fix is to nuke it so maybe it
should even suggest that to the user). But in general, the "errno may
be crucial or worthless" interface of lock_ref_sha1_basic() seems a bit
broken...
--
Thomas Rast
trast@{inf,student}.ethz.ch
next reply other threads:[~2012-04-02 10:04 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-04-02 10:04 Thomas Rast [this message]
2012-04-02 17:30 ` Bug: bad errno report from lock_ref_sha1_basic() when contents bad Junio C Hamano
2012-04-02 18:12 ` Thomas Rast
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
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=878viephzm.fsf@thomas.inf.ethz.ch \
--to=trast@inf.ethz.ch \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
/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.
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 NNTP newsgroup(s).