IPv6 functionality in ip_ plugin assumse #!/bin/sh being bash

Bug #713646 reported by Andreas Olsson on 2011-02-05
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
munin
Fix Released
Unknown
munin (Debian)
Fix Released
Unknown
munin (Ubuntu)
Low
Unassigned

Bug Description

Binary package hint: munin

The ip_ plugin in 1.4.5-3ubuntu2 fails to handle IPv6 addresses when /bin/sh is being linked to dash.

Ways to reproduce, assuming the local IPv6 address being 2001:16d8:cc88:0:223:aeff:feb1:b64.

root@stilgar:~# ip6tables -I OUTPUT -s 2001:16d8:cc88:0:223:aeff:feb1:b64
root@stilgar:~# ip6tables -I INPUT -d 2001:16d8:cc88:0:223:aeff:feb1:b64
root@stilgar:~# ln -s /usr/share/munin/plugins/ip_ /etc/munin/plugins/ip_2001:16d8:cc88:0:223:aeff:feb1:b64
root@stilgar:~# ls -l /bin/sh
lrwxrwxrwx 1 root root 4 2011-02-05 14:34 /bin/sh -> dash
export MUNIN_LIBDIR=/usr/share/munin
root@stilgar:~# /etc/munin/plugins/ip_2001\:16d8\:cc88\:0\:223\:aeff\:feb1\:b64
eval: 1: Syntax error: "(" unexpected
root@stilgar:~# ln -sf /bin/bash /bin/sh
root@stilgar:~# /etc/munin/plugins/ip_2001\:16d8\:cc88\:0\:223\:aeff\:feb1\:b64
in.value 239782
out.value 102625
root@stilgar:~#

This being where the problem arise

case $IP in
    *:*) # I know this! This is IPv6!
        # This is a fun hack to make the plugin ip6 compatible.
        # Suggested in ticket #439 by "jodal".
        eval 'function iptables() {
            /sbin/ip6tables "$@"
        }'
        ;;
esac

ProblemType: Bug
DistroRelease: Ubuntu 11.04
Package: munin-node 1.4.5-3ubuntu2
ProcVersionSignature: Ubuntu 2.6.38-1.28-generic 2.6.38-rc2
Uname: Linux 2.6.38-1-generic x86_64
Architecture: amd64
Date: Sat Feb 5 14:21:56 2011
InstallationMedia: Ubuntu 11.04 "Natty Narwhal" - Alpha amd64 (20110201.2)
PackageArchitecture: all
ProcEnviron:
 SHELL=/bin/bash
 PATH=(custom, user)
 LC_MESSAGES=sv_SE.utf8
 LANG=sv_SE.UTF-8
 LANGUAGE=sv_SE:sv:en_GB:en
SourcePackage: munin

Related branches

Andreas Olsson (andol) wrote :
Andreas Olsson (andol) wrote :

Marking the bug as triaged, given that it has both been confirmed and fixed upstream. The fix, making the plugin explicitly use bash, has been committed to svn and is scheduled to be part of munin 1.4.6.

Changed in munin (Ubuntu):
status: New → Triaged
importance: Undecided → Low
Changed in munin:
status: Unknown → Fix Released
Changed in munin (Debian):
status: Unknown → New
Daniel Hahler (blueyed) wrote :

The proper fix would be to remove the bashism "function", and define the function as:
  iptables() {
      /sbin/ip6tables "$@"
  }

Apart from that, I cannot see why it uses eval here - the original suggestion in ticket #439 by "jodal" did not do so.
I will bring this up in the upstream tracker, but I cannot login there currently.

Daniel Hahler (blueyed) wrote :

The proper fix would be to remove the bashism "function", and define the function as:
  iptables() {
      /sbin/ip6tables "$@"
  }

I have left a comment at the upstream ticket: http://munin-monitoring.org/ticket/1009#comment:2

Changed in munin:
status: Fix Released → New
Changed in munin (Debian):
status: New → Confirmed
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package munin - 1.4.5-3ubuntu4

---------------
munin (1.4.5-3ubuntu4) natty; urgency=low

  * debian/patches/upstream_bug_1009.patch: Backport
    ipv6 patch. (LP: #713646)
 -- Chuck Short <email address hidden> Tue, 05 Apr 2011 14:57:44 -0400

Changed in munin (Ubuntu):
status: Triaged → Fix Released
Changed in munin (Debian):
status: Confirmed → Fix Released
Changed in munin:
status: New → Fix Released
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers

Remote bug watches

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