GNU bug report logs - #66375
30.0.50; (error "Maximum buffer size exceeded") from (insert-file-contents "/dev/null")

Previous Next

Package: emacs;

Reported by: sds <at> gnu.org

Date: Fri, 6 Oct 2023 17:13:02 UTC

Severity: normal

Found in version 30.0.50

Full log


View this message in rfc822 format

From: Eli Zaretskii <eliz <at> gnu.org>
To: sds <at> gnu.org, Po Lu <luangruo <at> yahoo.com>, Paul Eggert <eggert <at> cs.ucla.edu>
Cc: 66375 <at> debbugs.gnu.org
Subject: bug#66375: 30.0.50; (error "Maximum buffer size exceeded") from (insert-file-contents "/dev/null")
Date: Sat, 07 Oct 2023 08:54:55 +0300
> From: Sam Steingold <sds <at> gnu.org>
> Date: Fri, 06 Oct 2023 13:11:35 -0400
> 
> 
> emacs -Q
> 
> (insert-file-contents "/dev/null")
> ==>
> Debugger entered--Lisp error: (error "Maximum buffer size exceeded")
>   insert-file-contents("/dev/null")

This is a "feature".  From the doc string:

  When inserting data from a special file (e.g., /dev/urandom), you
  can’t specify VISIT or BEG, and END should be specified to avoid
  inserting unlimited data into the buffer from some special files
  which otherwise could supply infinite amounts of data.

Maybe we could make a special exception for the null-device, whose
name we generally know on each supported system.

Technically, the problem is that the null device is seekable, so this:

  if (seekable || !NILP (end))
    total = end_offset - beg_offset;

computes 'total' to be a very large value, and then this:

  /* Ensure the gap is at least one byte larger than needed for the
     estimated file size, so that in the usual case we read to EOF
     without reallocating.  */
  if (GAP_SIZE <= total)
    make_gap (total - GAP_SIZE + 1);

attempts to make a gap very large, which errors out.  And that is
before we try to read even a single byte from the file.

Po Lu and Paul, any ideas?




This bug report was last modified 1 year and 247 days ago.

Previous Next


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