Subject: Re: bug#21699: 24.5; Bug in backup-buffer-copy and/or set-file-extended-attributes etc [set-file-extended-attributes]

From: Eli Zaretskii <[email-masked]>
Date: Mon, 19 Oct 2015 10:09:36 +0300

> Date: Mon, 19 Oct 2015 09:50:06 +0300
> From: Eli Zaretskii <[email-masked]>
> Cc: [email-masked]
> 
> > Date: Mon, 19 Oct 2015 09:38:08 +0300
> > From: Eli Zaretskii <[email-masked]>
> > Cc: [email-masked]
> > 
> > So after fixing set-file-extended-attributes as you suggest, does the
> > problem still happen for you?
> 
> Actually, your suggested variant also returns nil for me.  I need
> something like this instead:
> 
>   (defun set-file-extended-attributes (filename attributes)
>     "Set extended attributes of file FILENAME to ATTRIBUTES.
> 
>   ATTRIBUTES must be an alist of file attributes as returned by
>   `file-extended-attributes'."
>     (let (result)
>       (dolist (elt attributes)
> 	(let ((attr (car elt))
> 	      (val (cdr elt)))
> 	  (cond ((eq attr 'acl)
> 		 (setq result (or result
> 				  (set-file-acl filename val))))
> 		((eq attr 'selinux-context)
> 		 (setq result (or result
> 				  (set-file-selinux-context filename val)))))))
>       result))

I installed a slightly different variant of this (which always invokes
the corresponding low-level primitive for each type of extended
attributes, instead of skipping all those after the first success), to
keep the original semantics.