emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Tramp 2.0 -> 2.1 migration woes


From: Trent W. Buck
Subject: Re: Tramp 2.0 -> 2.1 migration woes
Date: Mon, 28 Jan 2008 13:30:18 +1100
User-agent: Mutt/1.5.17+20080114 (2008-01-14)

On Sun, Jan 27, 2008 at 03:57:49PM +0100, Michael Albinus wrote:
> "Trent W. Buck" <address@hidden> writes:
> 
> > The initial hops are no longer shown in the path, nor on the first
> > line of dired buffers.  Already I have been VERY confused because
> > a bad tramp-default-proxies-alist resulted in no proxy being used for
> >
> >     /sudo:address@hidden:/etc
> >
> > ...so that instead of editing leek's /etc as root, I was editing my
> > laptop's /etc as root!  Since the path claims that I'm on address@hidden, I
> > would have made disastrous changes to my local system if I hadn't
> > noticed that there was no /etc/ssh/sshd_config (because sshd is not
> > installed on my laptop).
> 
> The appended patch shall fix it. Could you, please, test?

Yes, that seems to work, but I would extend the whitelist:

- The class A network 127.0.0.0/8
- The unqualified system name (e.g. Clio instead of Clio.twb.ath.cx)
- The comparison should be case-insensitive.

Obviously this whitelist will never be perfect, e.g. if "mail" is a
CNAME alias in on the DNS server for the local host, /sudo:mail: is
meaningful but it would be hard to catch that.

Maybe instead of an error, it should show a warning and continue?  I'm
not sure how you could make a warning pop up so that it would be seen
by the user.  Obviously `message' wouldn't work, because the echo area
would be reused as tramp continued to sudo'ing to localhost.

I would also change the error message to read

    "Host `foo' looks like a remote host, `sudo' can only use the
    local host."

> *** /home/albinus/src/tramp/lisp/tramp.el.~2.624.~    2008-01-26 
> 15:19:11.000000000 +0100
> --- /home/albinus/src/tramp/lisp/tramp.el     2008-01-27 15:43:19.000000000 
> +0100
> ***************
> *** 6052,6057 ****
> --- 6052,6078 ----
>          "Method `%s' is not supported for multi-hops."
>          (tramp-file-name-method item)))))
>   
> +     ;; In case the host name is not used for the remote shell
> +     ;; command, the user could be misguided by applying a random
> +     ;; hostname.
> +     (let* ((v (car target-alist))
> +        (method (tramp-file-name-method v))
> +        (host (tramp-file-name-host v)))
> +       (unless
> +       (or
> +        ;; There are multi-hops.
> +        (cdr target-alist)
> +        ;; The host name is used for the remote shell command.
> +        (member
> +         '("%h") (tramp-get-method-parameter method 'tramp-login-args))
> +        ;; The host is local.  We cannot use `tramp-local-host-p'
> +        ;; here, because it opens a connection as well.
> +        (string-match
> +         (concat "^" (regexp-opt (list "localhost" (system-name)) t) "$")
> +         host))
> +     (tramp-error
> +      v 'file-error "Wrong hostname `%s' for method `%s'" host method)))
> + 
>       ;; Result.
>       target-alist))
>   

Attachment: signature.asc
Description: Digital signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]