"Yikai Zhao" <[email protected]> writes:

Hi,

> I think this should be a fairly common use case (everyone's boot
> partition must be a FAT filesystem, right?) and it would be great to
> see it resolved by tramp.

It doesn't seem to be fairly common. Otherwise, I would have seen such
bug reports the last 20 years.

> Can we maybe detect this kind of error (by parsing the output of cp?)
> to ignore it? Or can we detect the destination filesystem type to drop
> the "-p" argument of cp? Or, at the very least, can we have a
> buffer-local option to control the arguments of the cp command?

Well, Tramp is just a stupid library, it does what it is instructed to do.
"cp -f -p ..." is applied only if there is a function call (copy-file ...)
with non-nil PRESERVE-UID-GID (see docstring of copy-file).

What happens if you apply the appended patch?

Best regards, Michael.

*** /tmp/ediffMjLTll	2020-12-21 15:55:45.525219887 +0100
--- /home/albinus/src/tramp/lisp/tramp-sh.el	2020-12-21 15:55:09.372864305 +0100
***************
*** 2234,2240 ****
  		     (file-writable-p (concat prefix localname2))))
  	    (tramp-do-copy-or-rename-file-directly
  	     op (concat prefix localname1) (concat prefix localname2)
! 	     ok-if-already-exists keep-date t)
  	    ;; We must change the ownership to the local user.
  	    (tramp-set-file-uid-gid
  	     (concat prefix localname2)
--- 2234,2240 ----
  		     (file-writable-p (concat prefix localname2))))
  	    (tramp-do-copy-or-rename-file-directly
  	     op (concat prefix localname1) (concat prefix localname2)
! 	     ok-if-already-exists keep-date preserve-uid-gid)
  	    ;; We must change the ownership to the local user.
  	    (tramp-set-file-uid-gid
  	     (concat prefix localname2)
Best regards, Michael.

Reply via email to