#1536 closed defect

nicely report any errors involving finding and using ifconfig — at Version 6

Reported by: zooko Owned by: zooko
Priority: major Milestone: 1.15.0
Component: code-network Version: 1.9.0a1
Keywords: error pyutil iputil archlinux transparency review Cc:
Launchpad Bug:

Description (last modified by zooko)

A couple of users have recently reported errors from iputil when it couldn't find their ifconfig executable, e.g.:

[Failure instance: Traceback: <type 'exceptions.OSError'>: [Errno 2] No such file or directory
/usr/lib/python2.7/threading.py:525:__bootstrap
/usr/lib/python2.7/threading.py:552:__bootstrap_inner
/usr/lib/python2.7/threading.py:505:run
- --- <exception caught here> ---
/usr/lib/python2.7/site-packages/twisted/python/threadpool.py:207:_worker
/usr/lib/python2.7/site-packages/twisted/python/context.py:118:callWithContext
/usr/lib/python2.7/site-packages/twisted/python/context.py:81:callWithContext
/home/kytv/tahoe/allmydata-tahoe-1.8.3/src/allmydata/util/iputil.py:222:_synchronously_find_addresses_via_config
/home/kytv/tahoe/allmydata-tahoe-1.8.3/src/allmydata/util/iputil.py:236:_query
/usr/lib/python2.7/subprocess.py:679:__init__
/usr/lib/python2.7/subprocess.py:1228:_execute_child
]
calling os.abort()

We should catch this exception and report a useful error message, saying what the sys.platform was and asking them to report about their ifconfig, like David-Sarah did on the list:

which ifconfig
ifconfig --help
ifconfig

Change History (6)

comment:1 Changed at 2011-09-15T20:26:49Z by Brian Warner <warner@…>

In 8e69b94588c1c0e7:

Make platform-detection code tolerate linux-3.0, patch by zooko.

Otherwise address-autodetection can't find ifconfig. refs #1536

comment:2 Changed at 2011-09-15T23:16:17Z by davidsarah

Re: 8e69b94588c1c0e7, I would be tempted to use .startswith('linux') and .startswith('irix'), rather than testing for more specific strings.

Last edited at 2011-09-15T23:17:11Z by davidsarah (previous) (diff)

comment:3 in reply to: ↑ description Changed at 2011-09-16T05:27:50Z by killyourtv

comment:4 Changed at 2011-09-28T15:01:13Z by zooko

  • Owner set to zooko
  • Status changed from new to assigned

comment:5 Changed at 2012-10-05T14:07:27Z by mk.fg

I've just created pull request (#14) on github with a simple patch to use $PATH to find ifconfig. A few questions that went through my mind during that process:

  • Is there any particular reason why it's ($PATH) used only on windows?
  • Why OS-native path resolution mechanics (which Popen() will use through os.execvp()) are overidden with twisted which() util?

I considered adding optional iproute2 support, as suggested above (and indeed, net-tools are deprecated in many distros), but I think it's a wrong way to do it - iproute2 docs clearly state that it's output is a subject to change (and it's usually updated once per kernel release) and is not designed to be parseable, so maybe some specialized netlink module should be used on linux instead?

Last edited at 2012-10-05T14:14:24Z by mk.fg (previous) (diff)

comment:6 Changed at 2013-05-27T17:07:44Z by zooko

  • Description modified (diff)

Hi mk.fg! I was just investigating related bugs and I discovered this comment you added to this ticket. I'm sorry I didn't see it when you first posted it! I need to get more reliable monitoring of updates to trac+github...

Note: See TracTickets for help on using tickets.