Hello all,
The observed issue concerns the listing of containers suggested after
inserting either '/docker:' or '/podman:' as tramp connection methods.
In particular the 'docker' method flawlessly lists the available
containers that can be accessed but 'podman' does not.
Searching for the cause I identified the issue in the
'tramp-container--completion-function' function. Upon invocation
of the '[podman|docker] ps --format '{{.ID}}\t{{.Names}}' command, the
resulting list of strings are different. See the examples below
(executed in a shell after starting a container in docker and one in
podman):
$ docker ps --format '{{.ID}}\t{{.Names}}' | od -c | head -1
0000000 3 2 e 5 d a 8 f 9 5 d 8 \t v a n
$ podman ps --format '{{.ID}}\t{{.Names}}' | od -c | head -1
0000000 c c c f e 9 7 6 1 c 5 3 r e
As can be observed 'podman' replaces the '\t' charter with a sequence of
2 spaces, causing the parsing of the tool output to fail in
'tramp-container--completion-function'.
I have successfully tested the following patch:
diff --git a/tramp-container.el b/tramp-container.el
index 8328b5c..e96e2ee 100644
--- a/tramp-container.el
+++ b/tramp-container.el
@@ -281,14 +281,14 @@ see its function help for a description of the format."
(tramp-skeleton-completion-function method
(when-let* ((raw-list
(shell-command-to-string
- (concat program " ps --format '{{.ID}}\t{{.Names}}'")))
+ (concat program " ps --format '{{.ID}}<>{{.Names}}'")))
(lines (split-string raw-list "\n" 'omit))
(names
(tramp-compat-seq-keep
(lambda (line)
(when (string-match
(rx bol (group (1+ nonl))
- "\t" (? (group (1+ nonl))) eol)
+ "<>" (? (group (1+ nonl))) eol)
line)
(or (match-string 2 line) (match-string 1 line))))
lines)))
Best regards,
Samuele Favazza