Subject: Re: bug#22795: 25.0.91; Can't write read only file on w32

From: Eli Zaretskii <[email-masked]>
Date: Mon, 29 Feb 2016 22:06:39 +0200

> Date: Mon, 29 Feb 2016 11:28:15 -0800
> CC: <[email-masked]>
> From: "Ota, Takaaki" <[email-masked]>
> 
> emacs-24.5 never called sys_rename().

??? It does here.  The call is in backup-buffer: it calls rename-file.

Are you trying this in "emacs -Q"?  If not, perhaps you have some
customizations, like backup-by-copying or
backup-by-copying-when-mismatch etc.?

> emacs-25.0.91 calls sys_rename() but strangely old name and the new
> name are the same.  See below.
> 
> -Tak
> 
> Breakpoint 1, sys_rename (old=0x880c9b8 "c:/d/ota/memo", 
>     new=0x880c9b8 "c:/d/ota/memo") at w32.c:4543
> 4543    {
> (gdb) n
> 4544      return sys_rename_replace (old, new, TRUE);
> (gdb) s
> sys_rename_replace (oldname=oldname@entry=0x880c9b8 "c:/d/ota/memo", 
>     newname=newname@entry=0x880c9b8 "c:/d/ota/memo", force=force@entry=1)
>     at w32.c:4404

Again, is this in "emacs -Q"?  The backup file name is generated by
the function find-backup-file-name, you will find it in files.el.  It
is called by backup-buffer.  Please see what file names it produces in
this case.