nicely report any errors involving finding and using ifconfig #1536

Closed
opened 2011-09-15 17:44:04 +00:00 by zooko · 12 comments

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
A couple of users have recently [reported](http://tahoe-lafs.org/pipermail/tahoe-dev/2011-September/006676.html) errors from [iputil](http://tahoe-lafs.org/trac/tahoe-lafs/browser/trunk/src/allmydata/util/iputil.py?annotate=blame&rev=4971#L177) 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](http://tahoe-lafs.org/pipermail/tahoe-dev/2011-September/006677.html) on the list: ``` which ifconfig ifconfig --help ifconfig ```
zooko added the
code-network
major
defect
1.9.0a1
labels 2011-09-15 17:44:04 +00:00
zooko added this to the undecided milestone 2011-09-15 17:44:04 +00:00
Brian Warner <warner@lothar.com> commented 2011-09-15 20:26:49 +00:00
Owner

In changeset:8e69b94588c1c0e7:

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

Otherwise address-autodetection can't find ifconfig. refs #1536
In changeset:8e69b94588c1c0e7: ``` Make platform-detection code tolerate linux-3.0, patch by zooko. Otherwise address-autodetection can't find ifconfig. refs #1536 ```
davidsarah commented 2011-09-15 23:16:17 +00:00
Owner

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

Re: changeset:8e69b94588c1c0e7, I would be tempted to use `.startswith('linux')` and `.startswith('irix')`, rather than testing for more specific strings.
killyourtv commented 2011-09-16 05:27:50 +00:00
Owner

(https://bbs.archlinux.org/viewtopic.php?pid=945602#p945602) &
http://www.archlinux.org/news/deprecation-of-net-tools/

Apparently Arch deprecated ifconfig and "ip addr" is supposed to be
used.

(https://bbs.archlinux.org/viewtopic.php?pid=945602#p945602) & <http://www.archlinux.org/news/deprecation-of-net-tools/> Apparently Arch deprecated ifconfig and "ip addr" is supposed to be used.
zooko self-assigned this 2011-09-28 15:01:13 +00:00
mk.fg commented 2012-10-05 14:07:27 +00:00
Owner

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?

I've just created [pull request (#14) on github](https://github.com/tahoe-lafs/tahoe-lafs/pull/14) 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?
Author

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...

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...
Author

See #1988.

See #1988.
Daira Hopwood <david-sarah@jacaranda.org> commented 2013-06-25 18:15:57 +00:00
Owner

In /tahoe-lafs/trac-2024-07-25/commit/a493ee0bb641175ecf918e28fce4d25df15994b6:

iputil.py: add tests for recent changes. refs #1381, #1988, #982, #1064, #1536, #1935, #898, #1707, #1918

Signed-off-by: Daira Hopwood <david-sarah@jacaranda.org>
In [/tahoe-lafs/trac-2024-07-25/commit/a493ee0bb641175ecf918e28fce4d25df15994b6](/tahoe-lafs/trac-2024-07-25/commit/a493ee0bb641175ecf918e28fce4d25df15994b6): ``` iputil.py: add tests for recent changes. refs #1381, #1988, #982, #1064, #1536, #1935, #898, #1707, #1918 Signed-off-by: Daira Hopwood <david-sarah@jacaranda.org> ```
tahoe-lafs modified the milestone from undecided to 1.11.0 2015-04-01 16:51:49 +00:00

Milestone renamed

Milestone renamed
warner modified the milestone from 1.11.0 to 1.12.0 2016-03-22 05:02:52 +00:00

moving most tickets from 1.12 to 1.13 so we can release 1.12 with magic-folders

moving most tickets from 1.12 to 1.13 so we can release 1.12 with magic-folders
warner modified the milestone from 1.12.0 to 1.13.0 2016-06-28 18:20:37 +00:00

Moving open issues out of closed milestones.

Moving open issues out of closed milestones.
exarkun modified the milestone from 1.13.0 to 1.15.0 2020-06-30 14:45:13 +00:00

(https://github.com/tahoe-lafs/tahoe-lafs/pull/872) removes use of ifconfig entirely

(https://github.com/tahoe-lafs/tahoe-lafs/pull/872) removes use of ifconfig entirely
zooko was unassigned by exarkun 2020-10-23 20:00:52 +00:00
pull 872 merged in <https://github.com/tahoe-lafs/tahoe-lafs/commit/25ee76104ad15e78b33a15643e330d2ec285dc89>
exarkun added the
fixed
label 2020-10-26 16:12:48 +00:00
Sign in to join this conversation.
No Milestone
No Assignees
4 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Reference: tahoe-lafs/trac-2024-07-25#1536
No description provided.