bug-gnu-emacs
[Top][All Lists]
Advanced

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

bug#69085: 29.2; Tramp: Extend tramp-make-copy-program-file-name via tra


From: Michael Albinus
Subject: bug#69085: 29.2; Tramp: Extend tramp-make-copy-program-file-name via tramp-methods
Date: Fri, 16 Feb 2024 15:54:53 +0100
User-agent: Gnus/5.13 (Gnus v5.13)

Sean Devlin <spd@toadstyle.org> writes:

> Hi Michael,

Hi Sean,

> Suppose we want to add OOB copying to the Docker method. Docker
> has a copy command with usage like this:
>
> Usage:  docker cp [OPTIONS] CONTAINER:SRC_PATH DEST_PATH|-
> docker cp [OPTIONS] SRC_PATH|- CONTAINER:DEST_PATH
>
> We could try to add support to the Docker method for OOB copying by
> starting Emacs -Q and evaluating these forms:
>
> (add-to-list 'tramp-methods
>              `(,tramp-docker-method
>                (tramp-login-program ,tramp-docker-program)
>                (tramp-login-args (("exec")
>                                   ("-it")
>                                   ("-u" "%u")
>                                   ("%h")
>          ("%l")))
>       (tramp-direct-async (,tramp-default-remote-shell "-c"))
>                (tramp-remote-shell ,tramp-default-remote-shell)
>                (tramp-remote-shell-login ("-l"))
>                (tramp-remote-shell-args ("-i" "-c"))
>
>       (tramp-copy-program ,tramp-docker-program)
>       (tramp-copy-args (("cp")))
>       ))

Well, if "docker cp" doesn't need the user, why do we use the user at
all? Couldn't we get rid of it in this case? That is, don't use the
("-u" "%u") in tramp-login-args.

> I think what is needed is some way for the tramp-docker method to
> specify the format for remote paths in the OOB copy command, since
> tramp-make-copy-program-file-name will include the user if it is
> specified in the connection.
>
> One method might be to add a key to tramp-methods that lets you
> specify the format similar to tramp-login-args and tramp-copy-args:

I've tried another approach. In Tramp 2.7, I've added a new method
"dockercp" which doesn't use the user at all, and which adds
tramp-copy-program and tramp-copy-args.

Do you have a chance to install Tramp from its repository like

--8<---------------cut here---------------start------------->8---
# git clone https://git.savannah.gnu.org/git/tramp.git
--8<---------------cut here---------------end--------------->8---

Then pls modify tramp-container.el with the appended patch. After that,
you should be able to access your docker container like
/dockercp:CONTAINER:/path/to/file. And if you copy large files, "docker
cp" will be applied.

Best regards, Michael.

Attachment: txtTVzwclmyzc.txt
Description: Text Data


reply via email to

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