On Wed, Jul 8, 2009 at 10:18 AM, Rob Landley<[email protected]> wrote:
> Why did 29fe7265b8 throw away the existing version of netcat?

It did not throw away existing version, it introduced
a nc-1.10 compatible version if DESKTOP=y:


diff --git a/networking/nc.c b/networking/nc.c
index bc7c701..e89eb76 100644
--- a/networking/nc.c
+++ b/networking/nc.c
@@ -9,6 +9,10 @@

 #include "busybox.h"

+#if ENABLE_DESKTOP
+#include "nc_bloaty.c"
+#else
+
 /* Lots of small differences in features
  * when compared to "standard" nc
  */
@@ -195,3 +199,4 @@ int nc_main(int argc, char **argv)
                }
        }
 }
+#endif


I did it because I do not want to break shell scripts
of people who use original nc-1.10 (or a compatible clone).

w/o DESKTOP:

# ./busybox nc --help
BusyBox v1.15.0.svn (2009-07-08 14:52:54 CEST) multi-call binary

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

Open a pipe to IP:port or file

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

> It seems that
> netcat -f support is gone (instead you implemented your own minicom applet).
>
> You can no longer get a server mode that listens to a dynamically allocated
> port and tells you what the port number is, which is really useful for doing
> things like:
>
> qemu-system-ppc --nographic $LOTSOFARGS << EOF
>                #
> netcat 10.0.2.2 $(netcat -l 127.0.0.1 tar c stuff) | tar xv
> # Do stuff with copied files
> tar c results | netcat 10.0.2.2 $(netcat -l 127.0.0.1 tar x)
> EOF
>
> I.E. you can pipe a tarball into qemu through the virtual network (bouncing 
> off
> the loopback device via the special 10.0.2.2 alias that connects to the host's
> loopback interface), do work on the supplied files, and then send a tarball of
> results back out.
>
> In order for this to work, netcat has to A) announce the port number it's
> working on (if it doesn't, dynamically allocating a "listen" port is
> completely useless), B) daemonize itself so the $() doesn't block until netcat
> exits, and thus never return to allow the result to be _used_.
>
> The new netcat spits out debugging info for -v, which seems kind of useless
> (it doesn't do B above at all, and you have to pipe it through sed to get
> machine readable info out of the debug dump for A).
>
> What was the advantage of throwing out the existing code here, exactly?  (I
> was thinking it might be a size issue, but although I haven't got 'em both
> built to compare object sizes, the old one right before the change was 197
> lines of code, the new one was 199 lines of code and did less.)

There is original nc-1.10 in the wild.


There are also a GNU nc,
which (surprise) is not exactly command line compatible:

http://sourceforge.net/tracker/index.php?func=detail&aid=1763649&group_id=52204&atid=466046
$ nc -lvnp 31000 127.0.0.1 > x
nc: cannot use -p and -l


There is also a BSD clone, with YET ANOTHER slightly incompatible
command line:

# nc -l -p 12345
usage: nc [-46DdhklnrStUuvzC] [-i interval] [-p source_port]
          [-s source_ip_address] [-T ToS] [-w timeout] [-X proxy_version]
          [-x proxy_address[:port]] [hostname] [port[s]]


Do we really want to have a FOURTH one?


I do see the reason behind extending and improving things,
but this needs to be done carefully.

By now, nc situation basically requires review of three
manpages, along with guessing how big the user base of each variant,
and then trying to find a common superset.

If only frantic coders on all sides would stop frantically coding
(ok, I'll settle for "slow down coding")
and think about compatibility a bit...

If you want DESKTOP nc to gain -f, -l -l, and other quirks
of non-DESKTOP one, and/or if you want a dedicated
option to enable this (instead of blanket DESKTOP),
lets discuss it.
--
vda
_______________________________________________
busybox mailing list
[email protected]
http://lists.busybox.net/mailman/listinfo/busybox

Reply via email to