[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: tramp (2.3.3.26.1); Faild savid file under su which located in other
From: |
Michael Albinus |
Subject: |
Re: tramp (2.3.3.26.1); Faild savid file under su which located in other partision |
Date: |
Mon, 24 Sep 2018 10:47:58 +0200 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux) |
address@hidden writes:
Hi,
> Reproduce steps
> 1) Open file in boot sector with su using tramp (in my case it was
> /boot/EFI/refind/refind.conf)
> a) C-x C-f /su::localhost
> b) Enter password
> c) /boot/EFI/refind/refind.conf
> 2) Edit opened file
> 3) Save file (by C-x C-s)
>
> Expected result
> 1) File saved
>
> Actual result
> 1) File didn't save
> 2) Error message :"tramp-file-name-handler: Copying directly failed, see
> buffer ‘*tramp/su address@hidden for details."
> 3) Buffer *tramp/su address@hidden is empty
>
> Details:
> 1) All works fine while editing files under tramp su which located on
> root sector (for example /etc/hosts)
> 2) All works fine while editing file /boot/EFI/refind/refind.conf by
> emacs, which started under root.
Perhaps ACLs are in the way. Following are the relevant commands Tramp
has performed:
> 18:22:51.479677 tramp-send-command (6) # ( (test -e
> /boot/EFI/refind/refind.conf || test -h /boot/EFI/refind/refind.conf) && (env
> QUOTING_STYLE=locale \stat -c '((/////%N/////) %h /////%U///// /////%G/////
> %Xe0 %Ye0 %Ze0 %se0 /////%A///// t %ie0 -1)' /boot/EFI/refind/refind.conf |
> sed -e 's/"/\\"/g' -e 's/\/\/\/\/\//"/g') || echo nil) 2>/dev/null; echo
> tramp_exit_status $?
> 18:22:51.483711 tramp-wait-for-regexp (6) #
> (("‘/boot/EFI/refind/refind.conf’") 1 "root" "root" 1537565058e0 1537565058e0
> 1537623302e0 28003e0 "-rwxr-xr-x" t 48e0 -1)
This is a check about the existing file "refind.conf". Most important: it
has uid and gid 0 (root).
> 18:22:51.546768 tramp-send-command (6) # getfacl -ac
> /boot/EFI/refind/refind.conf 2>/dev/null; echo tramp_exit_status $?
> 18:22:51.547833 tramp-wait-for-regexp (6) #
> user::rwx
> group::r-x
> other::r-x
ACLs are checked.
> 18:22:51.548268 tramp-send-command (6) # selinuxenabled 2>/dev/null; echo
> tramp_exit_status $?
> 18:22:51.548976 tramp-wait-for-regexp (6) #
> tramp_exit_status 127
SELinux is not enabled.
> 18:22:51.550123 tramp-send-command (6) # ( (test -e /boot/EFI/refind/ || test
> -h /boot/EFI/refind/) && (env QUOTING_STYLE=locale \stat -c '((/////%N/////)
> %h /////%U///// /////%G///// %Xe0 %Ye0 %Ze0 %se0 /////%A///// t %ie0 -1)'
> /boot/EFI/refind/ | sed -e 's/"/\\"/g' -e 's/\/\/\/\/\//"/g') || echo nil)
> 2>/dev/null; echo tramp_exit_status $?
> 18:22:51.553736 tramp-wait-for-regexp (6) #
> (("‘/boot/EFI/refind/’") 5 "root" "root" 1537623302e0 1537623302e0
> 1537623302e0 4096e0 "drwxr-xr-x" t 23e0 -1)
The directory "refind" is checked. It is writable for user root.
> 18:22:51.558454 tramp-send-command (6) # test -w /boot/EFI/refind/
> 2>/dev/null; echo tramp_exit_status $?
> 18:22:51.558800 tramp-wait-for-regexp (6) #
> tramp_exit_status 0
The same.
> 18:22:51.566790 tramp-send-command (6) # mv -f /boot/EFI/refind/refind.conf
> /boot/EFI/refind/refind.conf\~ 2>/dev/null; echo tramp_exit_status $?
> 18:22:51.568523 tramp-wait-for-regexp (6) #
> tramp_exit_status 0
The file "refind.conf" is renamed to "refind.conf~", no problem.
> 18:22:51.582302 tramp-send-command (6) # env TZ=UTC \touch -t 201809212124.18
> /boot/EFI/refind/refind.conf\~ 2>/dev/null; echo tramp_exit_status $?
> 18:22:51.583698 tramp-wait-for-regexp (6) #
> tramp_exit_status 0
> ///1a55e6f4fdda667545d90c960c19b7c4#$
> 18:22:51.584143 tramp-send-command (6) # chmod 755
> /boot/EFI/refind/refind.conf\~ 2>/dev/null; echo tramp_exit_status $?
> 18:22:51.585234 tramp-wait-for-regexp (6) #
> tramp_exit_status 0
It gets the timestamp and permissions of the original file.
> 18:22:51.623200 tramp-send-command (6) # ( (test -e /tmp/tramp.a7nx5C.conf ||
> test -h /tmp/tramp.a7nx5C.conf) && (env QUOTING_STYLE=locale \stat -c
> '((/////%N/////) %h /////%U///// /////%G///// %Xe0 %Ye0 %Ze0 %se0
> /////%A///// t %ie0 -1)' /tmp/tramp.a7nx5C.conf | sed -e 's/"/\\"/g' -e
> 's/\/\/\/\/\//"/g') || echo nil) 2>/dev/null; echo tramp_exit_status $?
> 18:22:51.628222 tramp-wait-for-regexp (6) #
> (("‘/tmp/tramp.a7nx5C.conf’") 1 "robbie" "adm" 1537629771e0 1537629771e0
> 1537629771e0 27993e0 "-rw-r--r--" t 464952e0 -1)
The temporary file /tmp/tramp.a7nx5C.conf, which is used for editing, is
checked. It belongs to user/group robbie/adm.
> 18:22:51.639260 tramp-send-command (6) # cp -f -p /tmp/tramp.a7nx5C.conf
> /boot/EFI/refind/refind.conf 2>/dev/null; echo tramp_exit_status $?
> 18:22:51.640592 tramp-wait-for-regexp (6) #
> tramp_exit_status 1
> ///1a55e6f4fdda667545d90c960c19b7c4#$
> 18:22:51.640898 tramp-do-copy-or-rename-file-directly (1) # File error:
> Copying directly failed, see buffer ‘*tramp/su address@hidden for details.
Tramp tries to apply "cp -f -p /tmp/tramp.a7nx5C.conf
/boot/EFI/refind/refind.conf", which fails with error code 1. Unfortunately,
due to "2>/dev/null", we don't see why.
> 18:22:54.233581 tramp-send-command (6) # mv -f /boot/EFI/refind/refind.conf\~
> /boot/EFI/refind/refind.conf 2>/dev/null; echo tramp_exit_status $?
> 18:22:54.235271 tramp-wait-for-regexp (6) #
> tramp_exit_status 0
Tramp tries to limit the damage, and moves the backup file back.
That's it. Could you pls prepare a similar temp file with such
permissions, and try to copy this way? Hopefully, we see the error
message then.
Best regards, Michael.