From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Paul Eggert Newsgroups: gmane.emacs.bugs Subject: bug#13149: 24.3.50; Emacs thinks file was changed outside Emacs, but it was not Date: Fri, 01 Feb 2013 13:05:38 -0800 Message-ID: <510C2E22.9010807@cs.ucla.edu> References: <6CDE13E3BCAA4AFAAB8BCE105C6ABF12@us.oracle.com><50F3935A.2090003@yandex.ru> <50F41CE7.60306@gmail.com><50F44E6B.8090007@cs.ucla.edu> <50F484CB.6010905@gmail.com><50F4FB0B.5070003@cs.ucla.edu> <50F5192B.602@yandex.ru><50F5928A.9010009@cs.ucla.edu> <50F5CC3D.5090802@yandex.ru><50F5CE65.9030002@cs.ucla.edu> <50F5D3F5.6050604@yandex.ru><50F5DA58.3020404@cs.ucla.edu> <50F5E1C1.2040301@yandex.ru><50F5E9DB.1030309@gmail.com> <50F64149.6010704@cs.ucla.edu><50F7D358.9030100@gmail.com> <50F86E12.3040707@cs.ucla.edu><50F8D150.8030200@gmail.com> <50F8D731.5020001@cs.ucla.edu><50F8D93B.1040901@yandex.ru> <50F8DCCB.1030602@cs.ucla.edu><83a9s67wlr.fsf@gnu.org> <50F9C009.9060708@cs.ucla.edu><50F9D213.3070901@yandex.ru> <50F9EF01.5000703@cs.ucla.edu><50F9F250.1030406@yandex.ru> <50FA06F1.2000308@cs.ucla.edu><50FA1AEF.9070700@yandex.ru> <50FA265E.80301@cs.ucla.edu> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Trace: ger.gmane.org 1359752905 21507 80.91.229.3 (1 Feb 2013 21:08:25 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Fri, 1 Feb 2013 21:08:25 +0000 (UTC) Cc: 13149@debbugs.gnu.org, 'Dmitry Gutov' To: Drew Adams Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Fri Feb 01 22:08:45 2013 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 1U1Nqm-0000WH-7U for geb-bug-gnu-emacs@m.gmane.org; Fri, 01 Feb 2013 22:08:44 +0100 Original-Received: from localhost ([::1]:52709 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1U1NqT-0000oL-W3 for geb-bug-gnu-emacs@m.gmane.org; Fri, 01 Feb 2013 16:08:25 -0500 Original-Received: from eggs.gnu.org ([208.118.235.92]:59405) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1U1NpO-0000VL-T1 for bug-gnu-emacs@gnu.org; Fri, 01 Feb 2013 16:08:24 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1U1NoK-0004L3-QL for bug-gnu-emacs@gnu.org; Fri, 01 Feb 2013 16:07:18 -0500 Original-Received: from debbugs.gnu.org ([140.186.70.43]:54335) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1U1NoK-0004Ks-Mo for bug-gnu-emacs@gnu.org; Fri, 01 Feb 2013 16:06:12 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.72) (envelope-from ) id 1U1Np8-0004Im-1x for bug-gnu-emacs@gnu.org; Fri, 01 Feb 2013 16:07:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Paul Eggert Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 01 Feb 2013 21:07:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 13149 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: unreproducible moreinfo Original-Received: via spool by 13149-submit@debbugs.gnu.org id=B13149.135975279916502 (code B ref 13149); Fri, 01 Feb 2013 21:07:02 +0000 Original-Received: (at 13149) by debbugs.gnu.org; 1 Feb 2013 21:06:39 +0000 Original-Received: from localhost ([127.0.0.1]:59799 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1U1Nol-0004I7-HD for submit@debbugs.gnu.org; Fri, 01 Feb 2013 16:06:39 -0500 Original-Received: from smtp.cs.ucla.edu ([131.179.128.62]:38395) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1U1Noh-0004Hy-PB for 13149@debbugs.gnu.org; Fri, 01 Feb 2013 16:06:37 -0500 Original-Received: from localhost (localhost.localdomain [127.0.0.1]) by smtp.cs.ucla.edu (Postfix) with ESMTP id C75DC39E8008; Fri, 1 Feb 2013 13:05:44 -0800 (PST) X-Virus-Scanned: amavisd-new at smtp.cs.ucla.edu Original-Received: from smtp.cs.ucla.edu ([127.0.0.1]) by localhost (smtp.cs.ucla.edu [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id KM2ODGa34uoE; Fri, 1 Feb 2013 13:05:44 -0800 (PST) Original-Received: from penguin.cs.ucla.edu (Penguin.CS.UCLA.EDU [131.179.64.200]) by smtp.cs.ucla.edu (Postfix) with ESMTPSA id 318ED39E8105; Fri, 1 Feb 2013 13:05:44 -0800 (PST) User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130110 Thunderbird/17.0.2 In-Reply-To: X-Spam-Score: -4.5 (----) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list X-Spam-Score: -4.5 (----) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-Received-From: 140.186.70.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-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:70575 Archived-At: I stared at the code a bit and found an unlikely bug that would cause the reported symptoms. The bug occurs if the first write-region to a buggy file system happens to be an append that appends nothing. If this occurs, Emacs incorrectly concludes that the file system is not buggy, and later uses of write-region to that file system (assuming no other non-buggy file systems are used in the meantime) will behave in the bad way that Drew reported. I installed a fix for this bug as trunk bzr 111656. I'd be surprised if this fixes Drew's bug though. Eli, does MS-Windows conform to POSIX by updating st_mtime when Emacs creates a file (open with O_CREAT on a file that didn't previous exist) or truncates a file (open with O_TRUNC on a file that previously existed)? For example, if Emacs uses O_TRUNC on a file that is already empty, does MS-Windows update the file's time stamp even though the file has not changed? If not, that might explain the bug as well. Drew, can you please try using the following hacky patch for a while, and report what's in your *Messages* buffer if you see the problem again? === modified file 'src/fileio.c' --- src/fileio.c 2013-02-01 20:51:12 +0000 +++ src/fileio.c 2013-02-01 21:03:11 +0000 @@ -5051,6 +5051,23 @@ This calls `write-region-annotate-functi st.st_size = st1.st_size; modtime = modtime1; } + + { + char format[sizeof "write-region ? .000000000 .000000000: %s" + + 2 * INT_STRLEN_BOUND (long)]; + if (valid_timestamp_file_system + && st.st_dev == timestamp_file_system) + sprintf (format, "write-region = %ld.%09d: %%s", + (long) EMACS_SECS (modtime), + (int) EMACS_NSECS (modtime)); + else + sprintf (format, "write-region ? %ld.%09d %ld.%09d: %%s", + (long) EMACS_SECS (modtime), + (int) EMACS_NSECS (modtime), + (long) EMACS_SECS (modtime1), + (int) EMACS_NSECS (modtime1)); + add_to_log (format, filename, Qnil); + } } emacs_close (desc1); }