Ubuntu

hwdb raises Exception when looking up route

Reported by sebas on 2005-06-14
102
Affects Status Importance Assigned to Milestone
hwdb-client (Ubuntu)
Medium
Unassigned

Bug Description

When running hwdb-gui, at the networking part, hwdb-gui is unable to find route
because it's not in the current path:

miro.sebas(~): /usr/bin/hwdb-gui

sh: route: command not found
Traceback (most recent call last):
  File "/usr/bin/hwdb-gui", line 122, in <lambda>
    self.advance.connect("clicked", lambda w: self.adv(self.xmlfile))
  File "/usr/bin/hwdb-gui", line 557, in adv
    self.test(set)
  File "/usr/bin/hwdb-gui", line 162, in test
    netdevice = self.getroute()[len(self.getroute())-1].strip()
  File "/usr/bin/hwdb-gui", line 208, in getroute
    return route
UnboundLocalError: local variable 'route' referenced before assignment

The following patch fixes it:

--- hwdb-gui.orig 2005-06-14 14:22:00.410016528 +0200
+++ hwdb-gui 2005-06-14 14:21:25.889264480 +0200
@@ -201,7 +201,7 @@
                return

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

Oliver Grawert (ogra) wrote :

are you sure you are running a default ubuntu ? /sbin and /usr/sbin should
always be in the default path of every user. but thanks for the patch, i'll
apply it to the next version, once all missing HAL bits are in breezy to make it
run properly.

sebas (sebasje) wrote :

Quite the opposite, actually. I'm using zsh, not having /sbin in my path (prefer
not to). However, the patch is a no-brainer since pretty much ervery system I
saw to date has route in /sbin whereas I saw lots of systems that don't have
/sbin in their default pathes. Checking if a binary exists in the current path
would probably be more useful, but this one might do aswell.

Thanks anyway.

Oliver Grawert (ogra) wrote :

its definately independent from your path setting a bug in hwdb to require it at all. indications from other bug reports show that it also fails if no route is set at all. hwdb will need bettter error handling here.

Changed in hwdb-client:
status: Unconfirmed → Confirmed

Another bunch of bugs have just been made a duplicate of this one, just like the bug I raised: bug #18283. Like mine, they give a better report on what the problem is than this red herring of /sbin not being in PATH. If anyone fancies a crack at fixing this, please see bug #18283 and the others for a better clue as to the problem.

sebas (sebasje) wrote :

It works now.

Changed in hwdb-client:
status: Confirmed → Fix Released

Hi Sebas,

Do you mean that your original problem that you identified as related to PATH is no longer happening. Or do you mean that all the other issues in the bugs that have been marked as a duplicate of this one have been fixed, e.g. bug #18283.

Cheers, Ralph.

On Wednesday 11 April 2007 12:33:06 Ralph Corderoy wrote:
> Do you mean that your original problem that you identified as related to
> PATH is no longer happening. Or do you mean that all the other issues
> in the bugs that have been marked as a duplicate of this one have been
> fixed, e.g. bug #18283.

hwdb has no problems finding /sbin/route on my system. I've not looked at the
other bugs (which should be separate issues then anyway?).
--
sebas

 http://www.kde.org | http://vizZzion.org | GPG Key ID: 9119 0EF9
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
They that can give up essential liberty to obtain a little temporary safety
deserve neither liberty nor safety. - Benjamin Franklin, 1759

This bug isn't fixed. It would have been but too many other bugs have
wrongly been made a duplicate of it when they have a separate fault that
needs fixing. We're now in the confusing situation where sebas
reasonably thinks the bug is fixed because the fault he reported has
gone, whereas I know this separate other bug, that needs a different
fix, is still present.

I've analysed this bug and the others that have been marked as
duplicates.

    #18125 sebas doesn't have /sbin in PATH so route(8) not found.
    #20269 Matt MacLeod doesn't have /sbin in PATH so route(8) not found.

    #18283 Ralph Corderoy diagnoses empty `route -n' output cause.
    #33492 DaneM diagnoses empty `route -n' output cause.
    #48535 bailey diagnoses empty `route -n' output cause.
    #85322 Stephen Drake suffers from empty `route -n' output.
    #85866 jmdennis diagnoses empty `route -n' output cause.
    #92174 neuromancer suffers from empty `route -n' output.

I think bug #20269 is the only duplicate of this bug since that too is
to do with route(8) being in /sbin.

The other six bugs are all duplicates of my bug #18283 and should be
altered to reflect this. They are all caused by `route -n' not
outputing a gateway 0.0.0.0 route, as it is allowed to do.

To leave the last six bugs above as duplicates of this bug is wrong,
misleading, has no obvious benefit, and stops them having separate
priorities. This bug is an issue with who is responsible with route(8)
being found, hwdb-gui or PATH, the other is an application issue of what
to do if there's no default route.

Can someone with the appropriate powers please alter bug #18283 to not
be a duplicate of this bug, and then alter bug #33492, bug #48535,
bug #85322, bug #85866, and bug #92174 to be duplicates of bug #18283.

Thanks, Ralph.

Changed in hwdb-client:
status: Fix Released → Confirmed

In bug #18283 Oliver Grawert says "its a general problem with the error handling in the route code that needs to be rewritten". Perhaps the route code does need to be re-written but most people are getting bit by one specific instance, that of `route -n' not outputting a default root; see bug #18283 for details. Therefore, it would seem better to make an easier fix just to solve that problem, leaving the re-write to the back-burner, or never if no bugs come along that are caused by the route code's error handling.

Is a patch that fixes this one aspect welcome?

Oliver Grawert (ogra) on 2009-06-25
Changed in hwdb-client (Ubuntu):
assignee: Oliver Grawert (ogra) → nobody

Thank you for your time and consideration in this matter.

Does this issue occur in Lucid?

Changed in hwdb-client (Ubuntu):
status: Confirmed → Incomplete
sebas (sebasje) wrote :

On Tuesday, September 14, 2010 21:31:01 rusivi1 wrote:
> Thank you for your time and consideration in this matter.
>
> Does this issue occur in Lucid?
>
> ** Changed in: hwdb-client (Ubuntu)
> Status: Confirmed => Incomplete

I don't know, moved on long since. Probably best is to test it yourself, and
if it's not an issue anymore, just close this bug.

Thanks for caring, though!
--
sebas

http://www.kde.org | http://vizZzion.org | GPG Key ID: 9119 0EF9

This package was removed from Hardy 8.04 and all future versions of Ubuntu to date. Therefore this bug is being closed. Without this package, this is no longer an issue.

Changed in hwdb-client (Ubuntu):
status: Incomplete → Invalid

The code is still in 8.04, the package is now called hwdb-client-gnome. The code still has the fault of not coping with `route -n' returning nothing. hwdb-client-gnome 0.6.14.

$ sed -n '/def getroute/,/^$/p' /usr/bin/hwdb-gui
    def getroute(self):
 for line in os.popen('route -n'):
  if line.startswith('0.0.0.0'):
   route = string.splitfields(line, ' ')
 return route

$

Changed in hwdb-client (Ubuntu):
status: Invalid → Confirmed
Phillip Susi (psusi) wrote :

The hwdb-client package has been removed from Ubuntu. Closing all related bugs.

Changed in hwdb-client (Ubuntu):
status: Confirmed → Invalid
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.