Minor Tramp fixes
* lisp/net/tramp-sh.el (tramp-perl-id): Fix Perl script. (tramp-sh-handle-expand-file-name): * lisp/net/tramp-sudoedit.el (tramp-sudoedit-handle-expand-file-name): Check, that there's really a Tramp file name.
This commit is contained in:
parent
5933055a3e
commit
215f65d1dc
2 changed files with 40 additions and 34 deletions
|
@ -789,8 +789,8 @@ use strict;
|
|||
use warnings;
|
||||
use POSIX qw(getgroups);
|
||||
|
||||
my ($user, $passwd, $uid, $gid) = getpwuid $< ;
|
||||
my $group = getgrgid $gid ;
|
||||
my ( $uid, $user ) = ( $>, scalar getpwuid $> );
|
||||
my ( $gid, $group ) = ( $), scalar getgrgid $) );
|
||||
my @groups = map { $_ . \"(\" . getgrgid ($_) . \")\" } getgroups ();
|
||||
|
||||
printf \"uid=%%d(%%s) gid=%%d(%%s) groups=%%s\\n\",
|
||||
|
@ -2827,11 +2827,14 @@ the result will be a local, non-Tramp, file name."
|
|||
;; Handle empty NAME.
|
||||
(when (zerop (length name)) (setq name "."))
|
||||
;; On MS Windows, some special file names are not returned properly
|
||||
;; by `file-name-absolute-p'.
|
||||
(if (and (eq system-type 'windows-nt)
|
||||
(string-match-p
|
||||
(tramp-compat-rx bol (| (: alpha ":") (: (literal null-device) eol)))
|
||||
name))
|
||||
;; by `file-name-absolute-p'. If `tramp-syntax' is `simplified',
|
||||
;; there could be the falso positive "/:".
|
||||
(if (or (and (eq system-type 'windows-nt)
|
||||
(string-match-p
|
||||
(tramp-compat-rx bol (| (: alpha ":") (: (literal null-device) eol)))
|
||||
name))
|
||||
(and (not (tramp-tramp-file-p name))
|
||||
(not (tramp-tramp-file-p dir))))
|
||||
(tramp-run-real-handler #'expand-file-name (list name dir))
|
||||
;; Unless NAME is absolute, concat DIR and NAME.
|
||||
(unless (file-name-absolute-p name)
|
||||
|
|
|
@ -369,33 +369,36 @@ the result will be a local, non-Tramp, file name."
|
|||
;; Unless NAME is absolute, concat DIR and NAME.
|
||||
(unless (file-name-absolute-p name)
|
||||
(setq name (tramp-compat-file-name-concat dir name)))
|
||||
(with-parsed-tramp-file-name name nil
|
||||
;; Tilde expansion if necessary. We cannot accept "~/", because
|
||||
;; under sudo "~/" is expanded to the local user home directory
|
||||
;; but to the root home directory.
|
||||
(when (zerop (length localname))
|
||||
(setq localname "~"))
|
||||
(unless (file-name-absolute-p localname)
|
||||
(setq localname (format "~%s/%s" user localname)))
|
||||
(when (string-match
|
||||
(tramp-compat-rx bos "~" (group (* (not "/"))) (group (* nonl)) eos)
|
||||
localname)
|
||||
(let ((uname (match-string 1 localname))
|
||||
(fname (match-string 2 localname))
|
||||
hname)
|
||||
(when (zerop (length uname))
|
||||
(setq uname user))
|
||||
(when (setq hname (tramp-get-home-directory v uname))
|
||||
(setq localname (concat hname fname)))))
|
||||
;; Do not keep "/..".
|
||||
(when (string-match-p (rx bos "/" (** 1 2 ".") eos) localname)
|
||||
(setq localname "/"))
|
||||
;; Do normal `expand-file-name' (this does "~user/", "/./" and "/../").
|
||||
(tramp-make-tramp-file-name
|
||||
v (if (string-prefix-p "~" localname)
|
||||
localname
|
||||
(tramp-run-real-handler
|
||||
#'expand-file-name (list localname))))))
|
||||
;; If NAME is not a Tramp file, run the real handler.
|
||||
(if (not (tramp-tramp-file-p name))
|
||||
(tramp-run-real-handler #'expand-file-name (list name))
|
||||
(with-parsed-tramp-file-name name nil
|
||||
;; Tilde expansion if necessary. We cannot accept "~/", because
|
||||
;; under sudo "~/" is expanded to the local user home directory
|
||||
;; but to the root home directory.
|
||||
(when (zerop (length localname))
|
||||
(setq localname "~"))
|
||||
(unless (file-name-absolute-p localname)
|
||||
(setq localname (format "~%s/%s" user localname)))
|
||||
(when (string-match
|
||||
(tramp-compat-rx bos "~" (group (* (not "/"))) (group (* nonl)) eos)
|
||||
localname)
|
||||
(let ((uname (match-string 1 localname))
|
||||
(fname (match-string 2 localname))
|
||||
hname)
|
||||
(when (zerop (length uname))
|
||||
(setq uname user))
|
||||
(when (setq hname (tramp-get-home-directory v uname))
|
||||
(setq localname (concat hname fname)))))
|
||||
;; Do not keep "/..".
|
||||
(when (string-match-p (rx bos "/" (** 1 2 ".") eos) localname)
|
||||
(setq localname "/"))
|
||||
;; Do normal `expand-file-name' (this does "~user/", "/./" and "/../").
|
||||
(tramp-make-tramp-file-name
|
||||
v (if (string-prefix-p "~" localname)
|
||||
localname
|
||||
(tramp-run-real-handler
|
||||
#'expand-file-name (list localname)))))))
|
||||
|
||||
(defun tramp-sudoedit-remote-acl-p (vec)
|
||||
"Check, whether ACL is enabled on the remote host."
|
||||
|
|
Loading…
Add table
Reference in a new issue