netstat command returns nozero even if successively executing

Bug #1251563 reported by Vincent Hsu on 2013-11-15
18
This bug affects 2 people
Affects Status Importance Assigned to Milestone
net-tools (Debian)
Fix Released
Unknown
net-tools (Ubuntu)
High
Unassigned
Trusty
Undecided
Unassigned

Bug Description

for example:
in Ubuntu
     $ netstat -s 1>/dev/null 2>&1 ; echo $?
     1
in CentOS
     $ netstat -s 1>/dev/null 2>&1 ; echo $?
     0

My test environment is Ubuntu 12.04.03. "-s" is a existing argument to netstat, so it should be executed successively and return zero.

Serge Hallyn (serge-hallyn) wrote :

This seems to be done intentionally by the patch

debian/patches/netstat.c-assorted_changes.patch

It explicitly changes exit(0) to exit(1) at the end of flag_sta handling. I have no idea why.

Changed in net-tools (Ubuntu):
status: New → Triaged
importance: Undecided → High
Serge Hallyn (serge-hallyn) wrote :

This bug also exists in the debian package, so it should be reported against debian.

Please let me know if you prefer that I open the debian bug, or if you'd like to do it yourself then link this bug to the debian one.

This is Debian Bug #541172 [1].

There's a patch available there at message #15 [2], but it didn't make into the package.
It fixes the problem.

Unfortunately it seems there's some issue contacting the package maintainers,
given that bug's age. I tried to help there.

[1] https://bugs.debian.org/541172
[2] https://bugs.debian.org/cgi-bin/bugreport.cgi?msg=15;filename=netstat.c.patch;att=1;bug=541172

Meanwhile, is it possible to carry that patch in the Ubuntu package?

This is the patch/debdiff for that, on top of the current source package in Trusty.

Meanwhile, is it possible to carry that patch in the Ubuntu package?

This is the patch/debdiff for that, on top of the current source package in Trusty.

This has been fixed on the Debian package net-tools version 1.60-26, May 12th 2014.

https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=541172

The attachment "net-tools_1.60-25ubuntu2.1.debdiff" seems to be a debdiff. The ubuntu-sponsors team has been subscribed to the bug report so that they can review and hopefully sponsor the debdiff. If the attachment isn't a patch, please remove the "patch" flag from the attachment, remove the "patch" tag, and if you are member of the ~ubuntu-sponsors, unsubscribe the team.

[This is an automated message performed by a Launchpad user owned by ~brian-murray, for any issue please contact him.]

tags: added: patch
James Page (james-page) wrote :

net-tools needs to be merged into Utopic before we can proceed with any SRU activity.

Changed in net-tools (Debian):
status: Unknown → Fix Released
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package net-tools - 1.60-26ubuntu1

---------------
net-tools (1.60-26ubuntu1) utopic; urgency=low

  * Merge from Debian unstable (LP: #1251563). Remaining changes:
    - Ubuntu_unit_conversion.patch:
      + Ubuntu Policy: output using standard SI unit multiples:
        KB (10^3), MB (10^6), GB (10^9), TB (10^12) and PB (10^15).
        Includes manpage update to remove comment about IEC units.
    - Update Bug#254243-netstat.c-wide-opt.patch:
      + Increase size of remote and local address buffers 64->128.
    - Make the package Multi-Arch: foreign.
  * Dropped overlapping changes in Bug#254243-netstat.c-wide-opt.patch with:
    - Bug#508110-inet6.c-initialize_fields.patch
    - Bug#632660-netstat.c-long_udp6_addr.patch

net-tools (1.60-26) unstable; urgency=low

  * Fix wrong exit codes in netstat.c, closes: #541172.
  * Add patch to stop buffer overflows in route -6. Closes: #747006.
  * Add patch to fix wide display for long udp and raw addresses.
    Closes: #632660.
  * Add patch to fix mishandling of 64bit integers in netstat -s.
    Closes: #561161.
  * Add patch to fix printing of uninitialised ipv6 data in netstat.
    Closes: #508110.
  * debian/control: Add ${misc:Depends}, remove 'the' from description.
  * debian/rules: Add missing build-arch and build-indep targets.
 -- James Page <email address hidden> Mon, 30 Jun 2014 12:10:24 +0100

Changed in net-tools (Ubuntu):
status: Triaged → Fix Released
Chris J Arges (arges) wrote :

Here is an updated patch with some changes from the original. Sponsoring this.

Hello Vincent, or anyone else affected,

Accepted net-tools into trusty-proposed. The package will build now and be available at http://launchpad.net/ubuntu/+source/net-tools/1.60-25ubuntu2.1 in a few hours, and then in the -proposed repository.

Please help us by testing this new package. See https://wiki.ubuntu.com/Testing/EnableProposed for documentation how to enable and use -proposed. Your feedback will aid us getting this update out to other Ubuntu users.

If this package fixes the bug for you, please add a comment to this bug, mentioning the version of the package you tested, and change the tag from verification-needed to verification-done. If it does not fix the bug for you, please add a comment stating that, and change the tag to verification-failed. In either case, details of your testing will help us make a better decision.

Further information regarding the verification process can be found at https://wiki.ubuntu.com/QATeam/PerformingSRUVerification . Thank you in advance!

Changed in net-tools (Ubuntu Trusty):
status: New → Fix Committed
tags: added: verification-needed

Hi Chris,

The package in -proposed fixed this bug.

Test-case from description. Details below.

 root@ubuntu:~# apt-cache madison net-tools
  net-tools | 1.60-25ubuntu2.1 | http://ports.ubuntu.com/ubuntu-ports/ trusty-proposed/main ppc64el Packages
 [...]

 root@ubuntu:~# apt-get install net-tools
 [...]
 Get:1 http://ports.ubuntu.com/ubuntu-ports/ trusty-proposed/main net-tools ppc64el 1.60-25ubuntu2.1 [172 kB]
 [...]

 root@ubuntu:~# dpkg -s net-tools | grep ^Version:
 Version: 1.60-25ubuntu2.1

 root@ubuntu:~# netstat -s 1>/dev/null 2>&1 ; echo $?
 0

tags: added: verification-done
removed: verification-needed
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package net-tools - 1.60-25ubuntu2.1

---------------
net-tools (1.60-25ubuntu2.1) trusty; urgency=medium

  * Fix "netstat -s passes but returns 1". (LP: #1251563)
 -- Mauricio Faria de Oliveira <email address hidden> Thu, 03 Jul 2014 11:38:50 -0500

Changed in net-tools (Ubuntu Trusty):
status: Fix Committed → Fix Released

The verification of the Stable Release Update for net-tools has completed successfully and the package has now been released to -updates. Subsequently, the Ubuntu Stable Release Updates Team is being unsubscribed and will not receive messages about this bug report. In the event that you encounter a regression using the package from -updates please report a new bug using ubuntu-bug and tag the bug report regression-update so we can easily find any regressions.

To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Duplicates of this bug

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.