branch: externals/tramp commit 7ccd3818b74245cb0b4ffe1aac8b71ad2aef79a9 Author: Michael Albinus <michael.albi...@gmx.de> Commit: Michael Albinus <michael.albi...@gmx.de>
Tramp ELPA version 2.7.2.3.1 released --- Makefile | 2 +- README | 6 +-- test/tramp-tests.el | 4 ++ texi/tramp.texi | 20 ++++----- texi/trampver.texi | 2 +- tramp-adb.el | 17 ++++---- tramp-cache.el | 15 ++++--- tramp-compat.el | 40 ++++++++++-------- tramp-gvfs.el | 5 ++- tramp-message.el | 2 +- tramp-sh.el | 116 +++++++++++++++++++++++++++------------------------- tramp-sudoedit.el | 24 +++++------ tramp.el | 33 ++++++++------- trampver.el | 6 +-- 14 files changed, 153 insertions(+), 139 deletions(-) diff --git a/Makefile b/Makefile index 7520545d13..c4714b0d69 100644 --- a/Makefile +++ b/Makefile @@ -75,6 +75,6 @@ sync: cp -p $(SOURCE_DIR)/lisp/tramp-sudoedit.el tramp-sudoedit.el cp -p $(SOURCE_DIR)/lisp/tramp-uu.el tramp-uu.el cp -p $(SOURCE_DIR)/lisp/trampver.el trampver.el - sed -e "$(SCRIPTV)" -e "$(SCRIPTP)" $(SOURCE_DIR)/lisp/tramp.el > tramp.el + sed -e '$(SCRIPTV)' -e '$(SCRIPTP)' $(SOURCE_DIR)/lisp/tramp.el > tramp.el $(MAKE) -C texi sync $(MAKE) -C test sync diff --git a/README b/README index 147214c4d9..0561aa4a0c 100644 --- a/README +++ b/README @@ -32,11 +32,11 @@ Emacs 28 or older • Remove all byte-compiled Tramp files - $ rm -f ~/.emacs.d/elpa/tramp-2.7.2.3/tramp*.elc + $ rm -f ~/.emacs.d/elpa/tramp-2.7.2.3.1/tramp*.elc • Start Emacs with Tramp's source files - $ emacs -L ~/.emacs.d/elpa/tramp-2.7.2.3 -l tramp + $ emacs -L ~/.emacs.d/elpa/tramp-2.7.2.3.1 -l tramp This should not give you the error. @@ -50,7 +50,7 @@ Mitigation of a bug in Emacs 29.1 --------------------------------- Due to a bug in Emacs 29.1, you must apply the following change prior -installation or upgrading Tramp 2.7.2.3 from GNU ELPA: +installation or upgrading Tramp 2.7.2.3.1 from GNU ELPA: (when (string-equal emacs-version "29.1") (with-current-buffer diff --git a/test/tramp-tests.el b/test/tramp-tests.el index 605b26206c..e22f1afc18 100644 --- a/test/tramp-tests.el +++ b/test/tramp-tests.el @@ -4279,6 +4279,8 @@ This tests also `file-executable-p', `file-writable-p' and `set-file-modes'." (ignore-errors (delete-file tmp-name1)) (ignore-errors (delete-file tmp-name2))))))) +(tramp--test-deftest-without-file-attributes tramp-test20-file-modes) + ;; Method "smb" could run into "NT_STATUS_REVISION_MISMATCH" error. (defmacro tramp--test-ignore-add-name-to-file-error (&rest body) "Run BODY, ignoring \"error with add-name-to-file\" file error." @@ -4578,6 +4580,8 @@ This tests also `make-symbolic-link', `file-truename' and `add-name-to-file'." (should (string-equal (file-truename dir1) (expand-file-name dir1))) (should (string-equal (file-truename dir2) (expand-file-name dir2))))))) +(tramp--test-deftest-without-file-attributes tramp-test21-file-links) + (ert-deftest tramp-test22-file-times () "Check `set-file-times' and `file-newer-than-file-p'." (skip-unless (tramp--test-enabled)) diff --git a/texi/tramp.texi b/texi/tramp.texi index 4f6b1743ea..e44a40f397 100644 --- a/texi/tramp.texi +++ b/texi/tramp.texi @@ -6204,17 +6204,6 @@ If these errors can be ignored, set user option non-@code{nil} value. This transforms the error into a warning. -@item -How to ignore errors when changing file attributes? - -@vindex tramp-inhibit-errors-if-setting-file-attributes-fail -Sometimes, for example while saving remote files, errors appear when -changing file attributes like permissions, time stamps, or ownership. -If these errors can be ignored, set user option -@code{tramp-inhibit-errors-if-setting-file-attributes-fail} to a -non-@code{nil} value. This transforms the error into a warning. - - @item How to disable other packages from calling @value{tramp}? @@ -6648,6 +6637,15 @@ the following settings are required: @end group @end lisp +@vindex warning-suppress-types +@value{tramp} warnings are displayed in the @file{*Warnings*} buffer, +which pops up. If you don't want to see this buffer for every +@value{tramp} warning, set @code{warning-suppress-types}: + +@lisp +(setq warning-suppress-types '((tramp))) +@end lisp + If @code{tramp-verbose} is greater than or equal to 10, Lisp backtraces are also added to the @value{tramp} debug buffer in case of errors. diff --git a/texi/trampver.texi b/texi/trampver.texi index 5365fc3172..4a6742568f 100644 --- a/texi/trampver.texi +++ b/texi/trampver.texi @@ -7,7 +7,7 @@ @c In the Tramp GIT, the version number and the bug report address @c are auto-frobbed from configure.ac. -@set trampver 2.7.2.3 +@set trampver 2.7.2.3.1 @set trampurl https://www.gnu.org/software/tramp/ @set tramp-bug-report-address tramp-devel@@gnu.org @set emacsver 27.1 diff --git a/tramp-adb.el b/tramp-adb.el index 1ecabd8165..dee6b7899e 100644 --- a/tramp-adb.el +++ b/tramp-adb.el @@ -480,11 +480,11 @@ Emacs dired can't find files." (with-tramp-file-property v localname "file-executable-p" ;; Examine `file-attributes' cache to see if request can be ;; satisfied without remote operation. - (if (tramp-use-file-attributes v) - (or (tramp-check-cached-permissions v ?x) - (tramp-check-cached-permissions v ?s)) - (tramp-adb-send-command-and-check - v (format "test -x %s" (tramp-shell-quote-argument localname))))))) + (or (tramp-check-cached-permissions v ?x) + (tramp-check-cached-permissions v ?s) + (tramp-check-cached-permissions v ?t) + (tramp-adb-send-command-and-check + v (format "test -x %s" (tramp-shell-quote-argument localname))))))) (defun tramp-adb-handle-file-exists-p (filename) "Like `file-exists-p' for Tramp files." @@ -498,10 +498,9 @@ Emacs dired can't find files." (with-tramp-file-property v localname "file-readable-p" ;; Examine `file-attributes' cache to see if request can be ;; satisfied without remote operation. - (if (tramp-use-file-attributes v) - (tramp-handle-file-readable-p filename) - (tramp-adb-send-command-and-check - v (format "test -r %s" (tramp-shell-quote-argument localname))))))) + (or (tramp-handle-file-readable-p filename) + (tramp-adb-send-command-and-check + v (format "test -r %s" (tramp-shell-quote-argument localname))))))) (defun tramp-adb-handle-file-writable-p (filename) "Like `file-writable-p' for Tramp files." diff --git a/tramp-cache.el b/tramp-cache.el index 14ee10416a..87e7feae18 100644 --- a/tramp-cache.el +++ b/tramp-cache.el @@ -473,10 +473,10 @@ used to cache connection properties of the local machine." (hash (tramp-get-hash-table key)) (cached (and (hash-table-p hash) (gethash ,property hash tramp-cache-undefined)))) - (tramp-message key 7 "Saved %s %s" property cached) + (tramp-message key 7 "Saved %s %s" ,property cached) (unwind-protect (progn ,@body) ;; Reset PROPERTY. Recompute hash, it could have been flushed. - (tramp-message key 7 "Restored %s %s" property cached) + (tramp-message key 7 "Restored %s %s" ,property cached) (setq hash (tramp-get-hash-table key)) (if (not (eq cached tramp-cache-undefined)) (puthash ,property cached hash) @@ -573,12 +573,11 @@ PROPERTIES is a list of file properties (strings)." print-length print-level) ;; Remove `tramp-null-hop'. (remhash tramp-null-hop cache) - ;; Remove temporary data. If there is the key "login-as", we - ;; don't save either, because all other properties might - ;; depend on the login name, and we want to give the - ;; possibility to use another login name later on. Key - ;; "started" exists for the "ftp" method only, which must not - ;; be kept persistent. + ;; If there is the key "login-as", we don't save, because all + ;; other properties might depend on the login name, and we + ;; want to give the possibility to use another login name + ;; later on. Key "started" exists for the "ftp" method only, + ;; which must not be kept persistent. (maphash (lambda (key value) (if (and (tramp-file-name-p key) (hash-table-p value) diff --git a/tramp-compat.el b/tramp-compat.el index c9629a6f3c..c1fb8ceaa8 100644 --- a/tramp-compat.el +++ b/tramp-compat.el @@ -38,30 +38,34 @@ (require 'xdg) (declare-function tramp-error "tramp-message") +(declare-function tramp-warning "tramp-message") (declare-function tramp-tramp-file-p "tramp") (defvar tramp-temp-name-prefix) (defconst tramp-compat-emacs-compiled-version (eval-when-compile emacs-version) "The Emacs version used for compilation.") -(unless (= emacs-major-version - (car (version-to-list tramp-compat-emacs-compiled-version))) - (lwarn 'tramp :warning - "Tramp has been compiled with Emacs %s, this is Emacs %s" - tramp-compat-emacs-compiled-version emacs-version)) - -(with-eval-after-load 'docker-tramp - (lwarn 'tramp :warning - (concat "Package `docker-tramp' has been obsoleted, " - "please use integrated package `tramp-container'"))) -(with-eval-after-load 'kubernetes-tramp - (lwarn 'tramp :warning - (concat "Package `kubernetes-tramp' has been obsoleted, " - "please use integrated package `tramp-container'"))) -(with-eval-after-load 'tramp-nspawn - (lwarn 'tramp :warning - (concat "Package `tramp-nspawn' has been obsoleted, " - "please use integrated package `tramp-container'"))) +(with-eval-after-load 'tramp + (unless (= emacs-major-version + (car (version-to-list tramp-compat-emacs-compiled-version))) + (tramp-warning nil + "Tramp has been compiled with Emacs %s, this is Emacs %s" + tramp-compat-emacs-compiled-version emacs-version)) + + (with-eval-after-load 'docker-tramp + (tramp-warning nil + (concat "Package `docker-tramp' has been obsoleted, " + "please use integrated package `tramp-container'"))) + + (with-eval-after-load 'kubernetes-tramp + (tramp-warning nil + (concat "Package `kubernetes-tramp' has been obsoleted, " + "please use integrated package `tramp-container'"))) + + (with-eval-after-load 'tramp-nspawn + (tramp-warning nil + (concat "Package `tramp-nspawn' has been obsoleted, " + "please use integrated package `tramp-container'")))) ;; For not existing functions, obsolete functions, or functions with a ;; changed argument list, there are compiler warnings. We want to diff --git a/tramp-gvfs.el b/tramp-gvfs.el index 3df69d79fc..9530aa3733 100644 --- a/tramp-gvfs.el +++ b/tramp-gvfs.el @@ -1467,8 +1467,9 @@ If FILE-SYSTEM is non-nil, return file system attributes." "Like `file-executable-p' for Tramp files." (with-parsed-tramp-file-name (expand-file-name filename) nil (with-tramp-file-property v localname "file-executable-p" - (or (tramp-check-cached-permissions v ?x) - (tramp-check-cached-permissions v ?s))))) + (or (tramp-check-cached-permissions v ?x 'force) + (tramp-check-cached-permissions v ?s 'force) + (tramp-check-cached-permissions v ?t 'force))))) (defun tramp-gvfs-handle-file-name-all-completions (filename directory) "Like `file-name-all-completions' for Tramp files." diff --git a/tramp-message.el b/tramp-message.el index 73a0ea9ce2..5282b00ec5 100644 --- a/tramp-message.el +++ b/tramp-message.el @@ -467,7 +467,7 @@ the resulting error message." "Show a warning. VEC-OR-PROC identifies the connection to use, remaining arguments passed to `tramp-message'." - (declare (tramp-suppress-trace t)) + (declare (indent 1) (tramp-suppress-trace t)) (let (signal-hook-function) (apply 'tramp-message vec-or-proc 2 fmt-string arguments) (apply 'lwarn 'tramp :warning fmt-string arguments))) diff --git a/tramp-sh.el b/tramp-sh.el index ef4ddee8a5..9d74c2fd08 100644 --- a/tramp-sh.el +++ b/tramp-sh.el @@ -644,6 +644,14 @@ we have this shell function. Format specifiers are replaced by `tramp-expand-script', percent characters need to be doubled.") +(defconst tramp-readlink-file-truename + "if %m -h \"$1\"; then echo t; else echo nil; fi +%r \"$1\"" + "Shell script to produce output suitable for use with `file-truename' +on the remote file system. +Format specifiers are replaced by `tramp-expand-script', percent +characters need to be doubled.") + (defconst tramp-perl-file-truename "%p -e ' use File::Spec; @@ -1147,11 +1155,11 @@ characters need to be doubled.") (defconst tramp-bundle-read-file-names "echo \"(\" while read file; do - quoted=`echo \"$file\" | sed -e \"s/\\\"/\\\\\\\\\\\\\\\\\\\"/\"` - printf \"(%%b\" \"\\\"$quoted\\\"\" - if %s \"$file\"; then printf \" %%b\" t; else printf \" %%b\" nil; fi - if %s \"$file\"; then printf \" %%b\" t; else printf \" %%b\" nil; fi - if %s \"$file\"; then printf \" %%b)\n\" t; else printf \" %%b)\n\" nil; fi + quoted=`echo \"$file\" | sed -e \"s/\\\"/\\\\\\\\\\\\\\\\\\\"/\"` + printf \"(%%b\" \"\\\"$quoted\\\"\" + if %q \"$file\"; then printf \" %%b\" t; else printf \" %%b\" nil; fi + if %m -r \"$file\"; then printf \" %%b\" t; else printf \" %%b\" nil; fi + if %m -d \"$file\"; then printf \" %%b)\n\" t; else printf \" %%b)\n\" nil; fi done echo \")\"" "Script to check file attributes of a bundle of files. @@ -1287,18 +1295,15 @@ Operations not mentioned here will be handled by the normal Emacs functions.") (cond ;; Use GNU readlink --canonicalize-missing where available. ((tramp-get-remote-readlink v) + (tramp-maybe-send-script + v tramp-readlink-file-truename "tramp_readlink_file_truename") (tramp-send-command-and-check - v (format - (concat - "(if %s -h \"%s\"; then echo t; else echo nil; fi) && " - "%s --canonicalize-missing %s") - (tramp-get-test-command v) - (tramp-shell-quote-argument localname) - (tramp-get-remote-readlink v) - (tramp-shell-quote-argument localname))) + v (format "tramp_readlink_file_truename %s" + (tramp-shell-quote-argument localname))) (with-current-buffer (tramp-get-connection-buffer v) (goto-char (point-min)) - (tramp-set-file-property v localname "file-symlink-marker" (read (current-buffer))) + (tramp-set-file-property + v localname "file-symlink-marker" (read (current-buffer))) ;; We cannot call `read', the file name isn't quoted. (forward-line) (buffer-substring (point) (line-end-position)))) @@ -1314,7 +1319,8 @@ Operations not mentioned here will be handled by the normal Emacs functions.") (tramp-shell-quote-argument localname))) (with-current-buffer (tramp-get-connection-buffer v) (goto-char (point-min)) - (tramp-set-file-property v localname "file-symlink-marker" (read (current-buffer))) + (tramp-set-file-property + v localname "file-symlink-marker" (read (current-buffer))) (read (current-buffer)))) ;; Do it yourself. @@ -1783,10 +1789,10 @@ ID-FORMAT valid values are `string' and `integer'." (with-tramp-file-property v localname "file-executable-p" ;; Examine `file-attributes' cache to see if request can be ;; satisfied without remote operation. - (if (tramp-use-file-attributes v) - (or (tramp-check-cached-permissions v ?x) - (tramp-check-cached-permissions v ?s)) - (tramp-run-test v "-x" localname))))) + (or (tramp-check-cached-permissions v ?x) + (tramp-check-cached-permissions v ?s) + (tramp-check-cached-permissions v ?t) + (tramp-run-test v "-x" localname))))) (defun tramp-sh-handle-file-readable-p (filename) "Like `file-readable-p' for Tramp files." @@ -1794,9 +1800,8 @@ ID-FORMAT valid values are `string' and `integer'." (with-tramp-file-property v localname "file-readable-p" ;; Examine `file-attributes' cache to see if request can be ;; satisfied without remote operation. - (if (tramp-use-file-attributes v) - (tramp-handle-file-readable-p filename) - (tramp-run-test v "-r" localname))))) + (or (tramp-handle-file-readable-p filename) + (tramp-run-test v "-r" localname))))) ;; Functions implemented using the basic functions above. @@ -1826,13 +1831,11 @@ ID-FORMAT valid values are `string' and `integer'." (if (file-exists-p filename) ;; Examine `file-attributes' cache to see if request can be ;; satisfied without remote operation. - (if (tramp-use-file-attributes v) - (tramp-check-cached-permissions v ?w) - (tramp-run-test v "-w" localname)) + (or (tramp-check-cached-permissions v ?w) + (tramp-run-test v "-w" localname)) ;; If file doesn't exist, check if directory is writable. - (and - (file-directory-p (file-name-directory filename)) - (file-writable-p (file-name-directory filename))))))) + (and (file-directory-p (file-name-directory filename)) + (file-writable-p (file-name-directory filename))))))) (defun tramp-sh-handle-file-ownership-preserved-p (filename &optional group) "Like `file-ownership-preserved-p' for Tramp files." @@ -3598,12 +3601,7 @@ FILES must be the local names only. The cache attributes to be filled are described in `tramp-bundle-read-file-names'." (when files (tramp-maybe-send-script - vec - (format tramp-bundle-read-file-names - (tramp-get-file-exists-command vec) - (format "%s -r" (tramp-get-test-command vec)) - (format "%s -d" (tramp-get-test-command vec))) - "tramp_bundle_read_file_names") + vec tramp-bundle-read-file-names "tramp_bundle_read_file_names") (dolist (elt @@ -3989,14 +3987,15 @@ Fall back to normal file name handler if no Tramp handler exists." (defun tramp-expand-script (vec script) "Expand SCRIPT with remote files or commands. -\"%a\", \"%h\", \"%l\", \"%o\", \"%p\", \"%r\", \"%s\" and \"%y\" -format specifiers are replaced by the respective `awk', -`hexdump', `ls', `od', `perl', `readlink', `stat' and `python' -commands. \"%n\" is replaced by \"2>/dev/null\", and \"%t\" is -replaced by a temporary file name. If VEC is nil, the respective -local commands are used. If there is a format specifier which -cannot be expanded, this function returns nil." - (if (not (string-match-p (rx (| bol (not "%")) "%" (any "ahlnoprsty")) script)) +\"%a\", \"%h\", \"%l\", \"%m\", \"%o\", \"%p\", \"%q\", \"%r\", \"%s\" +and \"%y\" format specifiers are replaced by the respective `awk', +`hexdump', `ls', `test', od', `perl', `test -e', `readlink', `stat' and +`python' commands. \"%n\" is replaced by \"2>/dev/null\", and \"%t\" is +replaced by a temporary file name. If VEC is nil, the respective local +commands are used. If there is a format specifier which cannot be +expanded, this function returns nil." + (if (not (string-match-p + (rx (| bol (not "%")) "%" (any "ahlmnopqrsty")) script)) script (catch 'wont-work (let ((awk (when (string-match-p (rx (| bol (not "%")) "%a") script) @@ -4019,6 +4018,12 @@ cannot be expanded, this function returns nil." (or (tramp-get-ls-command vec) (throw 'wont-work nil)) (tramp-sh--quoting-style-options vec)))) + (test (when (string-match-p (rx (| bol (not "%")) "%m") script) + (or (tramp-get-test-command vec) + (throw 'wont-work nil)))) + (test-e (when (string-match-p (rx (| bol (not "%")) "%q") script) + (or (tramp-get-file-exists-command vec) + (throw 'wont-work nil)))) (od (when (string-match-p (rx (| bol (not "%")) "%o") script) (or (if vec (tramp-get-remote-od vec) (executable-find "od")) (throw 'wont-work nil)))) @@ -4034,11 +4039,13 @@ cannot be expanded, this function returns nil." (executable-find "python")) (throw 'wont-work nil)))) (readlink (when (string-match-p (rx (| bol (not "%")) "%r") script) - (or - (if vec - (tramp-get-remote-readlink vec) - (executable-find "readlink")) - (throw 'wont-work nil)))) + (format "%s %s" + (or + (if vec + (tramp-get-remote-readlink vec) + (executable-find "readlink")) + (throw 'wont-work nil)) + "--canonicalize-missing"))) (stat (when (string-match-p (rx (| bol (not "%")) "%s") script) (or (if vec @@ -4053,8 +4060,8 @@ cannot be expanded, this function returns nil." (format-spec script (format-spec-make - ?a awk ?h hdmp ?l ls ?n dev ?o od ?p perl - ?r readlink ?s stat ?t tmp ?y python)))))) + ?a awk ?h hdmp ?l ls ?m test ?n dev ?o od ?p perl + ?q test-e ?r readlink ?s stat ?t tmp ?y python)))))) (defun tramp-maybe-send-script (vec script name) "Define in remote shell function NAME implemented as SCRIPT. @@ -5853,12 +5860,11 @@ Nonexistent directories are removed from spec." "Determine remote `readlink' command." (with-tramp-connection-property vec "readlink" (tramp-message vec 5 "Finding a suitable `readlink' command") - (let ((result (tramp-find-executable - vec "readlink" (tramp-get-remote-path vec)))) - (when (and result - (tramp-send-command-and-check - vec (format "%s --canonicalize-missing /" result))) - result)))) + (when-let* ((result (tramp-find-executable + vec "readlink" (tramp-get-remote-path vec))) + ((tramp-send-command-and-check + vec (format "%s --canonicalize-missing /" result)))) + result))) (defun tramp-get-remote-touch (vec) "Determine remote `touch' command." diff --git a/tramp-sudoedit.el b/tramp-sudoedit.el index ff01eac5b9..59b4ea46b8 100644 --- a/tramp-sudoedit.el +++ b/tramp-sudoedit.el @@ -479,11 +479,11 @@ the result will be a local, non-Tramp, file name." (with-tramp-file-property v localname "file-executable-p" ;; Examine `file-attributes' cache to see if request can be ;; satisfied without remote operation. - (if (tramp-use-file-attributes v) - (or (tramp-check-cached-permissions v ?x) - (tramp-check-cached-permissions v ?s)) - (tramp-sudoedit-send-command - v "test" "-x" (file-name-unquote localname)))))) + (or (tramp-check-cached-permissions v ?x) + (tramp-check-cached-permissions v ?s) + (tramp-check-cached-permissions v ?t) + (tramp-sudoedit-send-command + v "test" "-x" (file-name-unquote localname)))))) (defun tramp-sudoedit-handle-file-exists-p (filename) "Like `file-exists-p' for Tramp files." @@ -519,10 +519,9 @@ the result will be a local, non-Tramp, file name." (with-tramp-file-property v localname "file-readable-p" ;; Examine `file-attributes' cache to see if request can be ;; satisfied without remote operation. - (if (tramp-use-file-attributes v) - (tramp-handle-file-readable-p filename) - (tramp-sudoedit-send-command - v "test" "-r" (file-name-unquote localname)))))) + (or (tramp-handle-file-readable-p filename) + (tramp-sudoedit-send-command + v "test" "-r" (file-name-unquote localname)))))) (defun tramp-sudoedit-handle-set-file-modes (filename mode &optional flag) "Like `set-file-modes' for Tramp files." @@ -604,10 +603,9 @@ the result will be a local, non-Tramp, file name." (if (file-exists-p filename) ;; Examine `file-attributes' cache to see if request can be ;; satisfied without remote operation. - (if (tramp-use-file-attributes v) - (tramp-check-cached-permissions v ?w) - (tramp-sudoedit-send-command - v "test" "-w" (file-name-unquote localname))) + (or (tramp-check-cached-permissions v ?w) + (tramp-sudoedit-send-command + v "test" "-w" (file-name-unquote localname))) ;; If file doesn't exist, check if directory is writable. (and (file-directory-p (file-name-directory filename)) diff --git a/tramp.el b/tramp.el index cdd839a992..0acb613324 100644 --- a/tramp.el +++ b/tramp.el @@ -7,7 +7,7 @@ ;; Maintainer: Michael Albinus <michael.albi...@gmx.de> ;; Keywords: comm, processes ;; Package: tramp -;; Version: 2.7.2.3 +;; Version: 2.7.2.3.1 ;; Package-Requires: ((emacs "27.1")) ;; Package-Type: multi ;; URL: https://www.gnu.org/software/tramp/ @@ -3509,7 +3509,7 @@ BODY is the backend specific code." nil))) (defcustom tramp-use-file-attributes t - "Whether to use \"file-attributes\" file property for check. + "Whether to use \"file-attributes\" connection property for check. 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. @@ -4331,13 +4331,12 @@ Let-bind it when necessary.") "Like `file-readable-p' for Tramp files." (with-parsed-tramp-file-name (expand-file-name filename) nil (with-tramp-file-property v localname "file-readable-p" - (or (tramp-check-cached-permissions v ?r) + (or (tramp-check-cached-permissions v ?r 'force) ;; `tramp-check-cached-permissions' doesn't handle symbolic ;; links. (and-let* ((symlink (file-symlink-p filename)) ((stringp symlink)) - ((file-readable-p - (concat (file-remote-p filename) symlink))))))))) + ((file-readable-p (file-truename filename))))))))) (defun tramp-handle-file-regular-p (filename) "Like `file-regular-p' for Tramp files." @@ -4431,7 +4430,12 @@ existing) are returned." (with-parsed-tramp-file-name (expand-file-name filename) nil (with-tramp-file-property v localname "file-writable-p" (if (file-exists-p filename) - (tramp-check-cached-permissions v ?w) + (or (tramp-check-cached-permissions v ?w 'force) + ;; `tramp-check-cached-permissions' doesn't handle + ;; symbolic links. + (and-let* ((symlink (file-symlink-p filename)) + ((stringp symlink)) + ((file-writable-p (file-truename filename)))))) ;; If file doesn't exist, check if directory is writable. (and (file-directory-p (file-name-directory filename)) (file-writable-p (file-name-directory filename))))))) @@ -6424,22 +6428,23 @@ VEC is used for tracing." (when vec (tramp-message vec 7 "locale %s" (or locale "C"))) (or locale "C")))) -(defun tramp-check-cached-permissions (vec access) +(defun tramp-check-cached-permissions (vec access &optional force) "Check `file-attributes' caches for VEC. -Return t if according to the cache access type ACCESS is known to -be granted." +Return t if according to the cache access type ACCESS is known to be +granted, if `tramp-use-file-attributes' mandates this. If FORCE is +non-nil, use connection property \"file-attributes\" mandatory." (when-let* ((offset (cond ((eq ?r access) 1) ((eq ?w access) 2) ((eq ?x access) 3) - ((eq ?s access) 3))) + ((eq ?s access) 3) + ((eq ?t access) 3))) + ((or force (tramp-use-file-attributes vec))) (file-attr (file-attributes (tramp-make-tramp-file-name vec))) + ;; Not a symlink. + ((not (stringp (file-attribute-type file-attr)))) (remote-uid (tramp-get-remote-uid vec 'integer)) (remote-gid (tramp-get-remote-gid vec 'integer))) - (or - ;; Not a symlink. - (eq t (file-attribute-type file-attr)) - (null (file-attribute-type file-attr))) (or ;; World accessible. (eq access (aref (file-attribute-modes file-attr) (+ offset 6))) diff --git a/trampver.el b/trampver.el index 2c5095debc..32837c5384 100644 --- a/trampver.el +++ b/trampver.el @@ -7,7 +7,7 @@ ;; Maintainer: Michael Albinus <michael.albi...@gmx.de> ;; Keywords: comm, processes ;; Package: tramp -;; Version: 2.7.2.3 +;; Version: 2.7.2.3.1 ;; Package-Requires: ((emacs "27.1")) ;; Package-Type: multi ;; URL: https://www.gnu.org/software/tramp/ @@ -40,7 +40,7 @@ ;; ./configure" to change them. ;;;###tramp-autoload -(defconst tramp-version "2.7.2.3" +(defconst tramp-version "2.7.2.3.1" "This version of Tramp.") ;;;###tramp-autoload @@ -76,7 +76,7 @@ ;; Check for Emacs version. (let ((x (if (not (string-version-lessp emacs-version "27.1")) "ok" - (format "Tramp 2.7.2.3 is not fit for %s" + (format "Tramp 2.7.2.3.1 is not fit for %s" (replace-regexp-in-string "\n" "" (emacs-version)))))) (unless (string-equal "ok" x) (error "%s" x)))