From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.bugs Subject: bug#23397: 25.0.92; assertion failure auto-reverting a file being overwritten Date: Mon, 02 May 2016 19:47:57 +0300 Message-ID: <83vb2wl83m.fsf@gnu.org> References: <6epot9crti.fsf@just-testing.permabit.com> Reply-To: Eli Zaretskii NNTP-Posting-Host: plane.gmane.org X-Trace: ger.gmane.org 1462207783 2267 80.91.229.3 (2 May 2016 16:49:43 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Mon, 2 May 2016 16:49:43 +0000 (UTC) Cc: 23397@debbugs.gnu.org To: Ken Raeburn Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Mon May 02 18:49:32 2016 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1axH2I-0000Ac-Jr for geb-bug-gnu-emacs@m.gmane.org; Mon, 02 May 2016 18:49:30 +0200 Original-Received: from localhost ([::1]:37638 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1axH2E-0000wz-QC for geb-bug-gnu-emacs@m.gmane.org; Mon, 02 May 2016 12:49:26 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:47251) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1axH25-0000cp-6s for bug-gnu-emacs@gnu.org; Mon, 02 May 2016 12:49:23 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1axH1t-00044V-I0 for bug-gnu-emacs@gnu.org; Mon, 02 May 2016 12:49:11 -0400 Original-Received: from debbugs.gnu.org ([208.118.235.43]:49997) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1axH1t-00043i-F1 for bug-gnu-emacs@gnu.org; Mon, 02 May 2016 12:49:05 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1axH1q-0007Dw-2k for bug-gnu-emacs@gnu.org; Mon, 02 May 2016 12:49:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 02 May 2016 16:49:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 23397 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 23397-submit@debbugs.gnu.org id=B23397.146220769727331 (code B ref 23397); Mon, 02 May 2016 16:49:02 +0000 Original-Received: (at 23397) by debbugs.gnu.org; 2 May 2016 16:48:17 +0000 Original-Received: from localhost ([127.0.0.1]:34100 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1axH16-00076l-SH for submit@debbugs.gnu.org; Mon, 02 May 2016 12:48:17 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:56078) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1axH15-00076X-0z for 23397@debbugs.gnu.org; Mon, 02 May 2016 12:48:15 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1axH0q-0003qw-DQ for 23397@debbugs.gnu.org; Mon, 02 May 2016 12:48:06 -0400 Original-Received: from fencepost.gnu.org ([2001:4830:134:3::e]:33314) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1axH0q-0003qI-Az; Mon, 02 May 2016 12:48:00 -0400 Original-Received: from 84.94.185.246.cable.012.net.il ([84.94.185.246]:3423 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_128_CBC_SHA1:128) (Exim 4.82) (envelope-from ) id 1axH0k-0000Rc-A8; Mon, 02 May 2016 12:47:54 -0400 In-reply-to: <6epot9crti.fsf@just-testing.permabit.com> (message from Ken Raeburn on Thu, 28 Apr 2016 18:05:29 -0400) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 208.118.235.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.org gmane.emacs.bugs:117584 Archived-At: > From: Ken Raeburn > Date: Thu, 28 Apr 2016 18:05:29 -0400 > > I'm running the emacs-25 branch as of revision a1f221b, but with commit > d82f24b reverted (attempting to debug #23013), and built with > MARKER_DEBUG enabled (as Eli pointed out, probably not relevant to > #23013) along with assertions. > > I was using "git" to update a source tree while about twenty files from > it were loaded into Emacs buffers. Auto-revert was triggered; during the > process, Finsert_file_contents was loading a Perl file when it invoked > BYTE_TO_CHAR: > > /* 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)); > if (overlap > 0) > same_at_end += overlap; > same_at_end_charpos = BYTE_TO_CHAR (same_at_end); > > ...with same_at_end well out of range (Z_BYTE=12451, same_at_end=24673). > The reverting appears to have happened while the file was in the process > of being updated, as st.st_size is zero. So you are saying that the file's contents was updated between the time we called 'fstat' at the beginning of the function and the time we used st.st_size in the above snippet? If so, perhaps we should call 'fstat' again each time we want to use st.st_size, and retry from the beginning if we find a mismatch? > I haven't managed to reproduce this so far. You could artificially modify the value of st.st_size in the debugger, and then see what happens. Thanks.