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: Thu, 9 May 2019 17:11:29 -0300 Message-ID: <20190509201129.GE1697@socrates.lan> References: <87d0ksrk0g.fsf@mitra.i-did-not-set--mail-host-address--so-tickle-me> <87k1f03im0.fsf@gmx.de> <20190508230145.GA1697@socrates.lan> <87d0ksw05q.fsf@gmx.de> <20190509101938.GB1697@socrates.lan> <8736lnx27g.fsf@gmx.de> <1A3C3BED-4CEF-41AC-B82F-EBA7AC614E18@aleph0.info> <87pnoru77n.fsf@gmx.de> <20190509195218.GD1697@socrates.lan> <87bm0b2y6t.fsf@gmx.de> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="7JfCtLOvnd9MIVvH" Injection-Info: blaine.gmane.org; posting-host="blaine.gmane.org:195.159.176.226"; logging-data="49046"; mail-complaints-to="usenet@blaine.gmane.org" User-Agent: Mutt/1.10.1 (2018-07-13) Cc: 35639@debbugs.gnu.org, Jeronimo Pellegrini To: Michael Albinus Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Thu May 09 22:12:15 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 1hOpOn-000CZ8-AV for geb-bug-gnu-emacs@m.gmane.org; Thu, 09 May 2019 22:12:14 +0200 Original-Received: from localhost ([127.0.0.1]:60377 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hOpOm-0004mJ-5q for geb-bug-gnu-emacs@m.gmane.org; Thu, 09 May 2019 16:12:12 -0400 Original-Received: from eggs.gnu.org ([209.51.188.92]:38048) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hOpOf-0004m2-6G for bug-gnu-emacs@gnu.org; Thu, 09 May 2019 16:12:06 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hOpOd-0004Gv-Gg for bug-gnu-emacs@gnu.org; Thu, 09 May 2019 16:12:05 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:51228) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1hOpOc-0004GA-Nd for bug-gnu-emacs@gnu.org; Thu, 09 May 2019 16:12:03 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1hOpOc-0008Vn-DU for bug-gnu-emacs@gnu.org; Thu, 09 May 2019 16:12: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: Thu, 09 May 2019 20:12:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 35639 X-GNU-PR-Package: emacs Original-Received: via spool by 35639-submit@debbugs.gnu.org id=B35639.155743270132690 (code B ref 35639); Thu, 09 May 2019 20:12:02 +0000 Original-Received: (at 35639) by debbugs.gnu.org; 9 May 2019 20:11:41 +0000 Original-Received: from localhost ([127.0.0.1]:36539 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1hOpOH-0008VC-Bi for submit@debbugs.gnu.org; Thu, 09 May 2019 16:11:41 -0400 Original-Received: from mail.aleph0.info ([66.228.54.186]:55416 helo=aleph0.info) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1hOpOE-0008Uy-IV for 35639@debbugs.gnu.org; Thu, 09 May 2019 16:11:39 -0400 Original-Received: from localhost (localhost [127.0.0.1]) by aleph0.info (Postfix) with ESMTP id D312F42390; Thu, 9 May 2019 17:11:32 -0300 (-03) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=aleph0.info; s=mail; t=1557432692; bh=9Na/GVefT/LHcYkN8a+e5e+YmwdPqlEY5qn/SNPjlEU=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=L9dIU/5gOcwedCXJwnsGLvx2rueMdrA2PgE3LyYJVqETEaSS09lk1J+k3h2LfRHCs t0qEJHzun4rGSkOQcCXsOMohHi8iR/cdy0AoDZFUVLYPEyqjwnbl4X274BaYodvGRV QTesAuea1y0bilHGoltxhiY+yj7QDiOGeqQBv5uw75QWrAW7DC08mpdfiaPZ9iTVtt iSFOv5SMunLbmzsjy0qV+a3T4Nw3lI1rXCkQauKsdADAJYqoMr08rxHNGwdJDZBvx7 vfHjmiV2aTem6ZEveJdCsf5+v5IW0UJCZxIboH63x/IC95WovvawVecgKP7Vcnc7Tb A+MYU3jmna0xg== Original-Received: from aleph0.info ([127.0.0.1]) by localhost (localhost [127.0.0.1]) (amavisd-new, port 10024) with LMTP id JstP_13nwoYC; Thu, 9 May 2019 17:11:32 -0300 (-03) Original-Received: from socrates.aleph0.info (unknown [191.181.133.68]) (Authenticated sender: je) by aleph0.info (Postfix) with ESMTPSA id 81A1642375; Thu, 9 May 2019 17:11:32 -0300 (-03) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=aleph0.info; s=mail; t=1557432692; bh=9Na/GVefT/LHcYkN8a+e5e+YmwdPqlEY5qn/SNPjlEU=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=L9dIU/5gOcwedCXJwnsGLvx2rueMdrA2PgE3LyYJVqETEaSS09lk1J+k3h2LfRHCs t0qEJHzun4rGSkOQcCXsOMohHi8iR/cdy0AoDZFUVLYPEyqjwnbl4X274BaYodvGRV QTesAuea1y0bilHGoltxhiY+yj7QDiOGeqQBv5uw75QWrAW7DC08mpdfiaPZ9iTVtt iSFOv5SMunLbmzsjy0qV+a3T4Nw3lI1rXCkQauKsdADAJYqoMr08rxHNGwdJDZBvx7 vfHjmiV2aTem6ZEveJdCsf5+v5IW0UJCZxIboH63x/IC95WovvawVecgKP7Vcnc7Tb A+MYU3jmna0xg== Original-Received: by socrates.aleph0.info (Postfix, from userid 1000) id 171D5969C8; Thu, 9 May 2019 17:11:29 -0300 (-03) Content-Disposition: inline In-Reply-To: <87bm0b2y6t.fsf@gmx.de> 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:159005 Archived-At: --7JfCtLOvnd9MIVvH Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Hi Michael, On Thu, May 09, 2019 at 10:02:50PM +0200, Michael Albinus wrote: > Jeronimo Pellegrini writes: > > Okay, I have it ready. Do I attach it here in the bug report? > > Yes, pls do. All right, here it is! I'm not sure I like the changes to the manual. Do you think it is OK? Thank you! J. --7JfCtLOvnd9MIVvH Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="tramp-use-hexdump.diff" diff --git a/doc/misc/tramp.texi b/doc/misc/tramp.texi index 2eb5b45eb2..7bbf1f1771 100644 --- a/doc/misc/tramp.texi +++ b/doc/misc/tramp.texi @@ -1960,16 +1960,30 @@ 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{grep} 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 b9df403309..7a1d4ca638 100644 --- a/lisp/net/tramp-sh.el +++ b/lisp/net/tramp-sh.el @@ -850,7 +850,41 @@ 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 +(defconst tramp-hexdump-awk-encode + "hexdump -v -e '16/1 \" %%02x\" \"\\n\"' | busybox 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.") + +(defconst tramp-od-awk-encode "od -v -t x1 -A n | busybox awk '\\ BEGIN { b64 = \"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/\" @@ -881,7 +915,7 @@ tramp-awk-encode } printf tail }'" - "Awk program to use for encoding a file. + "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 @@ -910,11 +944,18 @@ tramp-awk-decode "Awk program to use for decoding a file. This string is passed to `format', so percent characters need to be doubled.") -(defconst tramp-awk-coding-test + +(defconst tramp-hexdump-awk-coding-test + "test -c /dev/zero && \ +busybox hexdump -v -e '16/1 \" %02x\" \"\\n\"' < /dev/null && \ +busybox awk '{}'