4udak / pyftpdlib

Automatically exported from code.google.com/p/pyftpdlib
Other
1 stars 1 forks source link

pyftpdlib-1.2.0 doesn't work on OpenBSD #272

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
OS: OpenBSD
Python: 2.7.5 and 3.3
pyftplib: 1.2.0

pyftplib uses the multiprocessing module of python. Some parts of this module 
don't work on OpenBSD due to the lack of some semaphore functionality.

$ python2.7 -m pyftpdlib                                             
Traceback (most recent call last):
  File "/usr/local/lib/python2.7/runpy.py", line 162, in _run_module_as_main
    "__main__", fname, loader, pkg_name)
  File "/usr/local/lib/python2.7/runpy.py", line 72, in _run_code
    exec code in run_globals
  File "/usr/local/lib/python2.7/site-packages/pyftpdlib/__main__.py", line 45, in <module>
    from pyftpdlib.servers import FTPServer
  File "/usr/local/lib/python2.7/site-packages/pyftpdlib/servers.py", line 521, in <module>
    class MultiprocessFTPServer(_SpawnerBase):
  File "/usr/local/lib/python2.7/site-packages/pyftpdlib/servers.py", line 525, in MultiprocessFTPServer
    _lock = multiprocessing.Lock()
  File "/usr/local/lib/python2.7/multiprocessing/__init__.py", line 175, in Lock
    from multiprocessing.synchronize import Lock
  File "/usr/local/lib/python2.7/multiprocessing/synchronize.py", line 59, in <module>
    " function, see issue 3770.")
ImportError: This platform lacks a functioning sem_open implementation, 
therefore, the required synchroniz
ation primitives needed will not function, see issue 3770.

pyftplib 0.7 works OK. Can you modify pyftplib to work around of the OpenBSD 
problem?.

Original issue reported on code.google.com by juanfra...@gmail.com on 17 Sep 2013 at 1:54

GoogleCodeExporter commented 9 years ago
Can you try this and tell me if it works?

Index: servers.py
===================================================================
--- servers.py  (revision 1233)
+++ servers.py  (working copy)
@@ -518,6 +518,10 @@
 if os.name == 'posix':
     try:
         import multiprocessing
+        # Work around https://code.google.com/p/pyftpdlib/issues/detail?id=272
+        # on OpenBSD.
+        multiprocessing.Lock()
+        multiprocessing.Event()
     except ImportError:
         pass
     else:

Original comment by g.rodola on 24 Sep 2013 at 9:09

GoogleCodeExporter commented 9 years ago
Your patch fixes the problem. Thanks a lot!

Original comment by juanfra...@gmail.com on 24 Sep 2013 at 8:10

GoogleCodeExporter commented 9 years ago

Original comment by g.rodola on 6 Nov 2013 at 8:29

GoogleCodeExporter commented 9 years ago

Original comment by g.rodola on 8 Nov 2013 at 7:52

GoogleCodeExporter commented 9 years ago
Just for future reference, OpenBSD has now support for semaphores. The patch is 
only needed for version 5.4 and earlier.

Original comment by juanfra...@gmail.com on 5 Dec 2013 at 11:13