all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Eli Zaretskii <eliz@gnu.org>
To: sds@gnu.org, Po Lu <luangruo@yahoo.com>,
	Paul Eggert <eggert@cs.ucla.edu>
Cc: 66375@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	[thread overview]
Message-ID: <83o7hb0yfk.fsf@gnu.org> (raw)
In-Reply-To: <87cyxru14o.fsf@gnu.org> (message from Sam Steingold on Fri, 06 Oct 2023 13:11:35 -0400)

> From: Sam Steingold <sds@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?





  reply	other threads:[~2023-10-07  5:54 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-10-06 17:11 bug#66375: 30.0.50; (error "Maximum buffer size exceeded") from (insert-file-contents "/dev/null") Sam Steingold
2023-10-07  5:54 ` Eli Zaretskii [this message]
2023-10-07  6:43   ` Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-10-07  7:43     ` Eli Zaretskii
2023-10-09  1:57   ` Sam Steingold
2023-10-09 10:56     ` Eli Zaretskii
2023-10-15 15:43       ` Sam Steingold
2023-10-15 16:33         ` Eli Zaretskii
2023-10-15 16:44           ` Sam Steingold
2023-10-15 18:22             ` Eli Zaretskii
2023-12-14 16:46 ` Ed Santiago
2023-12-14 18:43   ` Eli Zaretskii

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=83o7hb0yfk.fsf@gnu.org \
    --to=eliz@gnu.org \
    --cc=66375@debbugs.gnu.org \
    --cc=eggert@cs.ucla.edu \
    --cc=luangruo@yahoo.com \
    --cc=sds@gnu.org \
    /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.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.