[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Tramp 2.0 -> 2.1 migration woes
From: |
Michael Albinus |
Subject: |
Re: Tramp 2.0 -> 2.1 migration woes |
Date: |
Sun, 27 Jan 2008 14:42:23 +0100 |
User-agent: |
Gnus/5.110007 (No Gnus v0.7) Emacs/23.0.50 (gnu/linux) |
"Trent W. Buck" <address@hidden> writes:
Hi Trent,
> Multi-hop now hides initial hops
> ================================
>
> 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).
>
> This accident makes me *extremely* afraid to trust TRAMP 2.1-style
> multi-hops for anything at all, since I'm bound to make alist mistakes
> that I won't catch so fortuitously.
That isn't related to multi-hops. It is simply an error in Tramp, which
shall inform you about the used host.
In case of su(do)?, the host name is ignored (except there is a setting
in tramp-default-proxies-alist). The Tramp documentation says for the
su(do)? methods: "... With other words, a specified host name in the
file name is silently ignored."
Consequently, if you open a file "/sudo:address@hidden:/etc", it must be
expanded to "/sudo:address@hidden:/etc", and this shall be visible. A
warning (or an error?) shall be raised. I'll fix it.
> Shell-command is no longer a shell
> ==================================
>
> It seems that shell-command (M-!) no longer uses a shell in TRAMP
> buffers. For example, in /sudo::/ if I do M-! whoami && pwd RET or
> M-! sh -c 'whoami && pwd' I get the following errors:
>
> whoami: extra operand `&&'
> Try `whoami --help' for more information.
>
> &&: 1: Syntax error: Unterminated quoted string
>
> Another example was running M-! find -name \*~ -delete RET in
> /ssh:leek:, which should have deleted backup files in my home
> directory. In Emacs 22, it behaves correctly. In CVS Emacs, it
> silently fails.
>
> This means I can no longer trust basic sh commands to work correctly,
> and thus cannot use this feature in TRAMP buffers.
I'll fix it. Obviously, there was too much optimization in Tramp 2.1 -
the COMMAND shall still be called via "sh -c COMMAND".
> sudo -s (without -H) now aborts connection
> ==========================================
>
> My .bashrc (et al) is mode 0600 (readable only by me). If I run "sudo
> -u zippy -s" in a shell, I get the (ignorable) error
>
> bash: /home/twb/.bashrc: Permission denied
>
> Because $HOME is still /home/twb. For this reason I use sudo -i or
> (on legacy systems) sudo -H -s in interactive shells. In Emacs 22,
> TRAMP ignores this error and /sudo:zippy@: works fine. In CVS Emacs
> it seems this error aborts the connection entirely:
>
> $ emacs -batch -Q -nw /sudo:zippy@: -f kill-emacs
> Tramp: Opening connection for address@hidden using sudo...
> Tramp: Waiting 60s for local shell to come up...
> Tramp: Sending command `sudo -u zippy -s -p Password: && exit || exit'
> Tramp: Waiting for prompts from remote shell
> File error: Permission denied
> [hangs]
>
> I have worked around this problem successfully with the following code
> in my .emacs. Note that deleting "-H" is merely for potential
> forwards compatibility.
>
> (eval-after-load "tramp"
> '(progn
> (add-to-list 'tramp-methods
> (cons "sudoHs" (copy-tree (cdr (assoc "sudo" tramp-methods)))))
> (let ((x (cdr (cadr (assoc 'tramp-login-args (cdr (assoc "sudo"
> tramp-methods)))))))
> (setcar x (cons "-i" (delete "-H" (delete "-s" (car x))))))
> (let ((x (cdr (cadr (assoc 'tramp-login-args (cdr (assoc "sudoHs"
> tramp-methods)))))))
> (setcar x (cons "-H" (delete "-H" (car x)))))))
I'll check whether this could be the default.
> Multi-hop now requires tedious alist editing
> ============================================
>
> It is often the case that I need to access a customer site that I have
> never accessed before, or whose network layout has changed since I
> last accessed it. On Emacs 22 I would therefore by trial and error
> modify a multi: path until it was correct, do the job, and then forget
> the path. In the short term, I can switch back to an open dired for
> that site, or use M-p at the C-x C-f prompt.
>
> In the long term, by the time I need to access that customer's site
> again, their network will probably have changed. Writing it down
> would be at best bloat, and at worst misleading, since the correct
> information is stored elsewhere in a text file that is maintained by
> other staff who are in charge of that customer's network.
>
> Now, the trial and error step must be done by editing a setq in .emacs
> and repeatedly doing C-M-x, then trying C-x C-f again (possibly
> killing *tramp foo* buffers after each attempt to make sure no stale
> connections cause problems.) To remove this bloaty, misleading
> information I must remember to edit .emacs again after successfully
> connecting. This is quite tedious compared to editing a single multi:
> string at the C-x C-f prompt.
>
> (I could call add-to-list in M-x ielm or M-: instead of editing the
> SETQ in .emacs, but then I'd need to remove-hook (there's no
> remote-from-list function) each bad attempt until I got it right, so
> it's still pretty tedious.)
I admit, that in your use case it is a real regression. There have been
several reasons to change the multi-hop syntax. I remember, that for
people with *static* multi-hop paths the new syntax is shorter and more
convenient to type therefore; I also remember some problems in
implementation of all these Tramp 2.1 optimizations for the Tramp 2.0
multi-hop paths.
OTOH, setting up a working tramp-default-proxies-alist is kind of
complex, indeed.
On the Tramp todo list, there is the item
;; * WIBNI there was an interactive command prompting for Tramp
;; method, hostname, username and filename and translates the user
;; input into the correct filename syntax (depending on the Emacs
;; flavor) (Reiner Steib)
This could be expanded to multi-hops, where it seems to be even more
useful. I'll try to find the time to work on it (Threat: I will exploit
*you* as tester for this functionality!)
Thanks for the report, and best regards, Michael.
- Tramp 2.0 -> 2.1 migration woes, Trent W. Buck, 2008/01/26
- Re: Tramp 2.0 -> 2.1 migration woes,
Michael Albinus <=
- Re: Tramp 2.0 -> 2.1 migration woes, Trent W. Buck, 2008/01/27
- Re: Tramp 2.0 -> 2.1 migration woes, Michael Albinus, 2008/01/28
- Re: Tramp 2.0 -> 2.1 migration woes, Trent W. Buck, 2008/01/28
- Re: Tramp 2.0 -> 2.1 migration woes, Michael Albinus, 2008/01/28
- Re: Tramp 2.0 -> 2.1 migration woes, Trent W. Buck, 2008/01/28
- Re: Tramp 2.0 -> 2.1 migration woes, Michael Albinus, 2008/01/31
- Re: Tramp 2.0 -> 2.1 migration woes, Stefan Monnier, 2008/01/31
- Re: Tramp 2.0 -> 2.1 migration woes, Michael Albinus, 2008/01/31
Re: Tramp 2.0 -> 2.1 migration woes, Michael Albinus, 2008/01/27