From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Sean Devlin Newsgroups: gmane.emacs.bugs Subject: 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-ID: <76B2D222-939F-4096-AFA5-2B0AA92A9A03@toadstyle.org> References: <327CF2FD-F00D-402B-B273-12066DDEB0E5@toadstyle.org> <875xytjsfw.fsf@gmx.de> Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3774.500.141\)) Content-Type: multipart/alternative; boundary="Apple-Mail=_441A4680-A04B-44C8-97EC-BBC4473BBEC4" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="12289"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 69085@debbugs.gnu.org To: Michael Albinus Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Mon Feb 12 23:26:21 2024 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1rZekm-00031c-Ss for geb-bug-gnu-emacs@m.gmane-mx.org; Mon, 12 Feb 2024 23:26:21 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rZekL-0003bx-MS; Mon, 12 Feb 2024 17:25:54 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rZekD-0003a3-Qj for bug-gnu-emacs@gnu.org; Mon, 12 Feb 2024 17:25:47 -0500 Original-Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rZekD-00022E-HI for bug-gnu-emacs@gnu.org; Mon, 12 Feb 2024 17:25:45 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1rZekU-0006TG-5u for bug-gnu-emacs@gnu.org; Mon, 12 Feb 2024 17:26:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Sean Devlin Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 12 Feb 2024 22:26:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 69085 X-GNU-PR-Package: emacs Original-Received: via spool by 69085-submit@debbugs.gnu.org id=B69085.170777672424742 (code B ref 69085); Mon, 12 Feb 2024 22:26:02 +0000 Original-Received: (at 69085) by debbugs.gnu.org; 12 Feb 2024 22:25:24 +0000 Original-Received: from localhost ([127.0.0.1]:34813 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rZejr-0006Qs-49 for submit@debbugs.gnu.org; Mon, 12 Feb 2024 17:25:24 -0500 Original-Received: from mail-qk1-x731.google.com ([2607:f8b0:4864:20::731]:55737) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rZecy-0005WI-NJ for 69085@debbugs.gnu.org; Mon, 12 Feb 2024 17:18:17 -0500 Original-Received: by mail-qk1-x731.google.com with SMTP id af79cd13be357-78684496b10so38828085a.3 for <69085@debbugs.gnu.org>; Mon, 12 Feb 2024 14:17:59 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=toadstyle-org.20230601.gappssmtp.com; s=20230601; t=1707776274; x=1708381074; darn=debbugs.gnu.org; h=references:to:cc:in-reply-to:date:subject:mime-version:message-id :from:from:to:cc:subject:date:message-id:reply-to; bh=R3Tlz/TTEDCsjYFEVVaVgtuWtN5vm6KnKtVaqhLbIH8=; b=O4mfz8ciB0Cxgh8ivvyEwNmKhRspTGvL+SU5pG/o1Q5UWXxSrWmUT/X56e+ooDpQGL TPaVWBEaBxc7jNUVMVYZ2KBUdl1hRQyvQeFiB+Qbk5V6tAvsJvifpe97Zo1XF4VU9yxs yhAy6jSsD0i04PmAE/FJJmXV5n0Jt9le+JrDXLmMKcZnLAeNbOOJhtLfYn/fM5Qxib27 n/v+0efizzWn0g2y+pkDd3oDjARS+knqn2TxZqLoV7eftGgTLy8P19IU1vJ+Ps7FPpbw KVrvHsUw7irAnYU4RI75Wkx5IdqKIQACbu6FpH5urvkFfN+OcShUVoAIQtRoAvIhaJ7B WuQw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1707776274; x=1708381074; h=references:to:cc:in-reply-to:date:subject:mime-version:message-id :from:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=R3Tlz/TTEDCsjYFEVVaVgtuWtN5vm6KnKtVaqhLbIH8=; b=fBbiqB3MpSmP6q7gLEdLxMoKsxWUb3UJynZTgDZVjY2rLrZjfGCuhzYfRyB4NnMHTV CfY06awUZA/KlTnj4SImiWJYki+DGS2q2l062zOHnPgXMTlzjnux/73yFDeq9+ascIEb q3j3kx0vJZvHijnG+UIDXz3UasbTMKQzSy7MEi6VmkTQd9yvaXFzUH2KmzTAowct4hcN PW9w+r2GNjrCbj5rXW3449bX1R1ysM1PrDC3OPc4C3dCGWzT9d7dQUgsLiZSx9rLAzCY eBOJIyca+SwCFqB/mG8lZ0O7UzxkE/KICq42AW8iPw99R6BquxKQb3SCNvLAC3bHwk47 ouCw== X-Gm-Message-State: AOJu0YyPd+9kGGZ8q1nStGrTgP6pZdUS7qwu4NvvFB2hM5lcac38SFKo sAAHc20l/nlXLr8sxGZlBRQyBzjsaSerNtgVKWpzEueuh2QRbYm2XKSdsJUHgbTDf+8wsWov3nB 8 X-Google-Smtp-Source: AGHT+IEMQNuJGDNn13eXoJ3bD7YTUeoF41n7DoVacn+58Coel+Uu33HABbVSzmh6Eem16QnFZk+yQw== X-Received: by 2002:a5b:b49:0:b0:dc7:5f01:7a3 with SMTP id b9-20020a5b0b49000000b00dc75f0107a3mr6421091ybr.21.1707774706309; Mon, 12 Feb 2024 13:51:46 -0800 (PST) Original-Received: from smtpclient.apple ([70.107.172.48]) by smtp.gmail.com with ESMTPSA id w17-20020ae9e511000000b007856bff53d3sm2385546qkf.54.2024.02.12.13.51.45 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Mon, 12 Feb 2024 13:51:45 -0800 (PST) In-Reply-To: <875xytjsfw.fsf@gmx.de> X-Mailer: Apple Mail (2.3774.500.141) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:279933 Archived-At: --Apple-Mail=_441A4680-A04B-44C8-97EC-BBC4473BBEC4 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=utf-8 Hi Michael, > On Feb 12, 2024, at 4:14=E2=80=AFPM, Michael Albinus = wrote: >=20 > Sean Devlin > writes: >=20 >> Hi folks, >=20 > Hi Sean, >=20 >> This is a feature request. >>=20 >> 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. >>=20 >> 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@HOST:FILE. >=20 > No. USER@HOST:FILE is only taken if the remote file name contains a > user. Otherwise, it takes > HOST:FILE. You=E2=80=99re correct, my mistake. >=20 >> I was working on a custom Tramp method, and I ran into problems = setting >> up OOB copying due to this limitation. >>=20 >> It would be great if there were a key you could set in tramp-methods = to >> override this logic. For example, maybe something like: >>=20 >> (tramp-copy-format-file-name my-tramp-make-copy-program-file-name) >>=20 >> 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). >>=20 >> 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. >=20 > 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=E2=80=99t exist in my own custom method spec. The copy parameters for my method look like so: (defconst tramp-mymethod '("mymethod" ... (tramp-copy-program =E2=80=9Cmy-copy-program") (tramp-copy-args ((=E2=80=9C-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=E2=80=99s an = identifier for a sort of abstract container. For SRC-FILE and DEST-FILE, =E2=80=9Cremote=E2=80=9D file paths just = have a fixed prefix string, i.e. it=E2=80=99s not dependent on the =E2=80=9Chost=E2=80=9D name or = the user. So all I really need is a way to format =E2=80=9Cremote=E2=80=9D 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! >=20 >> Thanks! >=20 > Best regards, Michael. --Apple-Mail=_441A4680-A04B-44C8-97EC-BBC4473BBEC4 Content-Transfer-Encoding: quoted-printable Content-Type: text/html; charset=utf-8 Hi Michael,

On Feb 12, 2024, at 4:14=E2=80=AFPM, Michael Albinus = <michael.albinus@gmx.de> wrote:

Sean = Devlin <spd@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@HOST:FILE.

No. = USER@HOST:FILE is only taken if the remote file name contains = a
user. Otherwise, it = takes
HOST:FILE.

You=E2=80=99re 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=E2=80=99t exist in my own custom method = spec.

The copy parameters for my method look = like so:

(defconst = tramp-mymethod
  '("mymethod"
    = ...

    (tramp-copy-program = =E2=80=9Cmy-copy-program")
    = (tramp-copy-args
     ((=E2=80=9C-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=E2=80=99s an identifier for a = sort of
abstract container.

For = SRC-FILE and DEST-FILE, =E2=80=9Cremote=E2=80=9D file paths just have a = fixed prefix string,
i.e. it=E2=80=99s not dependent on the = =E2=80=9Chost=E2=80=9D name or the user.

So all = I really need is a way to format =E2=80=9Cremote=E2=80=9D 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.

= --Apple-Mail=_441A4680-A04B-44C8-97EC-BBC4473BBEC4--