all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Eli Zaretskii <eliz@gnu.org>
To: Po Lu <luangruo@yahoo.com>
Cc: sds@gnu.org, 66375@debbugs.gnu.org, eggert@cs.ucla.edu
Subject: bug#66375: 30.0.50; (error "Maximum buffer size exceeded") from (insert-file-contents "/dev/null")
Date: Sat, 07 Oct 2023 10:43:24 +0300	[thread overview]
Message-ID: <83a5su27z7.fsf@gnu.org> (raw)
In-Reply-To: <87sf6naq5a.fsf@yahoo.com> (message from Po Lu on Sat, 07 Oct 2023 14:43:45 +0800)

> From: Po Lu <luangruo@yahoo.com>
> Cc: sds@gnu.org,  Paul Eggert <eggert@cs.ucla.edu>,  66375@debbugs.gnu.org
> Date: Sat, 07 Oct 2023 14:43:45 +0800
> 
> --- a/src/fileio.c
> +++ b/src/fileio.c
> @@ -4746,7 +4746,7 @@ DEFUN ("insert-file-contents", Finsert_file_contents, Sinsert_file_contents,
>        goto handled;
>      }
>  
> -  if (seekable || !NILP (end))
> +  if (((regular || !NILP (end)) && seekable) || !NILP (end))
>      total = end_offset - beg_offset;
>    else
>      /* For a special file, all we can do is guess.  */
> 

This does a couple of redundant tests:

  . regular non-zero means seekable must be non-zero
  . NILP (end) is tested twice for now good reason

I think the above should be cleaned up to better understand the logic.

More generally, I think 'total' should not be computed in this naïve
way when end_offset is -1, i.e. unless end_offset is either the result
of fstat/stat or the result of actually seeking to the end of
file/device.





  reply	other threads:[~2023-10-07  7:43 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
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 [this message]
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=83a5su27z7.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.