[tor-commits] [stem/master] Catching unexpected exception from libc.setproctitle()
atagar at torproject.org
atagar at torproject.org
Mon Feb 18 15:44:12 UTC 2013
commit 13de78a989b4e9ba68ffcecdd6022335baae4b39
Author: Damian Johnson <atagar at torproject.org>
Date: Mon Feb 18 07:42:46 2013 -0800
Catching unexpected exception from libc.setproctitle()
Sathyanarayanan reports that on OSX libc.setproctitle() can raise an
AttributeError...
ERROR: test_set_process_name
----------------------------------------------------------------------
Traceback:
File "/Users/sathya/Documents/stem/test/integ/util/system.py", line 412, in test_set_process_name
stem.util.system.set_process_name(initial_name)
File "/Users/sathya/Documents/stem/stem/util/system.py", line 774, in set_process_name
_set_proc_title(process_name)
File "/Users/sathya/Documents/stem/stem/util/system.py", line 831, in _set_proc_title
libc.setproctitle(ctypes.byref(name_buffer))
File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/ctypes/__init__.py", line 366, in __getattr__
func = self.__getitem__(name)
File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/ctypes/__init__.py", line 371, in __getitem__
func = self._FuncPtr((name_or_ordinal, self))
AttributeError: dlsym(0x7fff6a41d1e0, setproctitle): symbol not found
https://trac.torproject.org/8266
---
stem/util/system.py | 9 ++++++++-
1 files changed, 8 insertions(+), 1 deletions(-)
diff --git a/stem/util/system.py b/stem/util/system.py
index 0a42881..688475f 100644
--- a/stem/util/system.py
+++ b/stem/util/system.py
@@ -828,4 +828,11 @@ def _set_proc_title(process_name):
libc = ctypes.CDLL(ctypes.util.find_library("c"))
name_buffer = ctypes.create_string_buffer(len(process_name) + 1)
name_buffer.value = process_name
- libc.setproctitle(ctypes.byref(name_buffer))
+
+ try:
+ libc.setproctitle(ctypes.byref(name_buffer))
+ except AttributeError:
+ # Possible issue (seen on OSX):
+ # AttributeError: dlsym(0x7fff6a41d1e0, setproctitle): symbol not found
+
+ pass
More information about the tor-commits
mailing list