Subject: Re: bug#29225: Tramp backup-by-copying in a Converting ACL Invalid argument error on Windows 7

From: Michael Albinus <[email-masked]>
Date: Fri, 10 Nov 2017 13:41:04 +0100

Eli Zaretskii <[email-masked]> writes:

Hi Eli,

>> Debugger entered--Lisp error: (file-error "Converting ACL" "Invalid argument"
>> "c:/Users/user/HOME/.emacs.d/autosave/Rfiles/!drive_c!plink!!user@host!!!path!user!Ava!_mortality.R.~1~")
>> 
>>   set-file-acl
>> ("c:/Users/user/HOME/.emacs.d/autosave/Rfiles/!drive_c!plink!!user@host!!!path!user!Ava!_mortality.R.~1~"
>> "user::rw-\ngroup::rw-\nother::r--\n")
>>   set-file-extended-attributes
>> ("c:/Users/user/HOME/.emacs.d/autosave/Rfiles/!drive_c!plink!!user@host!!!path!user!Ava!_mortality.R.~1~"
>> ((acl . "user::rw-\ngroup::rw-\nother::r--\n") (selinux-context nil nil nil nil)))
>>   backup-buffer-copy("/plink:user@host:/path/user/Ava/_mortality.R"
>> "c:/Users/user/HOME/.emacs.d/autosave/Rfiles/!drive_c!plink!!user@host!!!path!user!Ava!_mortality.R.~1~"
>> 436 ((acl . "user::rw-\ngroup::rw-\nother::r--\n") (selinux-context nil nil nil nil)))
>
> This seems to indicate that Unix-style ACLs are passed to native
> Windows ACL functions, which won't work.  Michael, could you please
> look into this?  I'd expect ACLs derived from remote files never to be
> used on local files.

And vice versa.

However, Tramp has no chance to do something here. It offers own
implementations of `file-acl' and `set-file-acl'; both functions don't
know where the returned ACL shall be used (´file-acl'), or where the ACL
comes from (`set-file-acl'). Therefore, the docstring of `set-file-acl'
says

"Value is t if setting of ACL was successful, nil otherwise."

The error message "Converting ACL" "Invalid argument" comes from
Ffile_acl of fileio.c. It *raises* an error instead of silently
returning Qnil, as advertised by the docstring. A similar wrong
behaviour I've found in `tramp-smb-handle-set-file-acl'.

I would convert both functions to return nil instead of raising an
error, in the emacs-26 branch. Any objection?

> Thanks.

Best regards, Michael.