GNU bug report logs - #75569
30.0.93; Large /proc/* file are read incompletely

Previous Next

Package: emacs;

Reported by: Daniel Mendler <mail <at> daniel-mendler.de>

Date: Wed, 15 Jan 2025 00:22:01 UTC

Severity: normal

Found in version 30.0.93

Done: Eli Zaretskii <eliz <at> gnu.org>

Bug is archived. No further changes may be made.

Full log


Message #23 received at 75569 <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: Paul Eggert <eggert <at> cs.ucla.edu>
Cc: mail <at> daniel-mendler.de, 75569 <at> debbugs.gnu.org, juri <at> linkov.net
Subject: Re: bug#75569: 30.0.93; Large /proc/* file are read incompletely
Date: Thu, 16 Jan 2025 08:18:42 +0200
> Date: Wed, 15 Jan 2025 13:08:10 -0800
> Cc: mail <at> daniel-mendler.de, 75569 <at> debbugs.gnu.org
> From: Paul Eggert <eggert <at> cs.ucla.edu>
> 
> On 2025-01-15 12:07, Eli Zaretskii wrote:
> > -  if (seekable || !NILP (end))
> > +  if ((seekable && st.size > 0) || !NILP (end))
> 
> Presumably you meant st.st_size.

(Blush) yes, sorry.

> However, POSIX does not specify the 
> value of st.st_size for every seekable file. Instead, when reading Emacs 
> should look at st.st_size only for regular files, shared memory objects, 
> and typed memory objects (the last two are rare enough that we don't 
> need to bother to optimize for them).

So you are saying that the condition should be

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

is that right?

> Also, there are other uses of 'seekable' in the code that probably need 
> a similar treatment.

There are only two more:

	/* 'try' is reserved in some compilers (Microsoft C).  */
	ptrdiff_t trytry = min (gap_size, READ_BUF_SIZE);
	if (seekable || !NILP (end))
	  trytry = min (trytry, total - inserted);

	if (!seekable && NILP (end))
	  {

AFAIU, the additional conditions are not needed for these two uses,
because:

  . 'total' is already computed correctly at that point for the
    regular zero-size files
  . only non-regular files can be !seekable

Or am I missing something?

Thanks.




This bug report was last modified 165 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.