Re: tramp (2.6.1 HEAD/3ff676c2f98cb6c47fecb37f31a589a910dd3876); docker-container ssh multi-hop support
Gene Goykhman writes: Hi Gene & Kristofer, > I've made some progress and have published a gist with my current > approach to multi-hop Docker container completion in TRAMP. I'd > appreciate comments and suggestions, and whether this is a reasonable > direction to take or if I'm missing something important. > > https://gist.github.com/genegoykhman/09868acd369b3fae866be6446997de9f > > I've taken an approach similar to the one Kristofer describes ... > >> A very simple change I tried when previously trying to get multihop >> completion working >> with another backend was that if I changed the variable >> `tramp-compat-temporary-file-directory' >> for the function `temporary-file-directory' in the completion >> functions (like `tramp-container--completion-function'), then at least > > I'm advising :before tramp-completion-handle-file-name-all-completions > and parsing out the required remote directory from which we need to > call the docker program to get remote completions. Then, I'm adding a > custom completion function my-tramp-container-completion-function that > takes that directory (if it has been parsed) and sets it as the > default-directory. > >> Another issue that I found, which maybe is unavoidable, is that some >> of the completion functions in `tramp-container' requires that the >> container >> program is installed on the local host, but sometimes I only have > > I /think/ the approach I've taken only requires that the container program be > available on the remote host on which we are trying to get the completion > list. > > Feedback appreciated! Thanks for all your work! The idea is nice. I'll check next days, and send you feedback. Unfortunately, I have first to fix the Tramp ELPA package. People have reported, that it doesn't install any longer with the just-released Emacs 29.1 ... Best regards, Michael.
Re: Errors when installing Tramp from ELPA on Emacs 29.1
Jim Porter writes: Hi Jim, > When installing Tramp from GNU ELPA on Emacs 29.1, I get a bunch of > errors (see the attached "tramp-compile.log"). In addition, when I > start Emacs up the next time, I get this error in the *Messages* > buffer: > > Error loading autoloads: (void-function tramp--with-startup) > > If I eval "(require 'tramp)", I get this error: > > Debugger entered--Lisp error: (void-function > tramp-register-crypt-file-name-handler) > tramp-register-crypt-file-name-handler() > tramp-register-file-name-handlers() > #f(compiled-function () #)() > run-hooks(tramp--startup-hook) > > byte-code("\301\302\303\304#\210\305\306!\210\307\300!\210\310\211\20\207" > [tramp--startup-hook put tramp-unload-tramp tramp-autoload t provide > tramp run-hooks nil] 5) > require(tramp) > eval-expression((require 'tramp) nil nil 127) > funcall-interactively(eval-expression (require 'tramp) nil nil 127) > command-execute(eval-expression) > > I'm guessing this is due to Emacs 29.1 having a new method for > generating autoloads (loaddefs-gen.el). It looks like the Makefile for > Tramp from ELPA still tries to use the old way of generating > autoloads, but I guess package.el tries to use the new one, causing > some kind of conflict. Looking at the generated tramp-autoloads.el, it > seems to be a lot different from how it was generated in Emacs 28.2, > and in particular, has some calls to 'tramp--with-startup' (I've > attached this as well). I don't quite understand what's going on > beyond that, though... Yep, it seems to be an autoload problem. An I also don't understand what's up :-( I'll try next days to fix it. Ach ...
Re: tramp (2.6.1 HEAD/3ff676c2f98cb6c47fecb37f31a589a910dd3876); docker-container ssh multi-hop support
I've made some progress and have published a gist with my current approach to multi-hop Docker container completion in TRAMP. I'd appreciate comments and suggestions, and whether this is a reasonable direction to take or if I'm missing something important. https://gist.github.com/genegoykhman/09868acd369b3fae866be6446997de9f I've taken an approach similar to the one Kristofer describes ... > A very simple change I tried when previously trying to get multihop > completion working > with another backend was that if I changed the variable > `tramp-compat-temporary-file-directory' > for the function `temporary-file-directory' in the completion > functions (like `tramp-container--completion-function'), then at least I'm advising :before tramp-completion-handle-file-name-all-completions and parsing out the required remote directory from which we need to call the docker program to get remote completions. Then, I'm adding a custom completion function my-tramp-container-completion-function that takes that directory (if it has been parsed) and sets it as the default-directory. > Another issue that I found, which maybe is unavoidable, is that some > of the completion functions in `tramp-container' requires that the > container > program is installed on the local host, but sometimes I only have I /think/ the approach I've taken only requires that the container program be available on the remote host on which we are trying to get the completion list. Feedback appreciated!
Re: tramp (2.6.1 HEAD/3ff676c2f98cb6c47fecb37f31a589a910dd3876); docker-container ssh multi-hop support
From: Michael Albinus Subject: Re: tramp (2.6.1 HEAD/3ff676c2f98cb6c47fecb37f31a589a910dd3876); docker-container ssh multi-hop support To: Gene Goykhman Cc: tramp-devel@gnu.org, Protesilaos Stavrou Date: Mon, 24 Jul 2023 09:45:53 +0200 (1 week, 9 hours, 10 minutes ago) Flags: seen, list Maildir: /mailbox/Inbox/TRAMP Dev Gene Goykhman writes: Hello and thank you for making TRAMP amazing! Hi Gene, Hello, I saw this thread and wanted to jump in with some thoughts. I don't know whether this is a bug or currently unsupported functionality, but I am trying to get docker-container support through an ssh connection and it is not working. docker-container works fine for docker running on the local machine. However: M-x find-file RET /ssh:root@remotehost|docker: Also suggests the SAME list of docker containers running on the local host, rather than the (expected) list of containers on remotehost. Yes, this is a general weakness of Tramp, for all methods. It doesn't complete user and host names for multi-hop names but the first hop. Perhaps I shall add something which doesn't offer completion in this case. A very simple change I tried when previously trying to get multihop completion working with another backend was that if I changed the variable `tramp-compat-temporary-file-directory' for the function `temporary-file-directory' in the completion functions (like `tramp-container--completion-function'), then at least we get completion when we are on the remote server. It doesn't give us completion for a multi-hop when we are starting in the local computer but if we first jump to the remote host and then try a multi-hop, we get completion for the container names. Now their may reasons why we shouldn't call `temporary-file-directory' that I don't know about. But for a more general solution; would it be possible to parse the whole tramp path while doing the completion and setting the `default-directory' depending on where in the multi-hop path we are at the moment? So when we are past "/ssh:user@host|" we start setting the default-directory to a tmp dir on "user@host". Another issue that I found, which maybe is unavoidable, is that some of the completion functions in `tramp-container' requires that the container program is installed on the local host, but sometimes I only have those programs installed on the remote host. Which stop the completion from working. I tried ignoring the (incorrect) completion candidates and manually typing the name of the running docker container on the remote host as follows: M-x find-file RET /ssh:root@remotehost|docker:remotecontainername But that opened a new, empty buffer in Fundamental mode and emitted the error: "File not found and directory write-protected" This misses the trailing colon, you need M-x find-file RET /ssh:root@remotehost|docker:remotecontainername: Is using TRAMP to connect to docker containers running on a remote host via ssh (i.e. multihop) supported? If so, could you point me to some information or instructions? Yes, it is supported. I test it regularly with the regression tests. If it still doesn't work for you, pls set tramp-verbose to 6 and rerun the test. Show the resulting Tramp debug buffer. Thank you! Best regards, Michael. -- Best Regards Kristofer