GNU bug report logs -
#77315
31.0.50; Crash in Finsert_file_contents, file size changed
Previous Next
Full log
Message #32 received at 77315 <at> debbugs.gnu.org (full text, mbox):
[Message part 1 (text/plain, inline)]
On 2025-06-07 03:52, Pip Cet wrote:
> I'm hitting this bug with some regularity (and working around it by
> force-returning from Finsert_file_contents in gdb) on the MPS branch.
> It's not a problem, but I am occasionally reminded it's still there :-)
I finally shook loose some free time to work on this, and installed a
series of patches into master which I hope fix the bug. Please give the
patches a try. For convenience in review, I'm attaching a single diff
combining all the patches, or you can look in the Git repository if you
prefer to see each of the two dozen or so patches individually.
The fix for Bug#77315 itself is quite simple: just remove the overlap
checks. Overlap is impossible and the checks have bugs which can crash
Emacs. (At least, overlap is impossible if you assume the other patches
I installed....)
The other patches are ones that I discovered while reading the code in
the neighborhood. I was working along the lines that Eli hinted at when
he wrote "insert-file-contents needs to be completely rewritten to
handle such situations". The basic idea is to not trust st_size and to
assume that file contents and size can change at any moment.
My goodness, what a mess insert-file-contents was and remains! I hope I
fixed more bugs than I introduced....
[emacs-bug-77315.patch (text/x-patch, attachment)]
This bug report was last modified 18 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.