From: Noam Postavsky <npostavs@gmail.com>
To: Ken Raeburn <raeburn@permabit.com>
Cc: 23397@debbugs.gnu.org
Subject: bug#23397: 25.0.92; assertion failure auto-reverting a file being overwritten
Date: Sat, 16 Jun 2018 17:45:36 -0400 [thread overview]
Message-ID: <87zhzutngf.fsf@gmail.com> (raw)
In-Reply-To: <6efuu0chsv.fsf@just-testing.permabit.com> (Ken Raeburn's message of "Mon, 02 May 2016 16:43:12 -0400")
found 23397 26.1
tags 23397 + confirmed
quit
Ken Raeburn <raeburn@permabit.com> writes:
> There's code there doing lseek and read calls; we should be able to keep
> track of the last file position we read from, if that's not already
> derivable from existing variables visible at that point.
This seems to fix the scenario you gave in #17. I don't quite
understand what the overlap expression is trying to compute though.
--- i/src/fileio.c
+++ w/src/fileio.c
@@ -3849,6 +3849,8 @@ because (1) it preserves some marker positions and (2) it puts less data
goto handled;
}
+ off_t file_end_pos = st.st_size;
+
/* Count how many chars at the end of the file
match the text at the end of the buffer. But, if we have
already found that decoding is necessary, don't waste time. */
@@ -3879,6 +3881,8 @@ because (1) it preserves some marker positions and (2) it puts less data
total_read += nread;
}
+ file_end_pos = max (curpos - trial + total_read, file_end_pos);
+
/* Scan this bufferful from the end, comparing with
the Emacs buffer. */
bufpos = total_read;
@@ -3931,7 +3935,7 @@ because (1) it preserves some marker positions and (2) it puts less data
/* Don't try to reuse the same piece of text twice. */
overlap = (same_at_start - BEGV_BYTE
- (same_at_end
- + (! NILP (end) ? end_offset : st.st_size) - ZV_BYTE));
+ + (! NILP (end) ? end_offset : file_end_pos) - ZV_BYTE));
if (overlap > 0)
same_at_end += overlap;
same_at_end_charpos = BYTE_TO_CHAR (same_at_end);
next prev parent reply other threads:[~2018-06-16 21:45 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-04-28 22:05 bug#23397: 25.0.92; assertion failure auto-reverting a file being overwritten Ken Raeburn
2016-05-02 16:47 ` Eli Zaretskii
2016-05-02 20:43 ` Ken Raeburn
2016-05-03 15:15 ` Eli Zaretskii
2016-05-03 21:04 ` Ken Raeburn
2018-06-16 21:45 ` Noam Postavsky [this message]
2018-06-17 5:36 ` Eli Zaretskii
2020-09-05 14:03 ` Lars Ingebrigtsen
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=87zhzutngf.fsf@gmail.com \
--to=npostavs@gmail.com \
--cc=23397@debbugs.gnu.org \
--cc=raeburn@permabit.com \
/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.