Subject: bug#75569: 30.0.93; Large /proc/* file are read incompletely

From: Eli Zaretskii <[email-masked]>
Date: Thu, 16 Jan 2025 10:55:46 +0200

> Date: Wed, 15 Jan 2025 22:58:31 -0800
> Cc: [email-masked], [email-masked], [email-masked]
> From: Paul Eggert <[email-masked]>
> 
> On 2025-01-15 22:18, Eli Zaretskii wrote:
> 
> > So you are saying that the condition should be
> > 
> >     if ((regular && st.st_size > 0) || seekable || !NILP (end))
> 
> regular implies seekable, so that doesn't look right either.

Then how about

  if ((regular && st.st_size > 0) || (!regular && seekable) || !NILP (end))

> I was 
> thinking that rather than replace "seekable" with "(seekable && st.size 
>  > 0)" or with "(regular && st.st_size > 0) || seekable", one should 
> replace "seekable" with "(regular && st.st_size > 0)".

That would exclude non-regular files that are seekable, which would be
a regression, I think.

> There's another thing. On some platforms these /proc regular files have 
> nonzero size. On at least one of these platforms (Solaris) the size is 
> accurate (though it may change at any time); on others, I vaguely recall 
> that it's a small nonzero fixed size (I don't remember which systems do 
> that, unfortunately).

If the size is non-zero and accurate, it should already work, because
this is just how "normal" files behave.  If the size is non-zero and
inaccurate, do we currently support that, e.g., if the file grows
while we read it?