Subject: Re: bug#35639: 27.0.50; tramp fails to use ssh on LibreCMC (no base64 encoder available, and not mentioned in tramp manual)

From: Jeronimo Pellegrini <[email-masked]>
Date: Wed, 8 May 2019 20:01:45 -0300

Michael Albinus <[email-masked]> writes:

Hi,

> Jeronimo Pellegrini <[email-masked]> writes:
>
> Hi Jeronimo,
>
>> The rem-enc function should use a base64 encoding program on the
>> router (but LibreCMC and OpenWRT do not have it!).
>
> Tramp is busy to detect base64 or any other method which can be used for
> encoding/decoding. Pls set tramp-verbose to 6, and rerun the test (w/o
> an installed base64 on the remote machine). There will be a Tramp debug
> buffer.

Yes. That's where I first saw the ""Wrong method specification" message.
The buffer contents are here:

http://aleph0.info/jp/tramp-debug/tramp-debug-buffer.txt

>> reading  lisp/net/tramp-sh.el  I get the impression that tramp
>> actually *should* be able to encode/decode using busybox/awk,
>> which *is* available in LibreCMC (or did I get it wrong?).
>
> See variable tramp-remote-coding-commands, it contains all the different
> encoding/decoding commands Tramp tries to apply. awk is among them.

Before using tramp it has no content; after trying to connect,
tramp-remote-coding-commands is:

((b64 "base64" "base64 -d -i")
 (b64 "base64" "base64 -d")
 (b64 "openssl enc -base64" "openssl enc -d -base64")
 (b64 "mimencode -b" "mimencode -u -b")
 (b64 "mmencode -b" "mmencode -u -b")
 (b64 "recode data..base64" "recode base64..data")
 (b64 tramp-perl-encode-with-module tramp-perl-decode-with-module)
 (b64 tramp-perl-encode tramp-perl-decode)
 (b64 tramp-awk-encode tramp-awk-decode "test -c /dev/zero && od -v -t x1 -A n </dev/null && busybox awk '{}' </dev/null")
 (uu "uuencode xxx" "uudecode -o /dev/stdout" "test -c /dev/stdout")
 (uu "uuencode xxx" "uudecode -o -")
 (uu "uuencode xxx" "uudecode -p")
 (uu "uuencode xxx" tramp-uudecode)
 (pack tramp-perl-pack tramp-perl-unpack))

Funny -- it lists awk as one method:

 (b64 tramp-awk-encode tramp-awk-decode "test -c /dev/zero && od -v -t x1 -A n </dev/null && busybox awk '{}' </dev/null")

But awk was not used, because 'od' is also not available.
And none of the other binaries exist in LibreCMC or OpenWRT (not after a simple install, at least).

> The debug buffer you'll send shall show us, why it doesn't work.

Yes, it is here:

19:41:26.088945 tramp-sh-handle-file-local-copy (1) # File error: Wrong method specification for â€˜sshâ€™

(this is the only occurrence of the string "error").

As I had mentioned in the first message, this is because line 3174 of
tramp.el was reached. It is the default case of a COND expression that has other two cases:
- (or (tramp-local-host-p v)
      (tramp-method-out-of-band-p v size))
- (rem-enc ...)

What happened is that (rem-enc ...) failed (because tramp could not use
any encoding command), and fell through into the default action, which
is this error.

>> So, I'm not sure if this is a tramp bug (can't use awk to encode/decode
>> files in base64 format) or bug in its manual (doesn't mention that
>> a base64 binary is needed on the remote side).
>
> Tramp shall describe in its manual, what does it need for
> encoding/decoding. Agreed.

Right...
I will later in the week propose a patch to the manual, if that is OK.

J.