GNU bug report logs - #35639
27.0.50; tramp fails to use ssh on LibreCMC (no base64 encoder available, and not mentioned in tramp manual)

Previous Next

Package: emacs;

Reported by: Jeronimo Pellegrini <j_p <at> aleph0.info>

Date: Wed, 8 May 2019 16:39:02 UTC

Severity: normal

Tags: patch

Merged with 35473

Found in version 27.0.50

Fixed in version 27.2

Done: Michael Albinus <michael.albinus <at> gmx.de>

Bug is archived. No further changes may be made.

Full log


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

From: Jeronimo Pellegrini <j_p <at> aleph0.info>
To: Jeronimo Pellegrini <j_p <at> aleph0.info>
Cc: 35639 <at> debbugs.gnu.org, Michael Albinus <michael.albinus <at> gmx.de>
Subject: Re: bug#35639: 27.0.50; tramp fails to use ssh on LibreCMC (no
 base64 encoder available, and not mentioned in tramp manual)
Date: Fri, 10 May 2019 22:57:36 -0300
[Message part 1 (text/plain, inline)]
On Fri, May 10, 2019 at 11:45:46AM -0300, Jeronimo Pellegrini wrote:
> Or I can try to make the shell code that is sent to the remote
> end do the verification itself (I'd test using dash, which I
> hope will work on most systems of interest). Something like
> 
> { hexdump < /dev/null && HD=hexdump; } || \
> { busybox hexdump < /dev/null && HD="busybox hexdump"; } &&  \
> $HD ...

I actually implemented the shell scripting solution.
Only tramp-hexdump-awk-encode is in the email body, but the
full patch is attached.

This seems to work, and requires no extra coding in tramp
(only the constant strings are changed).

I can also do the templating in elisp, if you think it would be 
better.

J.

(defconst tramp-hexdump-awk-encode
  "{ { awk '{}' </dev/null && BA=\"\"  ; } || \
     { busybox awk '{}' </dev/null &&  BA=busybox ; } } && \
   { { hexdump -v -e '16/1 \" %%02x\" \"\\n\"' < /dev/null && BH=\"\" ; } || \
     { busybox hexdump -v -e '16/1 \" %%02x\" \"\\n\"' < /dev/null && BH=busybox ; } } && \
$BH hexdump -v -e '16/1 \" %%02x\" \"\\n\"'| $BA awk '\\
BEGIN {
  b64 = \"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/\"
  b16 = \"0123456789abcdef\"
}
{
  for (c=1; c<=length($0); c++) {
    d=index(b16, substr($0,c,1))
    if (d--) {
      for (b=1; b<=4; b++) {
        o=o*2+int(d/8); d=(d*2)%%16
        if (++obc==6) {
          printf substr(b64,o+1,1)
          if (++rc>75) { printf \"\\n\"; rc=0 }
          obc=0; o=0
        }
      }
    }
  }
}
END {
  if (obc) {
    tail=(obc==2) ? \"==\\n\" : \"=\\n\"
    while (obc++<6) { o=o*2 }
    printf \"%%c\", substr(b64,o+1,1)
  } else {
    tail=\"\\n\"
  }
  printf tail
}'"
  "Awk/hexdump program to use for encoding a file.
This string is passed to `format', so percent characters need to be doubled.")
[tramp-use-hexdump-with-extra-shell-scripting.diff (text/x-diff, attachment)]

This bug report was last modified 5 years and 121 days ago.

Previous Next


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