git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Eric Sunshine <sunshine@sunshineco.com>
To: Clemens Buchacher <clemens.buchacher@intel.com>
Cc: "Git List" <git@vger.kernel.org>,
	"Linus Torvalds" <torvalds@linux-foundation.org>,
	"Martin Schröder" <martin.h.schroeder@intel.com>
Subject: Re: [PATCH] git_open_noatime: return with errno=0 on success
Date: Wed, 8 Jul 2015 14:51:31 -0400	[thread overview]
Message-ID: <CAPig+cSacM_JwZzagOVZpMJF=oE7m3rMnq1eKr=aNsGY0vvmfQ@mail.gmail.com> (raw)
In-Reply-To: <20150708123820.GA25269@musxeris015.imu.intel.com>

On Wed, Jul 8, 2015 at 8:38 AM, Clemens Buchacher
<clemens.buchacher@intel.com> wrote:
> In read_sha1_file_extended we die if read_object fails with a fatal
> error. We detect a fatal error if errno is non-zero and is not
> ENOENT. If the object could not be read because it does not exist,
> this is not considered a fatal error and we want to return NULL.
>
> Somewhere down the line, read_object calls git_open_noatime to open
> a pack index file, for example. We first try open with O_NOATIME.
> If O_NOATIME fails with EPERM, we retry without O_NOATIME. When the
> second open succeeds, errno is however still set to EPERM from the
> first attemt. When we finally determine that the object does not

s/attemt/attempt/

> exist, read_object returns NULL and read_sha1_file_extended dies
> with a fatal error:
>
>     fatal: failed to read object <sha1>: Operation not permitted
>
> Fix this by resetting errno to zero before we call open again.
>
> Cc: Linus Torvalds <torvalds@linux-foundation.org>
> Signed-off-by: Clemens Buchacher <clemens.buchacher@intel.com>
> Helped-by: Martin Schröder <martin.h.schroeder@intel.com>

  reply	other threads:[~2015-07-08 18:51 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-07-08 12:38 [PATCH] git_open_noatime: return with errno=0 on success Clemens Buchacher
2015-07-08 18:51 ` Eric Sunshine [this message]
2015-08-04  8:24   ` Clemens Buchacher
2015-08-04 21:03     ` Junio C Hamano
2015-08-05  8:59       ` Linus Torvalds
2015-08-05 14:36         ` Clemens Buchacher
2015-08-05 16:27           ` Junio C Hamano

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='CAPig+cSacM_JwZzagOVZpMJF=oE7m3rMnq1eKr=aNsGY0vvmfQ@mail.gmail.com' \
    --to=sunshine@sunshineco.com \
    --cc=clemens.buchacher@intel.com \
    --cc=git@vger.kernel.org \
    --cc=martin.h.schroeder@intel.com \
    --cc=torvalds@linux-foundation.org \
    /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).