public inbox for libc-alpha@sourceware.org
 help / color / mirror / Atom feed
From: Florian Weimer <fweimer@redhat.com>
To: Andreas Schwab <schwab@suse.de>
Cc: Florian Weimer via Libc-alpha <libc-alpha@sourceware.org>
Subject: Re: [PATCH] Linux: Do not skip d_ino == 0 entries in readdir, readdir64 (bug 12165)
Date: Mon, 19 Sep 2022 11:30:40 +0200	[thread overview]
Message-ID: <878rmfhfsv.fsf@oldenburg.str.redhat.com> (raw)
In-Reply-To: <mvmtu53rbhe.fsf@suse.de> (Andreas Schwab's message of "Mon, 19 Sep 2022 10:53:49 +0200")

* Andreas Schwab:

> On Sep 19 2022, Florian Weimer wrote:
>
>> * Andreas Schwab:
>>
>>> On Sep 19 2022, Florian Weimer via Libc-alpha wrote:
>>>
>>>> -	  if (bytes <= 0)
>>>> -	    {
>>>> -	      /* On some systems getdents fails with ENOENT when the
>>>
>>> Shouldn't that be "some file systems"?
>>>
>>>> -		 open directory has been rmdir'd already.  POSIX.1
>>>> -		 requires that we treat this condition like normal EOF.  */
>>>> -	      if (bytes < 0 && errno == ENOENT)
>>>> -		bytes = 0;
>>>> -
>>>> -	      /* Don't modifiy errno when reaching EOF.  */
>>>> -	      if (bytes == 0)
>>>> -		__set_errno (saved_errno);
>>>> -	      dp = NULL;
>>>> -	      break;
>>>> -	    }
>>>> -	  dirp->size = (size_t) bytes;
>>>> -
>>>> -	  /* Reset the offset into the buffer.  */
>>>> -	  dirp->offset = 0;
>>>> +	  /* Linux fails with ENOENT if IS_DEADDIR is true for the
>>>
>>> What is IS_DEADDIR?
>>
>> It's an internal Linux construct.  Isn't this clear from the context?
>
> I'd rather keep the original comment with the missing word added.  I
> find it easier to understand without the reference to kernel internals.

What about this?

	  /* Linux may fail with ENOENT on some file systems if the
	     directory inode is marked as dead (deleted).  POSIX
	     treats this as a regular end-of-directory condition, so
	     do not set errno in that case, to indicate success.  */

Thanks,
Florian


  reply	other threads:[~2022-09-19  9:30 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-09-19  6:54 Florian Weimer
2022-09-19  8:26 ` Andreas Schwab
2022-09-19  8:30   ` Florian Weimer
2022-09-19  8:53     ` Andreas Schwab
2022-09-19  9:30       ` Florian Weimer [this message]
2022-09-19  9:58         ` Andreas Schwab

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=878rmfhfsv.fsf@oldenburg.str.redhat.com \
    --to=fweimer@redhat.com \
    --cc=libc-alpha@sourceware.org \
    --cc=schwab@suse.de \
    /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 read-only IMAP folder(s) and NNTP newsgroup(s).