hwdb-gui hangs if there's no default network route.

Bug #18283 reported by Ralph Corderoy
8
Affects Status Importance Assigned to Milestone
hwdb-client (Ubuntu)
Confirmed
Medium
Oliver Grawert

Bug Description

/usr/bin/hwdb-gui's getroute() doesn't cope with

    $ route -n
    Kernel IP routing table
    Destination Gateway Genmask Flags Metric Ref Use Iface
    $

as my machine has. It changes the title to `Network test' but the `Is
your mouse working properly?' caption remains from the previous one.
The program then apparently hangs.

Starting it from the command line gives a trace-back.

    $ hwdb-gui
    cat: /proc/asound/card0/id: No such file or directory
    Traceback (most recent call last):
      File "/tmp/hwdb-gui", line 126, in <lambda>
        self.advance.connect("clicked", lambda w: self.adv(self.xmlfile))
      File "/tmp/hwdb-gui", line 563, in adv
        self.test(set)
      File "/tmp/hwdb-gui", line 166, in test
        netdevice = self.getroute()[len(self.getroute())-1].strip()
      File "/tmp/hwdb-gui", line 214, in getroute
        return route
    UnboundLocalError: local variable 'route' referenced before assignment

The problem is `route' has no value unless route(8)'s output has a
default route.

    def getroute(self):
        for line in os.popen('route -n'):
                if line.startswith('0.0.0.0'):
                        route = string.splitfields(line, ' ')
        return route

Also, note the unrelated error from cat(1) at the start of the output.

Revision history for this message
Ralph Corderoy (ralph-inputplus) wrote :

Sorry, I disagree this bug is a dupe of 18125. That bug is to do with the route command not being found in the user's PATH. This bug is about route being run correctly, but hwdb-gui not parsing the valid, correct, output of no routes being present.

Revision history for this message
Oliver Grawert (ogra) wrote :

please see the last comment on 18125. its a general problem with the error handling in the route code that needs to be rewritten, this bug belongs into this same category

Revision history for this message
Ralph Corderoy (ralph-inputplus) wrote :

Still present in Dapper, 6.06. Definition of getroute() hasn't changed in hwdb-client-0.6.

Changed in hwdb-client:
status: Unconfirmed → Confirmed
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

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