all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* bug#18199: 24.4.50; tramp uses wrong arguments to nc
@ 2014-08-05 16:01 Jason Rumney
  2014-08-06  7:43 ` Michael Albinus
  0 siblings, 1 reply; 6+ messages in thread
From: Jason Rumney @ 2014-08-05 16:01 UTC (permalink / raw
  To: 18199


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

[1] + Done(1)                    nc -l -p 51257 0</etc/TZ
---------------------------------------------------------------------

Although the usage message from BusyBox seems to suggest it does not
accept any options, it does in fact accept the -l option.  It is the -p
option that is a problem here.  The manpage for the full BSD nc command
says the following:

     -l      Used to specify that nc should listen for an incoming connection
             rather than initiate a connection to a remote host.  It is an
             error to use this option in conjunction with the -p, -s, or -z
             options.  Additionally, any timeouts specified with the -w option
             are ignored.

The actual command required is

   nc -l 51257 </etc/TZ &





In GNU Emacs 24.4.50.3 (x86_64-unknown-linux-gnu, GTK+ Version 3.10.8)
 of 2014-08-05 on wanchan
Repository revision: 117648 rudalics@gmx.at-20140805082528-lggey1cjbd1jl06e
Windowing system distributor `The X.Org Foundation', version 11.0.11501000
System Description:	Ubuntu 14.04 LTS

Configured features:
XPM JPEG TIFF GIF PNG RSVG IMAGEMAGICK SOUND DBUS GCONF GSETTINGS NOTIFY
GNUTLS LIBXML2 FREETYPE M17N_FLT LIBOTF XFT ZLIB

Important settings:
  value of $LC_MONETARY: en_NZ.UTF-8
  value of $LC_NUMERIC: en_NZ.UTF-8
  value of $LC_TIME: en_NZ.UTF-8
  value of $LANG: en_NZ.UTF-8
  value of $XMODIFIERS: @im=ibus
  locale-coding-system: utf-8-unix

Major mode: Outline

Minor modes in effect:
  global-flycheck-mode: t
  shell-dirtrack-mode: t
  delete-selection-mode: t
  show-paren-mode: t
  recentf-mode: t
  display-time-mode: t
  cua-mode: t
  global-semanticdb-minor-mode: t
  global-semantic-idle-scheduler-mode: t
  semantic-mode: t
  tooltip-mode: t
  electric-indent-mode: t
  mouse-wheel-mode: t
  tool-bar-mode: t
  menu-bar-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  blink-cursor-mode: t
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t
  line-number-mode: t
  auto-fill-function: do-auto-fill

Recent input:
<triple-mouse-4> <triple-down-mouse-4> <triple-mouse-4> 
<triple-down-mouse-4> <triple-mouse-4> <down-mouse-5> 
<mouse-5> <down-mouse-1> <mouse-1> <down-mouse-5> <mouse-5> 
<double-down-mouse-5> <double-mouse-5> <down-mouse-5> 
<mouse-5> <down-mouse-5> <mouse-5> <double-down-mouse-5> 
<double-mouse-5> <down-mouse-4> <mouse-4> <mouse-movement> 
<mouse-movement> <drag-mouse-1> <down-mouse-1> <mouse-movement> 
<mouse-1> <mouse-movement> <mouse-movement> <mouse-movement> 
<drag-mouse-1> <down-mouse-5> <mouse-5> <escape> w 
<down-mouse-4> <mouse-4> <help-echo> <help-echo> <down-mouse-4> 
<mouse-4> <down-mouse-4> <mouse-4> <down-mouse-1> <mouse-1> 
<down> <left> <up> <up> <up> <down> <down> <down> <up> 
<up> <up> <up> <up> <up> <down-mouse-4> <mouse-4> <double-down-mouse-4> 
<double-mouse-4> <triple-down-mouse-4> <triple-mouse-4> 
<triple-down-mouse-4> <triple-mouse-4> <triple-down-mouse-4> 
<triple-mouse-4> <down-mouse-1> <mouse-1> C-s n c SPC 
<down> <mouse-movement> <mouse-movement> <drag-mouse-1> 
<mouse-movement> <mouse-movement> <mouse-movement> 
<drag-mouse-1> <mouse-movement> <mouse-movement> <mouse-movement> 
<drag-mouse-1> <down-mouse-1> <mouse-1> <down-mouse-5> 
<mouse-5> <down-mouse-1> <mouse-movement> <drag-mouse-1> 
<down-mouse-5> <mouse-5> <down-mouse-5> <mouse-5> <down-mouse-5> 
<mouse-5> <double-down-mouse-5> <double-mouse-5> <down-mouse-5> 
<mouse-5> <down-mouse-4> <mouse-4> <double-down-mouse-4> 
<double-mouse-4> <triple-down-mouse-4> <triple-mouse-4> 
<triple-down-mouse-4> <triple-mouse-4> <triple-down-mouse-4> 
<triple-mouse-4> <triple-down-mouse-4> <triple-mouse-4> 
<triple-down-mouse-4> <triple-mouse-4> <triple-down-mouse-4> 
<triple-mouse-4> <triple-down-mouse-4> <triple-mouse-4> 
<triple-down-mouse-4> <triple-mouse-4> <triple-down-mouse-4> 
<triple-mouse-4> <down-mouse-5> <mouse-5> <double-down-mouse-5> 
<double-mouse-5> <down-mouse-5> <mouse-5> <double-down-mouse-5> 
<double-mouse-5> <triple-down-mouse-5> <triple-mouse-5> 
<triple-down-mouse-5> <triple-mouse-5> <triple-down-mouse-5> 
<triple-mouse-5> <triple-down-mouse-5> <triple-mouse-5> 
<triple-down-mouse-5> <triple-mouse-5> <triple-down-mouse-5> 
<triple-mouse-5> <down-mouse-5> <mouse-5> <double-down-mouse-5> 
<double-mouse-5> <triple-down-mouse-5> <triple-mouse-5> 
<triple-down-mouse-5> <triple-mouse-5> <triple-down-mouse-5> 
<triple-mouse-5> <triple-down-mouse-5> <triple-mouse-5> 
<triple-down-mouse-5> <triple-mouse-5> <triple-down-mouse-5> 
<triple-mouse-5> <triple-down-mouse-5> <triple-mouse-5> 
<triple-down-mouse-5> <triple-mouse-5> <down-mouse-4> 
<mouse-4> <double-down-mouse-4> <double-mouse-4> <triple-down-mouse-4> 
<triple-mouse-4> <triple-down-mouse-4> <triple-mouse-4> 
<down-mouse-4> <mouse-4> <double-down-mouse-4> <double-mouse-4> 
<triple-down-mouse-4> <triple-mouse-4> <down-mouse-5> 
<mouse-5> <double-down-mouse-5> <double-mouse-5> <down-mouse-4> 
<mouse-4> <double-down-mouse-4> <double-mouse-4> <triple-down-mouse-4> 
<triple-mouse-4> <triple-down-mouse-4> <triple-mouse-4> 
<triple-down-mouse-4> <triple-mouse-4> <triple-down-mouse-4> 
<triple-mouse-4> <triple-down-mouse-4> <triple-mouse-4> 
<triple-down-mouse-4> <triple-mouse-4> <triple-down-mouse-4> 
<triple-mouse-4> <down-mouse-5> <mouse-5> <double-down-mouse-5> 
<double-mouse-5> <down-mouse-5> <mouse-5> <down-mouse-5> 
<mouse-5> <double-down-mouse-5> <double-mouse-5> <triple-down-mouse-5> 
<triple-mouse-5> <triple-down-mouse-5> <triple-mouse-5> 
<triple-down-mouse-5> <triple-mouse-5> <triple-down-mouse-5> 
<triple-mouse-5> <down-mouse-1> <mouse-1> <mouse-movement> 
<mouse-movement> <mouse-movement> <mouse-movement> 
<mouse-movement> <mouse-movement> <mouse-movement> 
<mouse-movement> <mouse-movement> <mouse-movement> 
<mouse-movement> <mouse-movement> <mouse-movement> 
<mouse-movement> <mouse-movement> <mouse-movement> 
<drag-mouse-1> <mouse-movement> <mouse-movement> <mouse-movement> 
<mouse-movement> <mouse-movement> <mouse-movement> 
<mouse-movement> <mouse-movement> <mouse-movement> 
<mouse-movement> <mouse-movement> <mouse-movement> 
<drag-mouse-1> <escape> w <mouse-movement> <mouse-movement> 
<mouse-movement> <mouse-movement> <mouse-movement> 
<mouse-movement> <drag-mouse-1> <escape> w <help-echo> 
<help-echo> <help-echo> <help-echo> <help-echo> <help-echo> 
<help-echo> <help-echo> <help-echo> <help-echo> <help-echo> 
<help-echo> <help-echo> <help-echo> <help-echo> <help-echo> 
<help-echo> <help-echo> <help-echo> <help-echo> <help-echo> 
<help-echo> <help-echo> <help-echo> <help-echo> <help-echo> 
<help-echo> <help-echo> <help-echo> <help-echo> <help-echo> 
<help-echo> <help-echo> <help-echo> <menu-bar> <help-menu> 
<send-emacs-bug-report>

Recent messages:
Tramp: Inserting `/nc:mt7109@10.1.1.254:/etc/TZ'...failed
File exists, but cannot be read

Tramp: Checking `vc-registered' for /nc:mt7109@10.1.1.254:/etc/TZ...done
File exists, but cannot be read
Mark set [10 times]
<left-fringe> <mouse-5> is undefined
<left-fringe> <double-mouse-5> is undefined
Mark set [4 times]
Mark saved where search started

Load-path shadows:
None found.

Features:
(shadow google-contacts-message google-contacts xml url-cache url
url-proxy url-privacy url-expand url-methods url-history url-cookie
url-domsuf url-util url-parse url-vars google-oauth emacsbug tramp-cmds
misearch multi-isearch vc-bzr noutline outline view cus-edit mule-util
sort gnus-cite smiley shr-color color shr browse-url mm-archive
mail-extr gnus-async gnus-bcklg gnus-ml disp-table nndraft nnmh nnfolder
utf-7 epa-file epa derived epg gnutls network-stream starttls gnus-agent
gnus-srvr gnus-score score-mode nnvirtual gnus-msg gnus-art mm-uu
mml2015 epg-config mm-view mml-smime smime dig mailcap nntp gnus-cache
gnus-sum gnus-group gnus-undo gnus-start gnus-cloud nnimap nnmail
mail-source tls utf7 netrc nnoo parse-time gnus-spec gnus-int gnus-range
message sendmail cl-macs dired rfc822 mml mml-sec mm-decode mm-bodies
mm-encode mail-parse rfc2231 rfc2047 rfc2045 ietf-drums mailabbrev
gmm-utils mailheader gnus-win mmm-mode mmm-univ mmm-class mmm-region
mmm-auto mmm-vars mmm-utils mmm-compat cl flycheck find-func help-mode
rx subr-x pcase dash bbdb-ext-autoloads calfw-gcal-autoloads
doctags-autoloads edmacro kmacro org-cua-dwim-autoloads info
vcard-autoloads package tramp-cache tramp-sh tramp tramp-compat
auth-source password-cache tramp-loaddefs trampver shell pcomplete
comint ansi-color ring format-spec advice jka-compr delsel paren recentf
tree-widget gnus gnus-ems nnheader gnus-util mail-utils mm-util help-fns
mail-prsvr wid-edit cl-loaddefs cl-lib time cua-base cus-start cus-load
easy-mmode semantic/db-mode semantic/db gv eieio-base semantic/idle
semantic/format ezimage semantic/tag-ls semantic/find semantic/ctxt
semantic/util-modes easymenu semantic/util semantic semantic/tag
semantic/lex semantic/fw eieio byte-opt bytecomp byte-compile cconv
eieio-core mode-local cedet org-loaddefs server time-date tooltip
electric uniquify ediff-hook vc-hooks lisp-float-type mwheel x-win x-dnd
tool-bar dnd fontset image regexp-opt fringe tabulated-list newcomment
lisp-mode prog-mode register page menu-bar rfn-eshadow timer select
scroll-bar mouse jit-lock font-lock syntax facemenu font-core frame cham
georgian utf-8-lang misc-lang vietnamese tibetan thai tai-viet lao
korean japanese hebrew greek romanian slovak czech european ethiopic
indian cyrillic chinese case-table epa-hook jka-cmpr-hook help simple
abbrev minibuffer nadvice loaddefs button faces cus-face macroexp files
text-properties overlay sha1 md5 base64 format env code-pages mule
custom widget hashtable-print-readable backquote make-network-process
dbusbind gfilenotify dynamic-setting system-font-setting
font-render-setting move-toolbar gtk x-toolkit x multi-tty emacs)

Memory information:
((conses 16 318131 45985)
 (symbols 48 39348 1)
 (miscs 40 345 504)
 (strings 32 80886 11308)
 (string-bytes 1 2508747)
 (vectors 16 40101)
 (vector-slots 8 1413448 210541)
 (floats 8 467 633)
 (intervals 56 3071 230)
 (buffers 976 28)
 (heap 1024 76100 1461))





^ permalink raw reply	[flat|nested] 6+ messages in thread

* bug#18199: 24.4.50; tramp uses wrong arguments to nc
  2014-08-05 16:01 bug#18199: 24.4.50; tramp uses wrong arguments to nc Jason Rumney
@ 2014-08-06  7:43 ` Michael Albinus
  2014-08-06  8:18   ` Andreas Schwab
  0 siblings, 1 reply; 6+ messages in thread
From: Michael Albinus @ 2014-08-06  7:43 UTC (permalink / raw
  To: Jason Rumney; +Cc: 18199

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.





^ permalink raw reply	[flat|nested] 6+ messages in thread

* bug#18199: 24.4.50; tramp uses wrong arguments to nc
  2014-08-06  7:43 ` Michael Albinus
@ 2014-08-06  8:18   ` Andreas Schwab
  2014-08-06  9:35     ` Michael Albinus
  2014-08-06 15:36     ` Jason Rumney
  0 siblings, 2 replies; 6+ messages in thread
From: Andreas Schwab @ 2014-08-06  8:18 UTC (permalink / raw
  To: Michael Albinus; +Cc: 18199, Jason Rumney

Michael Albinus <michael.albinus@gmx.de> writes:

> 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:
>
> # 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]

It's more likely a BusyBox configure option, since the version I have
(v1.19.4 from openWRT) doesn't even accept -l.

Andreas.

-- 
Andreas Schwab, SUSE Labs, schwab@suse.de
GPG Key fingerprint = 0196 BAD8 1CE9 1970 F4BE  1748 E4D4 88E3 0EEA B9D7
"And now for something completely different."





^ permalink raw reply	[flat|nested] 6+ messages in thread

* bug#18199: 24.4.50; tramp uses wrong arguments to nc
  2014-08-06  8:18   ` Andreas Schwab
@ 2014-08-06  9:35     ` Michael Albinus
  2014-08-06 15:36     ` Jason Rumney
  1 sibling, 0 replies; 6+ messages in thread
From: Michael Albinus @ 2014-08-06  9:35 UTC (permalink / raw
  To: Andreas Schwab; +Cc: 18199, Jason Rumney

Andreas Schwab <schwab@suse.de> writes:

> It's more likely a BusyBox configure option, since the version I have
> (v1.19.4 from openWRT) doesn't even accept -l.

Indeed, there is a busybox build time option (CONFIG_NC_SERVER). But
this is not related to the used command line syntax.

Agreed, Tramp shall check whether the nc listening feature is enabled;
it shall raise an error in case it isn't. Noted.

> Andreas.

Best regards, Michael.





^ permalink raw reply	[flat|nested] 6+ messages in thread

* bug#18199: 24.4.50; tramp uses wrong arguments to nc
  2014-08-06  8:18   ` Andreas Schwab
  2014-08-06  9:35     ` Michael Albinus
@ 2014-08-06 15:36     ` Jason Rumney
  2014-08-07  9:27       ` Michael Albinus
  1 sibling, 1 reply; 6+ messages in thread
From: Jason Rumney @ 2014-08-06 15:36 UTC (permalink / raw
  To: Andreas Schwab; +Cc: Michael Albinus, 18199-close

tag 18199 wontfix
close 18199
thanks

Andreas Schwab <schwab@suse.de> writes:

> Michael Albinus <michael.albinus@gmx.de> writes:
>
>> 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:
>
> It's more likely a BusyBox configure option, since the version I have
> (v1.19.4 from openWRT) doesn't even accept -l.

Now that I've modified my local tramp to remove the -p, I find that
though nc -l 51257 does not give any errors, it isn't actually listening
on the port either.  I'm not sure what it is doing.







^ permalink raw reply	[flat|nested] 6+ messages in thread

* bug#18199: 24.4.50; tramp uses wrong arguments to nc
  2014-08-06 15:36     ` Jason Rumney
@ 2014-08-07  9:27       ` Michael Albinus
  0 siblings, 0 replies; 6+ messages in thread
From: Michael Albinus @ 2014-08-07  9:27 UTC (permalink / raw
  To: Jason Rumney; +Cc: Andreas Schwab, 18199

Jason Rumney <jasonr@gnu.org> writes:

> Now that I've modified my local tramp to remove the -p, I find that
> though nc -l 51257 does not give any errors, it isn't actually listening
> on the port either.  I'm not sure what it is doing.

As said in my other message to Andreas, busybox might not be compiled
with the nc listening feature.

Anyway, I've committed a patch which allows you to overwrite the "nc -l
..." arguments. Tramp's manual says

--8<---------------cut here---------------start------------->8---
     The ‘nc’ command will be used with the ‘nc’ method.  On the remote
     host, a listener will be installed.  Unfortunately, the command
     line syntax for this has been changed with the different ‘busybox’
     versions.  TRAMP uses the following syntax (see ‘tramp-methods’):

          # nc -l -p 42

     If your remote ‘nc’ refuses to accept the ‘-p’ parameter, you could
     overwrite the syntax with the following form:

          (add-to-list
           'tramp-connection-properties
           `(,(regexp-quote "192.168.0.1") "remote-copy-args" (("-l") ("%r"))))

     with ‘192.168.0.1’ being the IP address of your remote host (*note
     Predefined connection information::).
--8<---------------cut here---------------end--------------->8---

Best regards, Michael.





^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2014-08-07  9:27 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-08-05 16:01 bug#18199: 24.4.50; tramp uses wrong arguments to nc Jason Rumney
2014-08-06  7:43 ` Michael Albinus
2014-08-06  8:18   ` Andreas Schwab
2014-08-06  9:35     ` Michael Albinus
2014-08-06 15:36     ` Jason Rumney
2014-08-07  9:27       ` Michael Albinus

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.