aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorJim Porter2023-01-10 15:35:18 -0800
committerJim Porter2023-01-16 17:11:02 -0800
commit0bb8a011d57cb55c16ff502125b60e8e3bb3d5aa (patch)
tree4756c74e355419d4f14f569f0aa50ea2f13b6a49 /test
parentbcaa63ac506dc070b29db13326801ff978e8b00d (diff)
downloademacs-0bb8a011d57cb55c16ff502125b60e8e3bb3d5aa.tar.gz
emacs-0bb8a011d57cb55c16ff502125b60e8e3bb3d5aa.zip
Add 'file-user-uid' to get the connection-local effective UID
In particular, this lets Eshell show a "#" root prompt sigil when the user has sudo'ed via "cd /sudo::" (bug#60722). * lisp/simple.el (file-user-uid): New function. * lisp/net/tramp.el (tramp-file-name-for-operation): Add 'file-user-uid'. (tramp-handle-file-user-uid): New function. * lisp/net/tramp-adb.el (tramp-adb-file-name-handler-alist): * lisp/net/tramp-crypt.el (tramp-crypt-file-name-handler-alist): * lisp/net/tramp-gvfs.el (tramp-gvfs-file-name-handler-alist): * lisp/net/tramp-rclone.el (tramp-rclone-file-name-handler-alist): * lisp/net/tramp-sh.el (tramp-sh-file-name-handler-alist): * lisp/net/tramp-smb.el (tramp-smb-file-name-handler-alist): * lisp/net/tramp-sshfs.el (tramp-sshfs-file-name-handler-alist): * lisp/net/tramp-sudoedit.el (tramp-sudoedit-file-name-handler-alist): Add 'file-user-uid'. * lisp/net/tramp-archive.el (tramp-archive-handle-file-user-uid): New function... (tramp-archive-file-name-handler-alist): ... use it. * lisp/eshell/em-prompt.el (eshell-prompt-function): Use 'file-user-uid'. * lisp/eshell/esh-var.el (eshell-variable-aliases-list): Add '$UID'. * test/lisp/eshell/esh-var-tests.el (esh-var-test/uid-var): New test. * doc/lispref/os.texi (User Identification): Document 'file-user-uid'. * doc/lispref/files.texi (Magic File Names): Mention 'file-user-uid'. * doc/misc/eshell.texi (Variables): Document '$UID'. Add a missing index entry for '$INSIDE_EMACS'. * etc/NEWS: Announce 'file-user-uid'.
Diffstat (limited to 'test')
-rw-r--r--test/lisp/eshell/esh-var-tests.el4
1 files changed, 4 insertions, 0 deletions
diff --git a/test/lisp/eshell/esh-var-tests.el b/test/lisp/eshell/esh-var-tests.el
index 3f602798dbe..0cc1b92266f 100644
--- a/test/lisp/eshell/esh-var-tests.el
+++ b/test/lisp/eshell/esh-var-tests.el
@@ -746,6 +746,10 @@ it, since the setter is nil."
746 (format "cd %s" ert-remote-temporary-file-directory)) 746 (format "cd %s" ert-remote-temporary-file-directory))
747 (eshell-match-command-output "echo $PATH" (regexp-quote remote-path))))) 747 (eshell-match-command-output "echo $PATH" (regexp-quote remote-path)))))
748 748
749(ert-deftest esh-var-test/uid-var ()
750 "Test that $UID is equivalent to (user-uid) for local directories."
751 (eshell-command-result-equal "echo $UID" (user-uid)))
752
749(ert-deftest esh-var-test/last-status-var-lisp-command () 753(ert-deftest esh-var-test/last-status-var-lisp-command ()
750 "Test using the \"last exit status\" ($?) variable with a Lisp command" 754 "Test using the \"last exit status\" ($?) variable with a Lisp command"
751 (with-temp-eshell 755 (with-temp-eshell