GNU bug report logs -
#69085
29.2; Tramp: Extend tramp-make-copy-program-file-name via tramp-methods
Previous Next
Reported by: Sean Devlin <spd <at> toadstyle.org>
Date: Mon, 12 Feb 2024 20:11:01 UTC
Severity: normal
Found in version 29.2
Fixed in version 30.1
Done: Michael Albinus <michael.albinus <at> gmx.de>
Bug is archived. No further changes may be made.
To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 69085 in the body.
You can then email your comments to 69085 AT debbugs.gnu.org in the normal way.
Toggle the display of automated, internal messages from the tracker.
Report forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#69085
; Package
emacs
.
(Mon, 12 Feb 2024 20:11:01 GMT)
Full text and
rfc822 format available.
Acknowledgement sent
to
Sean Devlin <spd <at> toadstyle.org>
:
New bug report received and forwarded. Copy sent to
bug-gnu-emacs <at> gnu.org
.
(Mon, 12 Feb 2024 20:11:01 GMT)
Full text and
rfc822 format available.
Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):
Hi folks,
This is a feature request.
Tramp lets you define a method for out-of-band file copying with the
tramp-methods keys tramp-copy-program, tramp-copy-args, and so on.
Currently, there is no way to customize the format of remote file
paths. The function tramp-make-copy-program-file-name is responsible for
this job, and it is hard-coded to format files as USER <at> HOST:FILE.
I was working on a custom Tramp method, and I ran into problems setting
up OOB copying due to this limitation.
It would be great if there were a key you could set in tramp-methods to
override this logic. For example, maybe something like:
(tramp-copy-format-file-name my-tramp-make-copy-program-file-name)
Where my-tramp-make-copy-program-file-name is a function taking a vector
as input and returning a string of the formatted file name (similar to
tramp-make-copy-program-file-name).
Alternately, maybe a format string (or something similar to
tramp-login-args/tramp-copy-args) would be sufficient. In my case, I
just need to add a constant prefix to the remote file name, so a format
string would be fine.
Thanks!
In GNU Emacs 29.2 (build 1, aarch64-apple-darwin21.6.0, NS
appkit-2113.60 Version 12.6.6 (Build 21G646)) of 2024-01-18 built on
armbob.lan
Windowing system distributor 'Apple'
System Description: macOS 14
Configured using:
'configure --with-ns '--enable-locallisppath=/Library/Application
Support/Emacs/${version}/site-lisp:/Library/Application
Support/Emacs/site-lisp' --with-modules 'CFLAGS=-DFD_SETSIZE=10000
-DDARWIN_UNLIMITED_SELECT' --with-x-toolkit=no'
Configured features:
ACL GLIB GMP GNUTLS JPEG JSON LIBXML2 MODULES NOTIFY KQUEUE NS PDUMPER
PNG RSVG SQLITE3 THREADS TIFF TOOLKIT_SCROLL_BARS TREE_SITTER ZLIB
Important settings:
value of $LANG: en_US.UTF-8
locale-coding-system: utf-8-unix
Major mode: Lisp Interaction
Minor modes in effect:
tooltip-mode: t
global-eldoc-mode: t
eldoc-mode: t
show-paren-mode: t
electric-indent-mode: t
mouse-wheel-mode: t
tool-bar-mode: t
menu-bar-mode: t
file-name-shadow-mode: t
global-font-lock-mode: t
font-lock-mode: t
blink-cursor-mode: t
line-number-mode: t
indent-tabs-mode: t
transient-mark-mode: t
auto-composition-mode: t
auto-encryption-mode: t
auto-compression-mode: t
Load-path shadows:
None found.
Features:
(shadow sort mail-extr emacsbug message mailcap yank-media puny dired
dired-loaddefs rfc822 mml mml-sec password-cache epa derived epg rfc6068
epg-config gnus-util text-property-search time-date subr-x mm-decode
mm-bodies mm-encode mail-parse rfc2231 mailabbrev gmm-utils mailheader
cl-loaddefs cl-lib sendmail rfc2047 rfc2045 ietf-drums mm-util
mail-prsvr mail-utils rmc iso-transl tooltip cconv eldoc paren electric
uniquify ediff-hook vc-hooks lisp-float-type elisp-mode mwheel
term/ns-win ns-win ucs-normalize mule-util term/common-win tool-bar dnd
fontset image regexp-opt fringe tabulated-list replace newcomment
text-mode lisp-mode prog-mode register page tab-bar menu-bar rfn-eshadow
isearch easymenu timer select scroll-bar mouse jit-lock font-lock syntax
font-core term/tty-colors frame minibuffer nadvice seq simple cl-generic
indonesian philippine cham georgian utf-8-lang misc-lang vietnamese
tibetan thai tai-viet lao korean japanese eucjp-ms cp51932 hebrew greek
romanian slovak czech european ethiopic indian cyrillic chinese
composite emoji-zwj charscript charprop case-table epa-hook
jka-cmpr-hook help abbrev obarray oclosure cl-preloaded button loaddefs
theme-loaddefs faces cus-face macroexp files window text-properties
overlay sha1 md5 base64 format env code-pages mule custom widget keymap
hashtable-print-readable backquote threads kqueue cocoa ns multi-tty
make-network-process emacs)
Memory information:
((conses 16 37536 8456)
(symbols 48 5045 0)
(strings 32 13121 2410)
(string-bytes 1 398579)
(vectors 16 10368)
(vector-slots 8 162386 14885)
(floats 8 21 23)
(intervals 56 217 0)
(buffers 984 10))
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#69085
; Package
emacs
.
(Mon, 12 Feb 2024 20:21:02 GMT)
Full text and
rfc822 format available.
Message #8 received at 69085 <at> debbugs.gnu.org (full text, mbox):
I was able to work around the issue by advising tramp-make-copy-program-file-name:
(defun tramp-mymethod-make-copy-program-file-name (vec)
(when (tramp-mymethod-file-name-p vec)
(let ((localname
(directory-file-name (tramp-file-name-unquote-localname vec))))
(format "myprefix:%s" localname))))
(advice-add 'tramp-make-copy-program-file-name
:before-until #'tramp-mymethod-make-copy-program-file-name)
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#69085
; Package
emacs
.
(Mon, 12 Feb 2024 21:16:02 GMT)
Full text and
rfc822 format available.
Message #11 received at 69085 <at> debbugs.gnu.org (full text, mbox):
Sean Devlin <spd <at> toadstyle.org> writes:
> Hi folks,
Hi Sean,
> This is a feature request.
>
> Tramp lets you define a method for out-of-band file copying with the
> tramp-methods keys tramp-copy-program, tramp-copy-args, and so on.
>
> Currently, there is no way to customize the format of remote file
> paths. The function tramp-make-copy-program-file-name is responsible for
> this job, and it is hard-coded to format files as USER <at> HOST:FILE.
No. USER <at> HOST:FILE is only taken if the remote file name contains a
user. Otherwise, it takes
HOST:FILE.
> I was working on a custom Tramp method, and I ran into problems setting
> up OOB copying due to this limitation.
>
> It would be great if there were a key you could set in tramp-methods to
> override this logic. For example, maybe something like:
>
> (tramp-copy-format-file-name my-tramp-make-copy-program-file-name)
>
> Where my-tramp-make-copy-program-file-name is a function taking a vector
> as input and returning a string of the formatted file name (similar to
> tramp-make-copy-program-file-name).
>
> Alternately, maybe a format string (or something similar to
> tramp-login-args/tramp-copy-args) would be sufficient. In my case, I
> just need to add a constant prefix to the remote file name, so a format
> string would be fine.
Could you pls show your custom method spec, and what
tramp-copy-format-file-name returns for it?
> Thanks!
Best regards, Michael.
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#69085
; Package
emacs
.
(Mon, 12 Feb 2024 21:17:02 GMT)
Full text and
rfc822 format available.
Message #14 received at 69085 <at> debbugs.gnu.org (full text, mbox):
Sean Devlin <spd <at> toadstyle.org> writes:
Hi Sean,
> I was able to work around the issue by advising tramp-make-copy-program-file-name:
>
> (defun tramp-mymethod-make-copy-program-file-name (vec)
> (when (tramp-mymethod-file-name-p vec)
> (let ((localname
> (directory-file-name (tramp-file-name-unquote-localname vec))))
> (format "myprefix:%s" localname))))
>
> (advice-add 'tramp-make-copy-program-file-name
> :before-until #'tramp-mymethod-make-copy-program-file-name)
It is nice that it works for you. But as I said the other message, I'd
like to understand the problem. So pls show your custome method spec.
Best regards, Michael.
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#69085
; Package
emacs
.
(Mon, 12 Feb 2024 22:26:02 GMT)
Full text and
rfc822 format available.
Message #17 received at 69085 <at> debbugs.gnu.org (full text, mbox):
[Message part 1 (text/plain, inline)]
Hi Michael,
> On Feb 12, 2024, at 4:14 PM, Michael Albinus <michael.albinus <at> gmx.de> wrote:
>
> Sean Devlin <spd <at> toadstyle.org <mailto:spd <at> toadstyle.org>> writes:
>
>> Hi folks,
>
> Hi Sean,
>
>> This is a feature request.
>>
>> Tramp lets you define a method for out-of-band file copying with the
>> tramp-methods keys tramp-copy-program, tramp-copy-args, and so on.
>>
>> Currently, there is no way to customize the format of remote file
>> paths. The function tramp-make-copy-program-file-name is responsible for
>> this job, and it is hard-coded to format files as USER <at> HOST:FILE.
>
> No. USER <at> HOST:FILE is only taken if the remote file name contains a
> user. Otherwise, it takes
> HOST:FILE.
You’re correct, my mistake.
>
>> I was working on a custom Tramp method, and I ran into problems setting
>> up OOB copying due to this limitation.
>>
>> It would be great if there were a key you could set in tramp-methods to
>> override this logic. For example, maybe something like:
>>
>> (tramp-copy-format-file-name my-tramp-make-copy-program-file-name)
>>
>> Where my-tramp-make-copy-program-file-name is a function taking a vector
>> as input and returning a string of the formatted file name (similar to
>> tramp-make-copy-program-file-name).
>>
>> Alternately, maybe a format string (or something similar to
>> tramp-login-args/tramp-copy-args) would be sufficient. In my case, I
>> just need to add a constant prefix to the remote file name, so a format
>> string would be fine.
>
> Could you pls show your custom method spec, and what
> tramp-copy-format-file-name returns for it?
Tramp-copy-format-file-name was just a proposal for how this feature might
work; it doesn’t exist in my own custom method spec.
The copy parameters for my method look like so:
(defconst tramp-mymethod
'("mymethod"
...
(tramp-copy-program “my-copy-program")
(tramp-copy-args
((“-id" "%h")))))
Invocations of the copy program look like:
my-copy-program -id HOST SRC-FILE DEST-FILE
The HOST is not a DNS name in this case; instead, it’s an identifier for a sort of
abstract container.
For SRC-FILE and DEST-FILE, “remote” file paths just have a fixed prefix string,
i.e. it’s not dependent on the “host” name or the user.
So all I really need is a way to format “remote” file paths like:
(format "myprefix:%s" localname)
The current hack I use to implement this is to advise tramp-make-copy-file-name
as described in my other message.
Thanks for your help!
>
>> Thanks!
>
> Best regards, Michael.
[Message part 2 (text/html, inline)]
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#69085
; Package
emacs
.
(Tue, 13 Feb 2024 12:19:03 GMT)
Full text and
rfc822 format available.
Message #20 received at 69085 <at> debbugs.gnu.org (full text, mbox):
Sean Devlin <spd <at> toadstyle.org> writes:
> Hi Michael,
Hi Sean,
> The copy parameters for my method look like so:
>
> (defconst tramp-mymethod
> '("mymethod"
> ...
>
> (tramp-copy-program “my-copy-program")
> (tramp-copy-args
> ((“-id" "%h")))))
>
> Invocations of the copy program look like:
>
> my-copy-program -id HOST SRC-FILE DEST-FILE
>
> The HOST is not a DNS name in this case; instead, it’s an identifier
> for a sort of
> abstract container.
>
> For SRC-FILE and DEST-FILE, “remote” file paths just have a fixed
> prefix string,
> i.e. it’s not dependent on the “host” name or the user.
>
> So all I really need is a way to format “remote” file paths like:
>
> (format "myprefix:%s" localname)
Hmm. Some questions:
- What if SRC-FILE or DEST-FILE is local, and the other one is remote?
Would it still be something like "my-copy-program -id HOST SRC-FILE DEST-FILE"?
- In case both SRC-FILE and DEST-FILE are remote, are they always files
on the same remote host identified as HOST? Or do you need also a copy
between two different hosts, using "mymethod"?
- And if HOST is a kind of container, would it be possible for you to
use the "docker" or "podman" method of Tramp directly?
> Thanks for your help!
Best regards, Michael.
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#69085
; Package
emacs
.
(Tue, 13 Feb 2024 20:20:01 GMT)
Full text and
rfc822 format available.
Message #23 received at 69085 <at> debbugs.gnu.org (full text, mbox):
Hi Michael,
> On Feb 13, 2024, at 7:18 AM, Michael Albinus <michael.albinus <at> gmx.de> wrote:
>
> Sean Devlin <spd <at> toadstyle.org> writes:
>
>> Hi Michael,
>
> Hi Sean,
>
>> The copy parameters for my method look like so:
>>
>> (defconst tramp-mymethod
>> '("mymethod"
>> ...
>>
>> (tramp-copy-program “my-copy-program")
>> (tramp-copy-args
>> ((“-id" "%h")))))
>>
>> Invocations of the copy program look like:
>>
>> my-copy-program -id HOST SRC-FILE DEST-FILE
>>
>> The HOST is not a DNS name in this case; instead, it’s an identifier
>> for a sort of
>> abstract container.
>>
>> For SRC-FILE and DEST-FILE, “remote” file paths just have a fixed
>> prefix string,
>> i.e. it’s not dependent on the “host” name or the user.
>>
>> So all I really need is a way to format “remote” file paths like:
>>
>> (format "myprefix:%s" localname)
>
> Hmm. Some questions:
>
> - What if SRC-FILE or DEST-FILE is local, and the other one is remote?
> Would it still be something like "my-copy-program -id HOST SRC-FILE DEST-FILE"?
This is the main supported use case. One of the files must be local, and the other
must be “remote” (i.e. it’s inside the container HOST).
The path for the local file is formatted just like a typical local file path.
For the “remote” file, it’s formatted like a local file path but with a constant prefix in
front. The prefix is just a fixed string, and it’s just there to tell the copy program that
the path is inside the container.
>
> - In case both SRC-FILE and DEST-FILE are remote, are they always files
> on the same remote host identified as HOST? Or do you need also a copy
> between two different hosts, using "mymethod"?
Direct copying between two hosts/containers isn’t supported with this program. To
handle this case, you need to copy from one remote to the local system, and then
copy that file into the second remote.
Based on my experiments, it seems that Tramp handles this scenario correctly and
uses the local system as an intermediate stop.
>
> - And if HOST is a kind of container, would it be possible for you to
> use the "docker" or "podman" method of Tramp directly?
I’ve looked a little bit at the code supporting these methods in tramp-container.el.
They seem similar, but not exactly the same. Also, they do not support OOB
copying, at least in the version of Tramp I’m reading (i.e. the version packaged with
Emacs 29.2).
Thanks for your help!
>
>> Thanks for your help!
>
> Best regards, Michael.
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#69085
; Package
emacs
.
(Wed, 14 Feb 2024 07:01:02 GMT)
Full text and
rfc822 format available.
Message #26 received at 69085 <at> debbugs.gnu.org (full text, mbox):
Sean Devlin <spd <at> toadstyle.org> writes:
> Hi Michael,
Hi Sean,
>> - And if HOST is a kind of container, would it be possible for you to
>> use the "docker" or "podman" method of Tramp directly?
>
> I’ve looked a little bit at the code supporting these methods in tramp-container.el.
> They seem similar, but not exactly the same. Also, they do not support OOB
> copying, at least in the version of Tramp I’m reading (i.e. the version packaged with
> Emacs 29.2).
Could you pls elaborate verbosely, what is missing in your use case?
Perhaps we could extend tramp-container.el that it is applicable for you
as well.
(I take the time to invest it with you, because your urgent problem seems
to be mitigated by your defadvice.)
> Thanks for your help!
Best regards, Michael.
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#69085
; Package
emacs
.
(Thu, 15 Feb 2024 00:59:02 GMT)
Full text and
rfc822 format available.
Message #29 received at 69085 <at> debbugs.gnu.org (full text, mbox):
[Message part 1 (text/plain, inline)]
Hi Michael,
> On Feb 14, 2024, at 1:59 AM, Michael Albinus <michael.albinus <at> gmx.de> wrote:
>
> Sean Devlin <spd <at> toadstyle.org> writes:
>
>> Hi Michael,
>
> Hi Sean,
>
>>> - And if HOST is a kind of container, would it be possible for you to
>>> use the "docker" or "podman" method of Tramp directly?
>>
>> I’ve looked a little bit at the code supporting these methods in tramp-container.el.
>> They seem similar, but not exactly the same. Also, they do not support OOB
>> copying, at least in the version of Tramp I’m reading (i.e. the version packaged with
>> Emacs 29.2).
>
> Could you pls elaborate verbosely, what is missing in your use case?
> Perhaps we could extend tramp-container.el that it is applicable for you
> as well.
Sure, let’s focus on tramp-container.el. I think this will allow us to be
concrete, which will make things simpler to discuss.
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:
(require 'tramp-container)
(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")))
))
Outside of Emacs, start a Docker container running some image (e.g.
ubuntu:latest). An example command is:
$ docker run -it ubuntu:latest bash -l
Leave this running.
Next, create a large (i.e. greater than tramp-copy-size-limit) temporary
file for copying:
$ head -c 20000 /dev/random > /tmp/bigfile
Back in Emacs, evaluate these forms (with “my_container” replaced with
the name of your container):
(copy-file "/tmp/bigfile" "/docker:my_container:/tmp/bigfile")
(copy-file "/tmp/bigfile" "/docker:root <at> my_container:/tmp/bigfile2”)
The first copy will succeed, but the second will fail. This is because the
connection has an explicit user, so it will try to run a command like:
docker cp /tmp/bigfile root <at> my_container:/tmp/bigfile2
It will fail because it will interpret “root <at> my_container” as the container’s
name, and it will say that there is no container by that name.
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:
(tramp-copy-remote-file-format (("%h" ":" "%f")))
Where “%h” and “%f” are the host and the file’s local name, respectively.
Like tramp-login-args, the format could be a list of lists, and sublists could
be ignored when the required properties are absent. For example, the
format for scp-like copy programs might look like this:
(tramp-copy-remote-file-format
(("%u" "@")
("%h" ":" "%f")))
Where “%u” is the user. So the leading “user@“ could be dropped if the
user is unspecified.
Unlike tramp-login-args and tramp-copy-args, this would need to
concatenate the strings together without spaces.
The function tramp-make-copy-program-file-name could check for this
method parameter and, if present, use it to format the result. For example,
the cond at the end could be changed like so:
(let ((fmt (tramp-get-method-parameter vec 'tramp-copy-remote-file-format)))
(cond
((tramp-get-method-parameter vec 'tramp-remote-copy-program)
localname)
(fmt
;; Format the file name using fmt.
)
((tramp-string-empty-or-nil-p user) (format "%s:%s" host localname))
(t (format "%s@%s:%s" user host localname)))
Instead of a list of lists of strings, another method would be to specify a
function that does the work. The function could take the vector as input and
return the formatted file name. The tramp-make-copy-program-file-name
function could call that function (if specified) at the same place in that cond
form. This would be more flexible than the list of lists of strings, but it also
would be more complicated for the implementer and may be overkill.
>
> (I take the time to invest it with you, because your urgent problem seems
> to be mitigated by your defadvice.)
I appreciate your help—thank you for taking the time!
>
>> Thanks for your help!
>
> Best regards, Michael.
[Message part 2 (text/html, inline)]
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#69085
; Package
emacs
.
(Fri, 16 Feb 2024 14:56:01 GMT)
Full text and
rfc822 format available.
Message #32 received at 69085 <at> debbugs.gnu.org (full text, mbox):
[Message part 1 (text/plain, inline)]
Sean Devlin <spd <at> 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.
[Message part 2 (text/x-patch, attachment)]
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#69085
; Package
emacs
.
(Fri, 16 Feb 2024 17:53:02 GMT)
Full text and
rfc822 format available.
Message #35 received at 69085 <at> debbugs.gnu.org (full text, mbox):
Hi Michael,
>> 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.
The patch does work as described, but it doesn’t integrate well with typical
workflows.
For example, I’m likely to start a session from Eshell or Dired browsing
around the remote. At this point, I may not realize I will need to copy files to
or from the remote. I would start with the normal “docker” method, because
I usually want to have an explicit user for my connection, so that I can run
programs as the user.
Now, suppose I do need to copy a file back to the host. I need to:
1. Check the size of the file. If it’s small, I can copy it normally using the
inline method.
2. If the file is big, I now need to switch to the other method, so I open a new
connection to the same container under the “dockercp” method.
3. I also need to find my way back to the same directory. This may be a
minor nuisance, but for example it won’t show up in the Recentf list, since
Emacs and Tramp and Recentf will not know that
/docker:user <at> container:/path/to/dir and /dockercp:container:/path/to/dir are
related.
4. Finally, I copy the file.
So while this approach does work for Docker containers, it adds some
ergonomic overhead for the user making it inconvenient to use.
Thanks,
Sean
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#69085
; Package
emacs
.
(Sat, 17 Feb 2024 17:59:02 GMT)
Full text and
rfc822 format available.
Message #38 received at 69085 <at> debbugs.gnu.org (full text, mbox):
[Message part 1 (text/plain, inline)]
Sean Devlin <spd <at> toadstyle.org> writes:
> Hi Michael,
Hi Sean,
> The patch does work as described, but it doesn’t integrate well with typical
> workflows.
>
> So while this approach does work for Docker containers, it adds some
> ergonomic overhead for the user making it inconvenient to use.
I see your point. Appended is a new patch, which addresses your
inconvenience. Could you pls apply it on top of Tramp 2.7 instead of the
other patch? The method "dockercp" allows now user names, which are
ignored when calling "docker cp ...".
> Thanks,
>
> Sean
Best regards, Michael.
[Message part 2 (text/x-patch, attachment)]
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#69085
; Package
emacs
.
(Mon, 19 Feb 2024 19:21:01 GMT)
Full text and
rfc822 format available.
Message #41 received at 69085 <at> debbugs.gnu.org (full text, mbox):
Hi Michael,
> I see your point. Appended is a new patch, which addresses your
> inconvenience. Could you pls apply it on top of Tramp 2.7 instead of the
> other patch? The method "dockercp" allows now user names, which are
> ignored when calling "docker cp ...".
This works perfectly! I see no issues with this patch.
Thanks for spending so much time on this, I really appreciate your help!
Sean
Reply sent
to
Michael Albinus <michael.albinus <at> gmx.de>
:
You have taken responsibility.
(Tue, 20 Feb 2024 12:05:02 GMT)
Full text and
rfc822 format available.
Notification sent
to
Sean Devlin <spd <at> toadstyle.org>
:
bug acknowledged by developer.
(Tue, 20 Feb 2024 12:05:02 GMT)
Full text and
rfc822 format available.
Message #46 received at 69085-done <at> debbugs.gnu.org (full text, mbox):
Version: 30.1
Sean Devlin <spd <at> toadstyle.org> writes:
> Hi Michael,
Hi Sean,
>> I see your point. Appended is a new patch, which addresses your
>> inconvenience. Could you pls apply it on top of Tramp 2.7 instead of the
>> other patch? The method "dockercp" allows now user names, which are
>> ignored when calling "docker cp ...".
>
> This works perfectly! I see no issues with this patch.
Thanks for the feedback.
Over the weekend, I ran Tramp regression tests. There were still some
minor annoyances with the new methods, but that's fixed now.
I've pushed an extended version of the patch to the repositories. Will
be available with Tramp 2.7.1 and Emacs 30.1.
Closing the bug.
> Thanks for spending so much time on this, I really appreciate your help!
>
> Sean
Best regards, Michael.
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#69085
; Package
emacs
.
(Tue, 20 Feb 2024 16:18:01 GMT)
Full text and
rfc822 format available.
Message #49 received at 69085-done <at> debbugs.gnu.org (full text, mbox):
Hi Michael,
> Thanks for the feedback.
>
> Over the weekend, I ran Tramp regression tests. There were still some
> minor annoyances with the new methods, but that's fixed now.
>
> I've pushed an extended version of the patch to the repositories. Will
> be available with Tramp 2.7.1 and Emacs 30.1.
>
> Closing the bug.
Sounds good. Thanks again for your help with this.
Sean
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#69085
; Package
emacs
.
(Tue, 20 Feb 2024 16:18:02 GMT)
Full text and
rfc822 format available.
bug archived.
Request was from
Debbugs Internal Request <help-debbugs <at> gnu.org>
to
internal_control <at> debbugs.gnu.org
.
(Wed, 20 Mar 2024 11:24:10 GMT)
Full text and
rfc822 format available.
This bug report was last modified 1 year and 183 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.