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

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

bug#18199: 24.4.50; tramp uses wrong arguments to nc


From: Michael Albinus
Subject: bug#18199: 24.4.50; tramp uses wrong arguments to nc
Date: Wed, 06 Aug 2014 09:43:46 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.4.50 (gnu/linux)

Jason Rumney <jasonr@gnu.org> writes:

Hi Jason,

> When connecting to a Busybox/Linux based router with tramp's new nc method,
> the file transfer fails.  Below is the relevant debug log:
>
> ---------------------------------------------------------------------
> ///3359aa65e9a4645eb0b84d831a25d5c2#$
> 23:26:29.200991 tramp-send-command (6) # nc -l -p 51257 </etc/TZ &
> 23:26:29.250828 tramp-wait-for-regexp (6) # 
>
> ///3359aa65e9a4645eb0b84d831a25d5c2#$
> 23:26:29.251550 tramp-send-command (6) # netstat -l | grep -q :51257
> 23:26:29.308484 tramp-wait-for-regexp (6) # 
> BusyBox v1.6.1 (2011-05-25 14:47:48 CST) multi-call binary
>
> Usage: 
> nc [IPADDR PORTNUM]
>
> Open a pipe to IP:port

[...]

> The actual command required is
>
>    nc -l 51257 </etc/TZ &

Well, as you might guess I have tested this with my own equipment. My
silly router runs a more recent version of busybox, which requires the
"-p" prefix for nc's port specification:

--8<---------------cut here---------------start------------->8---
# nc -l 51257
nc: bad address '51257'
# nc -h
nc: invalid option -- h
BusyBox v1.19.3 (2012-08-08 12:53:46 CEST) multi-call binary.

Usage: nc [-iN] [-wN] [-l] [-p PORT] [-f FILE|IPADDR PORT] [-e PROG]

Open a pipe to IP:PORT or FILE

        -e PROG Run PROG after connect
        -l      Listen mode, for inbound connects
                (use -l twice with -e for persistent server)
        -p PORT Local port
        -w SEC  Timeout for connect
        -i SEC  Delay interval for lines sent
        -f FILE Use file (ala /dev/ttyS0) instead of network
--8<---------------cut here---------------end--------------->8---

I don't see how to unify both syntax variants. Therfore, I will add a
check for nc prior the first call, in order to determine what to
use. Alternatively, it could be made configurable; haven't decided yet.

This might take some days. For further testing (which would much be
appreciated!), you could use the following patch:

--8<---------------cut here---------------start------------->8---
*** /home/albinus/src/emacs/lisp/net/tramp-sh.el.~117648~       2014-08-06 
09:23:05.687261671 +0200
--- /home/albinus/src/emacs/lisp/net/tramp-sh.el        2014-08-06 
09:22:01.750100553 +0200
***************
*** 218,225 ****
      ;; We use "-v" for better error tracking.
      (tramp-copy-args            (("-w" "1") ("-v") ("%h") ("%r")))
      (tramp-remote-copy-program  "nc")
!     ;; We use "-p" as required for busyboxes.
!     (tramp-remote-copy-args     (("-l") ("-p" "%r")))
      (tramp-default-port         23)))
  ;;;###tramp-autoload
  (add-to-list 'tramp-methods
--- 218,224 ----
      ;; We use "-v" for better error tracking.
      (tramp-copy-args            (("-w" "1") ("-v") ("%h") ("%r")))
      (tramp-remote-copy-program  "nc")
!     (tramp-remote-copy-args     (("-l") ("%r")))
      (tramp-default-port         23)))
  ;;;###tramp-autoload
  (add-to-list 'tramp-methods
--8<---------------cut here---------------end--------------->8---

Best regards, Michael.





reply via email to

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