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

Re: [PATCH] git_open_noatime: return with errno=0 on success

From
Eric Sunshine <sunshine@sunshineco.com>
Date
Jul 8, 2015, 18:51 UTC
Message-ID
<CAPig+cSacM_JwZzagOVZpMJF=oE7m3rMnq1eKr=aNsGY0vvmfQ@mail.gmail.com>
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:

Show 10 quoted lines
> 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/
Show 10 quoted lines
> 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>
Previous: Clemens BuchacherNext: Clemens Buchacher
Message 2 of 7 in “git_open_noatime: return with errno=0 on success”
  1. git_open_noatime: return with errno=0 on successClemens Buchacher, Jul 8, 2015
  2. Eric SunshineJul 8, 2015
  3. git_open_noatime: return with errno=0 on successClemens Buchacher, Aug 4, 2015
  4. Junio C HamanoAug 4, 2015
  5. Linus TorvaldsAug 5, 2015
  6. Clemens BuchacherAug 5, 2015
  7. Junio C HamanoAug 5, 2015

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.