GNU bug report logs - #69085
29.2; Tramp: Extend tramp-make-copy-program-file-name via tramp-methods

Previous Next

Package: emacs;

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.

Full log


Message #17 received at 69085 <at> debbugs.gnu.org (full text, mbox):

From: Sean Devlin <spd <at> toadstyle.org>
To: Michael Albinus <michael.albinus <at> gmx.de>
Cc: 69085 <at> debbugs.gnu.org
Subject: Re: bug#69085: 29.2; Tramp: Extend tramp-make-copy-program-file-name
 via tramp-methods
Date: Mon, 12 Feb 2024 16:51:35 -0500
[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)]

This bug report was last modified 1 year and 184 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.