[issue747] fcntl.lockf() is broken with (fcntl.LOCK_EX | fcntl.LOCK_NB)
New submission from Nirbheek Chauhan <nirbheek.chauhan@gmail.com>: While trying to lock a file with a pre-existing lock on it, lockf() doesn't raise EACCESS, and just silently returns instead. This behaviour is both wrong, and inconsistent with PyPy's flock() behaviour, and CPython's lockf() and flock() behaviour. The script attached should demonstrate the problem. Run it under CPython, and it'll exit fine, execute with PyPy, and it fails. Replace fcntl.lockf with fcntl.flock and it works fine again. ---------- files: test_lock_nonblock.py messages: 2621 nosy: nirbheek, pypy-issue priority: bug release: 1.5 status: unread title: fcntl.lockf() is broken with (fcntl.LOCK_EX | fcntl.LOCK_NB) ________________________________________ PyPy bug tracker <tracker@bugs.pypy.org> <https://bugs.pypy.org/issue747> ________________________________________
Radu Voicilas <radu.voicilas@gmail.com> added the comment: I can confirm that this is happening. I tried to see why it is happening, but I didn't get to any resolution. As far as I can tell, this seems to be happening with fcntl.flock() as well, when the platform running has no C flock. ---------- nosy: +rvoicilas status: unread -> chatting ________________________________________ PyPy bug tracker <tracker@bugs.pypy.org> <https://bugs.pypy.org/issue747> ________________________________________
Radu Voicilas <radu.voicilas@gmail.com> added the comment: I've made some changes to the interp_fcntl.py that would help nail this problem down. You can pull the changes from https://bitbucket.org/rvoicilas/pypy (especially commit 6f93f08b59a6). ________________________________________ PyPy bug tracker <tracker@bugs.pypy.org> <https://bugs.pypy.org/issue747> ________________________________________
Vetoshkin Nikita <nikita.vetoshkin@gmail.com> added the comment: This tests passes on latest checkout under py.py ---------- nosy: +nekto0n ________________________________________ PyPy bug tracker <tracker@bugs.pypy.org> <https://bugs.pypy.org/issue747> ________________________________________
Nirbheek Chauhan <nirbheek.chauhan@gmail.com> added the comment: I can verify that with 1.7 this test no longer fails and the issue has been resolved, thanks! (I hope I closed the bug properly) ---------- status: chatting -> resolved ________________________________________ PyPy bug tracker <tracker@bugs.pypy.org> <https://bugs.pypy.org/issue747> ________________________________________
Nirbheek Chauhan <nirbheek.chauhan@gmail.com> added the comment: Err, I checked the wrong test here. This test case still fails with 1.7, reopening... ---------- release: 1.5 -> 1.7 status: resolved -> chatting ________________________________________ PyPy bug tracker <tracker@bugs.pypy.org> <https://bugs.pypy.org/issue747> ________________________________________
bdk <bdkearns@gmail.com> added the comment: still broken in nightly ---------- nosy: +bdk ________________________________________ PyPy bug tracker <tracker@bugs.pypy.org> <https://bugs.pypy.org/issue747> ________________________________________
Armin Rigo <armin.rigo@gmail.com> added the comment: Fixed in c1024ee7bb9c. Thanks bdk! ---------- nosy: +arigo status: chatting -> resolved ________________________________________ PyPy bug tracker <tracker@bugs.pypy.org> <https://bugs.pypy.org/issue747> ________________________________________
participants (5)
-
Armin Rigo
-
bdk
-
Nirbheek Chauhan
-
Radu Voicilas
-
Vetoshkin Nikita