Subject: Re: bug#29455: backup-by-copying ACL Operation not permitted with Windows 7 and Samba

From: Shuguang Sun <[email-masked]>
Date: Mon, 27 Nov 2017 14:29:18 +0800

The debug-on-error is set to t. If setq it to nil, it just raise and error
warning, and will not stop backup.

The ACE for a local file looks like:
"O:S-1-5-21-1213861250-xx-xx-207145G:DUD:AI(A;ID;FA;;;SY)(A;ID;FA;;;BA)(A;ID;FA;;;S-1-5-21-1213861250-xx-xx-207145)(A;ID;FA;;;LA)"
(xx masks some numbers)
(S-1-5-21 is SECURITY_NT_NON_UNIQUE, SIDS are not unique.)

I searched online and find that O:S-1-22 is a unix/linux mapped to windows
by samba. And actually in my situation is that I have files in a linux
server, and mapped it as network driver in Windows 7 (maybe by Samba). All
such kind of files (what I can edit) have ACL/SDDL
O:S-1-22-1-79077G:S-1-22-2-108D:P(A;;0x1e01ff;;;S-1-22-1-
79077)(A;;FR;;;S-1-22-2-108)(A;;FR;;;WD).

On Mon, Nov 27, 2017 at 1:01 AM, Eli Zaretskii <[email-masked]> wrote:

> > From: Shuguang Sun <[email-masked]>
> > Date: Sun, 26 Nov 2017 22:59:33 +0800
> >
> > Local: Windows 7
> > GNU Emacs 27.0.50 (build 1, x86_64-w64-mingw32) of 2017-11-24
> > (backup-by-copying t)
> >
> > File is on a server which is mapped as network driver in Windows 7. It
> seems a samba according to the SID
> > below.
> > The SDDL from file-acl is
> > "O:S-1-22-1-79077G:S-1-22-2-108D:P(A;;0x1e01ff;;;S-1-22-1-
> 79077)(A;;FR;;;S-1-22-2-108)(A;;FR;;;WD)"
> >
> > After I edited the file and write it, the backup meets error:
> >
> > Debugger entered--Lisp error: (file-error "Setting ACL" "Operation not
> permitted"
> > "c:/Users/username/HOME/.emacs.d/autosave/Rfiles/!
> drive_i!test_fixed_IA_time.r.~2~")
> >   set-file-acl("c:/Users/username/HOME/.emacs.d/
> autosave/Rfiles/!drive_i!test_fixed_IA_time.r.~2~"
> > "O:S-1-22-1-79077G:S-1-22-2-108D:P(A;;0x1e01ff;;;S-1-22-1-
> 79077)(A;;FR;;;S-1-22-2-108)(A;;FR;;;WD)")
> >   set-file-extended-attributes
> > ("c:/Users/username/HOME/.emacs.d/autosave/Rfiles/!
> drive_i!test_fixed_IA_time.r.~2~" ((acl .
> > "O:S-1-22-1-79077G:S-1-22-2-108D:P(A;;0x1e01ff;;;S-1-22-1-
> 79077)(A;;FR;;;S-1-22-2-108)(A;;FR;;;WD)")
> > (selinux-context nil nil nil nil)))
> >   backup-buffer-copy("i:/power/permutation_test_fixed_IA_time.r"
> > "c:/Users/username/HOME/.emacs.d/autosave/Rfiles/!
> drive_i!test_fixed_IA_time.r.~2~" 438 ((acl .
> > "O:S-1-22-1-79077G:S-1-22-2-108D:P(A;;0x1e01ff;;;S-1-22-1-
> 79077)(A;;FR;;;S-1-22-2-108)(A;;FR;;;WD)")
> > (selinux-context nil nil nil nil)))
> >   backup-buffer()
> >   basic-save-buffer-2()
> >   basic-save-buffer-1()
> >   basic-save-buffer(t)
> >   save-buffer(1)
> >   funcall-interactively(save-buffer 1)
> >   call-interactively(save-buffer nil nil)
> >   command-execute(save-buffer)
>
> Do you have debug-on-error set to non-nil?  In backup-buffer-copy the
> function set-file-extended-attributes is called inside
> with-demoted-errors, so unless debug-on-error is non-nil, the error
> should have been converted to a simple message, and Emacs should have
> felled back to set-file-modes.  Why isn't this happening in your case?
>
> Also, does the following fail with SOME-FILE being a local file?
>
>   M-: set-file-acl("SOME-FILE" "O:S-1-22-1-79077G:S-1-22-2-
> 108D:P(A;;0x1e01ff;;;S-1-22-1-79077)(A;;FR;;;S-1-22-2-108)(A;;FR;;;WD)")
> RET
>