GNU bug report logs - #79031
31.0.50; Recent change breaks `insert-file-contents-literally'

Previous Next

Package: emacs;

Reported by: Zhengyi Fu <i <at> fuzy.me>

Date: Wed, 16 Jul 2025 13:14:02 UTC

Severity: normal

Found in version 31.0.50

Done: Paul Eggert <eggert <at> cs.ucla.edu>

Full log


View this message in rfc822 format

From: help-debbugs <at> gnu.org (GNU bug Tracking System)
To: Paul Eggert <eggert <at> cs.ucla.edu>
Cc: tracker <at> debbugs.gnu.org
Subject: bug#79031: closed (31.0.50; Recent change breaks `insert-file-contents-literally')
Date: Wed, 16 Jul 2025 18:48:02 +0000
[Message part 1 (text/plain, inline)]
Your message dated Wed, 16 Jul 2025 11:47:30 -0700
with message-id <91b6f1a4-efc3-4f3e-b695-071ad09e7ae7 <at> cs.ucla.edu>
and subject line Re: 31.0.50; Recent change breaks `insert-file-contents-literally'
has caused the debbugs.gnu.org bug report #79031,
regarding 31.0.50; Recent change breaks `insert-file-contents-literally'
to be marked as done.

(If you believe you have received this mail in error, please contact
help-debbugs <at> gnu.org.)


-- 
79031: https://debbugs.gnu.org/cgi/bugreport.cgi?bug=79031
GNU Bug Tracking System
Contact help-debbugs <at> gnu.org with problems
[Message part 2 (message/rfc822, inline)]
From: Zhengyi Fu <i <at> fuzy.me>
To: bug-gnu-emacs <at> gnu.org
Cc: Paul Eggert <eggert <at> cs.ucla.edu>
Subject: 31.0.50; Recent change breaks `insert-file-contents-literally'
Date: Wed, 16 Jul 2025 21:13:08 +0800
> commit c3f96d20eecdf0aa93f294a4f3fb96e16eec6a68 (HEAD)
> Author: Paul Eggert <eggert <at> cs.ucla.edu>
> Date:   Sun Jul 13 12:52:43 2025 -0700

>     Avoid some tiny /proc file reads
    
>     * src/fileio.c (union read_non_regular):
>     New members buf and bufsize replace inserted and trytry.
>     (read_non_regular): Adjust to this new, simpler interface.
>     (Finsert_file_contents): If the gap is smaller than read_buf
>     and we want to read more than the gap, read into read_buf
>     first, to avoid lots of tiny reads from /proc files.


After this commit, the following code evaluates to a string of 16384
bytes!

(with-temp-buffer
  (insert-file-contents-literally "/dev/urandom" nil nil 21)
  (buffer-string))



In GNU Emacs 31.0.50 (build 20, x86_64-pc-linux-gnu, GTK+ Version
 3.24.49) of 2025-07-16 built on calliope
Repository revision: 55f41ca3aa8fe487d10730708a7396137a2c9d18
Repository branch: HEAD
System Description: Fedora Linux 42 (Sway)

Configured using:
 'configure --without-all 'CC=ccache gcc' 'CFLAGS=-O0 -g''

Configured features:
GLIB GMP PDUMPER SECCOMP X11 XIM XINERAMA XRANDR GTK3

Important settings:
  value of $LANG: zh_CN.UTF-8
  locale-coding-system: utf-8-unix

Major mode: Lisp Interaction

Minor modes in effect:
  xterm-mouse-mode: t
  tooltip-mode: t
  global-eldoc-mode: t
  eldoc-mode: t
  show-paren-mode: t
  electric-indent-mode: t
  mouse-wheel-mode: t
  tool-bar-mode: t
  menu-bar-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  blink-cursor-mode: t
  minibuffer-regexp-mode: t
  line-number-mode: t
  indent-tabs-mode: t
  transient-mark-mode: t
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t

Load-path shadows:
None found.

Features:
(shadow sort mail-extr emacsbug lisp-mnt message mailcap yank-media puny
dired dired-loaddefs rfc822 mml mml-sec password-cache epa derived epg
rfc6068 epg-config gnus-util text-property-search time-date subr-x
mm-decode mm-bodies mm-encode mail-parse rfc2231 mailabbrev gmm-utils
mailheader cl-loaddefs cl-lib sendmail rfc2047 rfc2045 ietf-drums
mm-util mail-prsvr mail-utils xt-mouse term/xterm xterm byte-opt gv
bytecomp byte-compile china-util rmc iso-transl tooltip cconv eldoc
paren electric uniquify ediff-hook vc-hooks lisp-float-type elisp-mode
mwheel term/x-win x-win term/common-win x-dnd touch-screen tool-bar dnd
fontset image regexp-opt fringe tabulated-list replace newcomment
text-mode lisp-mode prog-mode register page tab-bar menu-bar rfn-eshadow
isearch easymenu timer select scroll-bar mouse jit-lock font-lock syntax
font-core term/tty-colors frame minibuffer nadvice seq simple cl-generic
indonesian philippine cham georgian utf-8-lang misc-lang vietnamese
tibetan thai tai-viet lao korean japanese eucjp-ms cp51932 hebrew greek
romanian slovak czech european ethiopic indian cyrillic chinese
composite emoji-zwj charscript charprop case-table epa-hook
jka-cmpr-hook help abbrev obarray oclosure cl-preloaded button loaddefs
theme-loaddefs faces cus-face macroexp files window text-properties
overlay sha1 md5 base64 format env code-pages mule custom widget keymap
hashtable-print-readable backquote dynamic-setting gtk x-toolkit x
multi-tty move-toolbar make-network-process tty-child-frames emacs)

Memory information:
((conses 16 52730 12168) (symbols 48 6171 0) (strings 32 14442 1585)
 (string-bytes 1 353806) (vectors 16 8063)
 (vector-slots 8 120952 7572) (floats 8 26 1) (intervals 56 220 10)
 (buffers 984 10))


[Message part 3 (message/rfc822, inline)]
From: Paul Eggert <eggert <at> cs.ucla.edu>
To: Zhengyi Fu <i <at> fuzy.me>
Cc: 79031-done <at> debbugs.gnu.org
Subject: Re: 31.0.50; Recent change breaks `insert-file-contents-literally'
Date: Wed, 16 Jul 2025 11:47:30 -0700
[Message part 4 (text/plain, inline)]
On 2025-07-16 06:13, Zhengyi Fu wrote:
> the following code evaluates to a string of 16384
> bytes!
> 
> (with-temp-buffer
>    (insert-file-contents-literally "/dev/urandom" nil nil 21)
>    (buffer-string))

Thanks for reporting that. I installed the attached patch.
[0001-insert-file-contents-small-gap-bug.patch (text/x-patch, attachment)]

This bug report was last modified 26 days ago.

Previous Next


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