From 448d0eddf1804130756dfbeb1aa54aebd4487678 Mon Sep 17 00:00:00 2001 From: Michael Albinus Date: Tue, 18 Jun 2024 14:40:20 +0200 Subject: [PATCH] Adapt tramp-use-file-attributes * doc/misc/tramp.texi: Fix indentation. (Bug Reports): Mention Gmane group gmane.emacs.tramp. (Frequently Asked Questions): Precise tramp-use-file-attributes entry. * lisp/net/tramp-sh.el (tramp-open-connection-setup-interactive-shell): Dump os-release when `tramp-verbose' is at least 9. * lisp/net/tramp.el (tramp-use-file-attributes): Adapt docstring. Use connection-local value. (cherry picked from commit dc308348a904d69916ca6ab1eb587aff03e8421c) --- doc/misc/tramp.texi | 105 ++++++++++++++++++++++++++----------------- lisp/net/tramp-sh.el | 6 +++ lisp/net/tramp.el | 11 +++-- 3 files changed, 76 insertions(+), 46 deletions(-) diff --git a/doc/misc/tramp.texi b/doc/misc/tramp.texi index 8342c330236..2361683fa14 100644 --- a/doc/misc/tramp.texi +++ b/doc/misc/tramp.texi @@ -2420,24 +2420,26 @@ You could define your own search directories like this: @lisp @group -(connection-local-set-profile-variables 'remote-path-with-bin - '((tramp-remote-path . ("~/bin" tramp-default-remote-path)))) +(connection-local-set-profile-variables + 'remote-path-with-bin + '((tramp-remote-path . ("~/bin" tramp-default-remote-path)))) @end group @group -(connection-local-set-profile-variables 'remote-path-with-apply-pub-bin - '((tramp-remote-path . ("/appli/pub/bin" tramp-default-remote-path)))) +(connection-local-set-profile-variables + 'remote-path-with-apply-pub-bin + '((tramp-remote-path . ("/appli/pub/bin" tramp-default-remote-path)))) @end group @group (connection-local-set-profiles - '(:application tramp :machine "randomhost") 'remote-path-with-bin) + '(:application tramp :machine "randomhost") 'remote-path-with-bin) @end group @group (connection-local-set-profiles - '(:application tramp :user "anotheruser" :machine "anotherhost") - 'remote-path-with-apply-pub-bin) + '(:application tramp :user "anotheruser" :machine "anotherhost") + 'remote-path-with-apply-pub-bin) @end group @end lisp @@ -2554,18 +2556,18 @@ example below: @group (customize-set-variable 'tramp-password-prompt-regexp - (concat - "^.*" - (regexp-opt - '("passphrase" "Passphrase" - ;; English - "password" "Password" - ;; Deutsch - "passwort" "Passwort" - ;; Français - "mot de passe" "Mot de passe") - t) - ".*:\0? *")) + (concat + "^.*" + (regexp-opt + '("passphrase" "Passphrase" + ;; English + "password" "Password" + ;; Deutsch + "passwort" "Passwort" + ;; Français + "mot de passe" "Mot de passe") + t) + ".*:\0? *")) @end group @end lisp @@ -2872,8 +2874,8 @@ allows you to set the @option{ControlPath} provided the variable (customize-set-variable 'tramp-ssh-controlmaster-options (concat - "-o ControlPath=/tmp/ssh-ControlPath-%%r@@%%h:%%p " - "-o ControlMaster=auto -o ControlPersist=yes")) + "-o ControlPath=/tmp/ssh-ControlPath-%%r@@%%h:%%p " + "-o ControlMaster=auto -o ControlPersist=yes")) @end group @end lisp @@ -4155,29 +4157,29 @@ of @code{explicit-shell-file-name} for different remote hosts. @lisp @group (connection-local-set-profile-variables - 'remote-bash - '((explicit-shell-file-name . "/bin/bash") - (explicit-bash-args . ("-i")))) + 'remote-bash + '((explicit-shell-file-name . "/bin/bash") + (explicit-bash-args . ("-i")))) @end group @group (connection-local-set-profile-variables - 'remote-ksh - '((explicit-shell-file-name . "/bin/ksh") - (explicit-ksh-args . ("-i")))) + 'remote-ksh + '((explicit-shell-file-name . "/bin/ksh") + (explicit-ksh-args . ("-i")))) @end group @group (connection-local-set-profiles - '(:application tramp :protocol "ssh" :machine "localhost") - 'remote-bash) + '(:application tramp :protocol "ssh" :machine "localhost") + 'remote-bash) @end group @group (connection-local-set-profiles - `(:application tramp :protocol "sudo" - :user "root" :machine ,(system-name)) - 'remote-ksh) + `(:application tramp :protocol "sudo" + :user "root" :machine ,(system-name)) + 'remote-ksh) @end group @end lisp @@ -4536,8 +4538,8 @@ which must be set to a non-@code{nil} value. Example: @lisp @group (connection-local-set-profile-variables - 'remote-direct-async-process - '((tramp-direct-async-process . t))) + 'remote-direct-async-process + '((tramp-direct-async-process . t))) @end group @group @@ -5047,6 +5049,9 @@ To subscribe to the mailing list, visit: @uref{https://lists.gnu.org/mailman/listinfo/tramp-devel/, the @value{tramp} Mail Subscription Page}. +There is also a @acronym{Gmane} group, mirroring the mailing list. +Its name is @samp{gmane.emacs.tramp}. + @ifset installchapter Before sending a bug report, run the test suite first @ref{Testing}. @end ifset @@ -5222,8 +5227,8 @@ connections, apply the following code. @lisp @group (connection-local-set-profile-variables - 'my-auto-save-profile - '((buffer-auto-save-file-name . nil))) + 'my-auto-save-profile + '((buffer-auto-save-file-name . nil))) @end group @group @@ -5519,8 +5524,8 @@ Since @w{Emacs 30}, these options can be set connection-local. @lisp @group (connection-local-set-profile-variables - 'my-dired-profile - '((dired-listing-switches . "-ahl"))) + 'my-dired-profile + '((dired-listing-switches . "-ahl"))) @end group @group @@ -5552,10 +5557,26 @@ readable @vindex tramp-use-file-attributes Internally, @value{tramp} uses commands like @command{ls} or -@command{stat} in order to determine file permissions. On some file -systems, like @acronym{GPFS}, they don't report proper information. -Set the user option @code{tramp-use-file-attributes} to @code{nil} in -such a case. +@command{stat} in order to determine file permissions. When +@acronym{NFS4_ACL} is enabled on the remote host, more fine-grained +information is used which cannot be reflected by the permission string +returned from those commands. Set the user option +@code{tramp-use-file-attributes} to @code{nil} in such a case. This +can also be set host-wise, like in: + +@lisp +@group +(connection-local-set-profile-variables + 'my-file-attributes-profile + '((tramp-use-file-attributes . nil))) +@end group + +@group +(connection-local-set-profiles + '(:application tramp :machine "remotehost") + 'my-file-attributes-profile) +@end group +@end lisp @item diff --git a/lisp/net/tramp-sh.el b/lisp/net/tramp-sh.el index 3a0cb69b2c6..38002f5eaf1 100644 --- a/lisp/net/tramp-sh.el +++ b/lisp/net/tramp-sh.el @@ -4464,6 +4464,12 @@ process to set up. VEC specifies the connection." (tramp-cleanup-connection vec t t) (throw 'uname-changed (tramp-maybe-open-connection vec))) + ;; Dump /etc/os-release in the traces. + (when (>= tramp-verbose 9) + (tramp-send-command + vec (format "cat /etc/os-release 2>%s" (tramp-get-remote-null-device vec)) + t)) + ;; Try to set up the coding system correctly. ;; CCC this can't be the right way to do it. Hm. (tramp-message vec 5 "Determining coding system") diff --git a/lisp/net/tramp.el b/lisp/net/tramp.el index b900357a215..0dfd8ac4535 100644 --- a/lisp/net/tramp.el +++ b/lisp/net/tramp.el @@ -3436,15 +3436,18 @@ BODY is the backend specific code." (defcustom tramp-use-file-attributes t "Whether to use \"file-attributes\" file property for check. -This is relevant for `file-directory-p', `file-executable-p', -`file-exists-p', and `file-readable-p'. On some file systems, like -GPFS, the permission string is not trustworthy." +This is relevant for read, write, and execute permissions. On some file +systems using NFS4_ACL, the permission string as returned from `stat' or +`ls', is not sufficient to provide more fine-grained information. +This variable is intended as connection-local variable." :version "30.1" :type 'boolean) (defsubst tramp-use-file-attributes (vec) "Whether to use \"file-attributes\" file property for check." - (and tramp-use-file-attributes + (and ;; We assume, that connection-local variables are set in this buffer. + (with-current-buffer (tramp-get-connection-buffer vec) + tramp-use-file-attributes) (tramp-file-property-p vec (tramp-file-name-localname vec) "file-attributes"))) -- 2.39.2