bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#35639: 27.0.50; tramp fails to use ssh on LibreCMC (no base64 encode


From: Jeronimo Pellegrini
Subject: bug#35639: 27.0.50; tramp fails to use ssh on LibreCMC (no base64 encoder available, and not mentioned in tramp manual)
Date: Thu, 9 May 2019 07:19:39 -0300
User-agent: Mutt/1.10.1 (2018-07-13)

Hi Michael,

On Thu, May 09, 2019 at 09:35:13AM +0200, Michael Albinus wrote:
> Jeronimo Pellegrini <j_p@aleph0.info> writes:
> >  (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.
> 
> I'm not a heavy awk user. The current awk based implementation has been
> contributed by somebody else, IIRC. Do you know another way to use awk
> for encoding/decoing base64, without "od"?

Yes. Instead of  od:
 od -v -t x1 -A n

it would be possible to use hexdump:
 hexdump -v -e '16/1 " %02x" "\n"' 

hexdump is included in busybox, and seems to be at least as fast as
od.

However... hexdump may not be present in all Linux/*BSD/*ix systems.
At least in Debian, it is in package bsdmainutils, which is
not required. (od, on the other hand, is in package coreutils, which 
is required)

> The current Tramp implementation is in the two variables
> `tramp-awk-encode' and `tramp-awk-decode'. If we could find another
> implementation, which runs also on your LibreCMC or OpenWRT machine, we
> could add it to Tramp.

Would it be OK to have two different variables, and two tests for
od+awk and hexdump+awk?

tramp-od-awk-coding-test
tramp-od-awk-{encode,decode}

tramp-hexdump-awk-coding-test
tramp-hexdump-awk-{encode-decode}

Or would it be better if the string in  tramp-awk-encode 
was built from two others, (1) the hex dumper and (2) the awk 
code?
- define a constant tramp-awk-from-hex-to-base64, which does
  only the hex into base64 part of the job

- when connecting, tramp would check for some hex dumper (od 
  or hexdump) this would split tramp-awk-coding-test in two
  others

- tramp-awk-encode would be obtained by concatenating the hex-dumping
  string (either od or hexdump) with " | " and tramp-awk-from-hex-to-base64.

But then tramp-awk-encode would not be a constant anymore.

> > 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.
> 
> Maybe we should enhance the error message.

Perhaps 

(tramp-error v 'file-error "Cannot find any way to encode data using `%s'" 
method)

would be more precise?

Or, if (tramp-local-host-p v) (tramp-method-out-of-band-p v size) are
false, explicitly write that "encoding binaries were not found on the remote 
end"?

J.






reply via email to

[Prev in Thread] Current Thread [Next in Thread]