From: Johannes Sixt <j.sixt@viscovery.net>
To: kusmabite@gmail.com
Cc: Junio C Hamano <gitster@pobox.com>,
git@vger.kernel.org, msysGit <msysgit@googlegroups.com>
Subject: Re: [PATCH 2/2] A loose object is not corrupt if it cannot be read due to EMFILE
Date: Thu, 18 Nov 2010 17:43:00 +0100 [thread overview]
Message-ID: <4CE55794.7050201@viscovery.net> (raw)
In-Reply-To: <AANLkTi=L1Z6kxubMf3yPUfpY9ugd+Qan+yCxi3dp4oR4@mail.gmail.com>
Am 11/18/2010 15:19, schrieb Erik Faye-Lund:
> What happens, is that read_object returns NULL, but errno is 0.
> Further, it looks to me like read_object can only return NULL through
> the unpack_sha1_file (problem with the compressed data) or
> read_packed_sha1 (find_pack_entry() failure) code-paths.
>
> errno is set to ENOENT by open_sha1_file (through map_sha1_file)
> before any possible error-points. I guess this makes the "errno = 0"
> redundant, but I think it improves readability of the code. I'm
> guessing that errno gets overwritten by some other call, losing the
> ENOENT. Perhaps some unintended side-effect of one of the
> compat/mingw.[ch]-wrappers?
The problem is in opendir() called via prepare_packed_git_one() via
prepare_packed_git(). It resets errno to 0 on success.
You can test this easily by inserting test_done after the 3rd test of
t5530 and run it with --debug; in the trash-directory you can run
../../git-pack-objects --revs --all --stdout >/dev/null </dev/null
and observe the different failure modes on Windows and Linux.
This makes me question whether the approach of Junio's fix is sane. It
depends on errno being set *way* before it is checked and after *a*lot* of
potentially failing system and library calls have been called. Which
function is it that is expected to fail with ENOENT? git_open_noatime()?
-- Hannes
next prev parent reply other threads:[~2010-11-18 16:43 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-10-28 20:53 [PATCH 1/2] read_sha1_file(): report correct name of packfile with a corrupt object Junio C Hamano
2010-10-28 20:53 ` [PATCH 2/2] A loose object is not corrupt if it cannot be read due to EMFILE Junio C Hamano
2010-11-18 14:19 ` Erik Faye-Lund
2010-11-18 16:43 ` Johannes Sixt [this message]
2010-11-18 17:21 ` Erik Faye-Lund
2010-11-18 17:29 ` Jonathan Nieder
2010-11-18 18:18 ` Erik Faye-Lund
2010-11-18 18:23 ` Casey Dahlin
2010-11-18 20:27 ` Jonathan Nieder
2010-10-29 8:08 ` [PATCH 1/2] read_sha1_file(): report correct name of packfile with a corrupt object Johannes Sixt
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=4CE55794.7050201@viscovery.net \
--to=j.sixt@viscovery.net \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=kusmabite@gmail.com \
--cc=msysgit@googlegroups.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.