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#22795: 25.0.91; Can't write read only file on w32 Date: Fri, 26 Feb 2016 23:53:33 +0200 Message-ID: <83si0fcf4y.fsf@gnu.org> References: <83h9gwg2j8.fsf@gnu.org> <20160225.090838.192544111.Takaaki.Ota@am.sony.com> <8360xcfyqp.fsf@gnu.org> <20160226.112605.492625590.Takaaki.Ota@am.sony.com> Reply-To: Eli Zaretskii NNTP-Posting-Host: plane.gmane.org X-Trace: ger.gmane.org 1456523726 14041 80.91.229.3 (26 Feb 2016 21:55:26 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Fri, 26 Feb 2016 21:55:26 +0000 (UTC) Cc: 22795@debbugs.gnu.org To: "Ota\, Takaaki" Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Fri Feb 26 22:55:12 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 1aZQLu-0000wx-SA for geb-bug-gnu-emacs@m.gmane.org; Fri, 26 Feb 2016 22:55:10 +0100 Original-Received: from localhost ([::1]:52266 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aZQLu-00057Z-Ax for geb-bug-gnu-emacs@m.gmane.org; Fri, 26 Feb 2016 16:55:10 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:58765) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aZQLq-00055x-QD for bug-gnu-emacs@gnu.org; Fri, 26 Feb 2016 16:55:07 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aZQLm-0000RG-2h for bug-gnu-emacs@gnu.org; Fri, 26 Feb 2016 16:55:06 -0500 Original-Received: from debbugs.gnu.org ([208.118.235.43]:50808) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aZQLl-0000R8-Vr for bug-gnu-emacs@gnu.org; Fri, 26 Feb 2016 16:55:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84) (envelope-from ) id 1aZQLl-0000Sr-SD for bug-gnu-emacs@gnu.org; Fri, 26 Feb 2016 16:55:01 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 26 Feb 2016 21:55:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 22795 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 22795-submit@debbugs.gnu.org id=B22795.14565236471716 (code B ref 22795); Fri, 26 Feb 2016 21:55:01 +0000 Original-Received: (at 22795) by debbugs.gnu.org; 26 Feb 2016 21:54:07 +0000 Original-Received: from localhost ([127.0.0.1]:47935 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84) (envelope-from ) id 1aZQKs-0000Rc-RT for submit@debbugs.gnu.org; Fri, 26 Feb 2016 16:54:07 -0500 Original-Received: from eggs.gnu.org ([208.118.235.92]:39234) by debbugs.gnu.org with esmtp (Exim 4.84) (envelope-from ) id 1aZQKq-0000R6-LL for 22795@debbugs.gnu.org; Fri, 26 Feb 2016 16:54:04 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aZQKg-0000B8-So for 22795@debbugs.gnu.org; Fri, 26 Feb 2016 16:53:59 -0500 Original-Received: from fencepost.gnu.org ([2001:4830:134:3::e]:57329) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aZQKg-0000Au-Pn; Fri, 26 Feb 2016 16:53:54 -0500 Original-Received: from 84.94.185.246.cable.012.net.il ([84.94.185.246]:3560 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_128_CBC_SHA1:128) (Exim 4.82) (envelope-from ) id 1aZQKg-0000d6-3E; Fri, 26 Feb 2016 16:53:54 -0500 In-reply-to: <20160226.112605.492625590.Takaaki.Ota@am.sony.com> 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-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:113914 Archived-At: > Date: Fri, 26 Feb 2016 11:26:05 -0800 > CC: <22795@debbugs.gnu.org> > From: "Ota, Takaaki" > > I think this is something to do with my mingw. I cannot remember when > I updated mingw last time. Here is the comparison between trace in > emacs-24.5 and emacs-25.0.91. The difference is in the open system > call. Both pass the same set of parameters to open but emacs-24.5 > gets 3 and emacs-25.0.91 gets -1. Both emacs were built using mingw > but I cannot guarantee they are the same version of mingw. I very much doubt this has something to do with MinGW, because MinGW uses the Windows runtime library, so running the two executables on the same box will use the same library. > Can you think of any other reason than they were built with > different mingw to explain the difference of the open() behavior? Step into the 'open' call -- it's shadowed by 'sys_open' defined on w32.c. What flags are passed to _wopen in each case? Your trace from GDB seems to indicate that in the case of 25.0.91 we pass O_BINARY, while in 24.5 we don't. If this is really the case, maybe that's the reason, although I don't currently see why it would lead to a failure (and it certainly doesn't fail for me). Is there any other difference in flags and modes with which we call _wopen in each case? Also, I think by the time this code is run, the original file should have been renamed to the backup-file name, so the file you are saving should not exist on disk by the time we open it. If that is not the case with 25.0.91, then perhaps what fails is not the open call, but the rename call before that. Thanks.