netcat-openbsd exits too soon
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
netcat-openbsd (Ubuntu) |
Fix Released
|
Wishlist
|
Canonical Server | ||
Natty |
Fix Released
|
Wishlist
|
Canonical Server |
Bug Description
netcat-openbsd's -q setting defaults to 0. This means that as soon as stdin is closed, it will terminate.
For instance, this manifests itself by giving no output used like this:
$ printf 'GET / HTTP/1.0\r\n\r\n' | nc www.google.com 80
because printf terminates, causing nc to terminate before Google responds.
However, running nc without the pipe and typing the GET request works.
netcat-traditional defaults to not quitting on stdin closing (ie a default value of -1).
The original netcat from OpenBSD does not have a -q option if I (Soren) remember correctly and behaves similarly to netcat-traditional.
netcat-openbsd in Debian is not affected either, since this is caused by a patch carried by Ubuntu (which I honestly forget whether I wrote or took from Fedora (it's been more than two years)).
This default value, FWIW, was chosen because libvirt (at least at the time) would do something like "ssh somehost nc -U /var/lib/
summary: |
- netcat-openbsd stdout broken on Ubuntu + netcat-openbsd exits too soon |
tags: | added: glucid |
I can confirm this bug.
This bug affects Lucid and also Karmic (and most likely Jaunty and Intrepid, because the package version is the same).