Subject: 24.4.50; tramp uses wrong arguments to nc

From: Jason Rumney <[email-masked]>
Date: Wed, 06 Aug 2014 00:01:44 +0800

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 [email-masked]
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:[email-masked]:/etc/TZ'...failed
File exists, but cannot be read

Tramp: Checking `vc-registered' for /nc:[email-masked]:/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))