From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED.blaine.gmane.org!not-for-mail From: Jeronimo Pellegrini Newsgroups: gmane.emacs.bugs Subject: 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-ID: <20190511015735.GG1697@socrates.lan> References: <8736lnx27g.fsf@gmx.de> <1A3C3BED-4CEF-41AC-B82F-EBA7AC614E18@aleph0.info> <87pnoru77n.fsf@gmx.de> <20190509195218.GD1697@socrates.lan> <87bm0b2y6t.fsf@gmx.de> <20190509201129.GE1697@socrates.lan> <8736lm3dpb.fsf@gmx.de> <20190510094930.GF1697@socrates.lan> <87imui1ul2.fsf@gmx.de> <20190510144546.GA8269@aleph0.info> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="QKdGvSO+nmPlgiQ/" Injection-Info: blaine.gmane.org; posting-host="blaine.gmane.org:195.159.176.226"; logging-data="75348"; mail-complaints-to="usenet@blaine.gmane.org" User-Agent: Mutt/1.10.1 (2018-07-13) Cc: 35639@debbugs.gnu.org, Michael Albinus To: Jeronimo Pellegrini Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Sat May 11 03:58:17 2019 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([209.51.188.17]) by blaine.gmane.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1hPHHD-000JRC-Hl for geb-bug-gnu-emacs@m.gmane.org; Sat, 11 May 2019 03:58:15 +0200 Original-Received: from localhost ([127.0.0.1]:52566 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hPHHC-0003WF-Hw for geb-bug-gnu-emacs@m.gmane.org; Fri, 10 May 2019 21:58:14 -0400 Original-Received: from eggs.gnu.org ([209.51.188.92]:54370) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hPHH5-0003W4-Pq for bug-gnu-emacs@gnu.org; Fri, 10 May 2019 21:58:09 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hPHH3-0000bi-Rb for bug-gnu-emacs@gnu.org; Fri, 10 May 2019 21:58:07 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:54221) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1hPHH0-0000Y0-FF for bug-gnu-emacs@gnu.org; Fri, 10 May 2019 21:58:03 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1hPHH0-0003XI-9W for bug-gnu-emacs@gnu.org; Fri, 10 May 2019 21:58:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Jeronimo Pellegrini Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 11 May 2019 01:58:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 35639 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch Original-Received: via spool by 35639-submit@debbugs.gnu.org id=B35639.155753987013574 (code B ref 35639); Sat, 11 May 2019 01:58:02 +0000 Original-Received: (at 35639) by debbugs.gnu.org; 11 May 2019 01:57:50 +0000 Original-Received: from localhost ([127.0.0.1]:39532 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1hPHGn-0003Wr-Dh for submit@debbugs.gnu.org; Fri, 10 May 2019 21:57:49 -0400 Original-Received: from mail.aleph0.info ([66.228.54.186]:37092 helo=aleph0.info) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1hPHGk-0003Wa-AM for 35639@debbugs.gnu.org; Fri, 10 May 2019 21:57:47 -0400 Original-Received: from localhost (localhost [127.0.0.1]) by aleph0.info (Postfix) with ESMTP id 1645E4237A; Fri, 10 May 2019 22:57:40 -0300 (-03) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=aleph0.info; s=mail; t=1557539860; bh=5qXTuU41irOj9CZQX0srSD8Ttwq5/wfRMXrB8tz7GbM=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=LdfgP89pULJmGvaxuY5lR901Fvm/vEro1yYHADheHxmm7TQweyyoPYmWQr2j657JU qS7h2ZDyMWRswoSa8hokCgGQAWu9F7Wa1X1sAfc/Z7OcOZGwbZjsAe0BVWXz96ie/o f2IOYU4znndWLWkeNBKZwZqc89U9OSyecJ1Uph4V2ywjhNQc7vyOoWcwmtmkbqtRWX 58pSWnTh0vNRWUzl3lBlNP3+m5N1DeCEMiH1JMPdsaeP06oLniRmVrJlMS1/ZGIaSt E12KhG7z9T6H8SxT47+NY/k9cNITMomxsmQFBC/J5fd/sz0pUhWpmVjwseXDy4gxZ7 FYcQARCOWmp6A== Original-Received: from aleph0.info ([127.0.0.1]) by localhost (localhost [127.0.0.1]) (amavisd-new, port 10024) with LMTP id RoXDVd20rAK0; Fri, 10 May 2019 22:57:39 -0300 (-03) Original-Received: from socrates.aleph0.info (unknown [191.181.133.68]) (Authenticated sender: je) by aleph0.info (Postfix) with ESMTPSA id 8856842374; Fri, 10 May 2019 22:57:39 -0300 (-03) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=aleph0.info; s=mail; t=1557539859; bh=5qXTuU41irOj9CZQX0srSD8Ttwq5/wfRMXrB8tz7GbM=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=HZ7/qGZLF1mTPRydK7CrZuF/Y/paEq8Swl6sJpzJx5gClySzCXCwErrnj46PjFAK4 OIXyt7wKgGc3q8zdY8lGFY7loJdUwolTTtHnxs36P0/RvnW7Uz446xFe0aC/OK9C1B NzHUzYRC3PzC0WhdDl3hJM3L95grjehF51UeLHbOMjox+LtTsKW3F86ZuuOk1Km8pP zaUqc2gLTF/rC8hdAWzi7jU5nKXE18d9WktbMR25Jv4YJWRTVDuFI2HekaQPMfsFKR huK1Zl1j0gNi+56SUjbKpzyjS1uIvZ2IeqVLkETW1gsoDSdPfIVBgubk+eM+dFj3gN mofctzpENJFhw== Original-Received: by socrates.aleph0.info (Postfix, from userid 1000) id 73286970E9; Fri, 10 May 2019 22:57:36 -0300 (-03) Content-Disposition: inline In-Reply-To: <20190510144546.GA8269@aleph0.info> X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.51.188.43 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.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.org gmane.emacs.bugs:159063 Archived-At: --QKdGvSO+nmPlgiQ/ Content-Type: text/plain; charset=us-ascii Content-Disposition: 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 '{}' 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.") --QKdGvSO+nmPlgiQ/ Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="tramp-use-hexdump-with-extra-shell-scripting.diff" diff --git a/doc/misc/tramp.texi b/doc/misc/tramp.texi index 2eb5b45eb2..ade4d5cb2d 100644 --- a/doc/misc/tramp.texi +++ b/doc/misc/tramp.texi @@ -1960,16 +1960,31 @@ Remote programs @section How @value{tramp} finds and uses programs on the remote host @value{tramp} requires access to and rights to several commands on -remote hosts: @command{ls}, @command{test}, @command{find} and +remote hosts: at least @command{ls}, @command{test}, @command{find} and @command{cat}. +For inline methods, at least one of the following should be available: + +@itemize @bullet +@item @command{base64} +@item @command{openssl} +@item @command{mimencode} +@item @command{mmencode} +@item @command{recode} +@item @command{perl} or @command{perl5} (if the @command{MIME::Base64} +module is available, it will be used) +@item @command{od} and @command{busybox awk} +@item @command{hexdump} and @command{busybox awk} +@item @command{uuencode} and @command{uudecode} +@end itemize + +If none of these are available, @value{tramp} will not work with inline methods, +but other methods may still be used. If @command{gzip} is available, it is +also used, in order to improve performance. + Besides there are other required programs for @ref{Inline methods} and @ref{External methods} of connection. -To improve performance and accuracy of remote file access, -@value{tramp} uses @command{perl} (or @command{perl5}) and -@command{grep} when available. - @defopt tramp-remote-path @code{tramp-remote-path} specifies which remote directory paths @value{tramp} can search for @ref{Remote programs}. diff --git a/lisp/net/tramp-sh.el b/lisp/net/tramp-sh.el index 95fa61af98..fc2fb51b8a 100644 --- a/lisp/net/tramp-sh.el +++ b/lisp/net/tramp-sh.el @@ -850,8 +850,12 @@ tramp-perl-unpack "Perl program to use for decoding a file. Escape sequence %s is replaced with name of Perl binary.") -(defconst tramp-awk-encode - "od -v -t x1 -A n | busybox awk '\\ +(defconst tramp-hexdump-awk-encode + "{ { awk '{}' 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/od program to use for encoding a file. This string is passed to `format', so percent characters need to be doubled.") (defconst tramp-awk-decode - "busybox awk '\\ + "{ { awk '{}'