git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH] Correctly report corrupted objects

From
Junio C Hamano <gitster@pobox.com>
Date
Jan 20, 2011, 21:17 UTC
Message-ID
<7voc7bqnpu.fsf@alter.siamese.dyndns.org>
In-Reply-To
<7vsjwnqoao.fsf@alter.siamese.dyndns.org>
Junio C Hamano <gitster@pobox.com> writes:
Show 17 quoted lines
> Björn Steinbrink <B.Steinbrink@gmx.de> writes:
>
>> The errno check added in commit 3ba7a06 "A loose object is not corrupt
>> if it cannot be read due to EMFILE" only checked for whether errno is
>> not ENOENT and thus incorrectly treated "no error" as an error
>> condition.
>>
>> Because of that, it never reached the code path that would report that
>> the object is corrupted and instead caused funny errors like:
>>
>>   fatal: failed to read object 333c4768ce595793fdab1ef3a036413e2a883853: Success
>>
>> So we have to extend the check to cover the case in which the object
>> file was successfully read, but its contents are corrupted.
>
> Hmm, what is the exact code path that read_object() callchain fails to set
> errno when it returns a NULL?  It is unclear from the above description.

Ah, nevermind. I wasn't thinking. If for example unpack_sha1_header() says the type bits are garbled, it will return -1 without having any system calls failed up to that point (because the file itself was mmapped and read correctly) and the calling unpack_sha1_file() will return NULL.

Previous: Junio C Hamano
Message 3 of 3 in “Correctly report corrupted objects”
  1. Correctly report corrupted objectsBjörn Steinbrink, Jan 20, 2011
  2. Junio C HamanoJan 20, 2011
  3. Junio C HamanoJan 20, 2011

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.