This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author Michael.Felt
Recipients Michael.Felt, vstinner
Date 2019-01-07.17:44:27
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <a605d463-9e09-bd0a-307c-372fde56113f@felt.demon.nl>
In-reply-to <1546872413.86.0.767569575645.issue35633@roundup.psfhosted.org>
Content
On 07/01/2019 15:46, STINNER Victor wrote:
> STINNER Victor <vstinner@redhat.com> added the comment:
>
> Since you are getting indentation error, I'm not sure about your test. Can you please apply the patch below and run again test_eintr? Does it still fail with PermissionError?

I was clearly a bit blind.. Now with:

  +490  class FNTLEINTRTest(EINTRBaseTest):
  +491      def _lock(self, lock_func, lock_name):
  +492          self.addCleanup(support.unlink, support.TESTFN)
  +493          code = '\n'.join((
  +494              "import fcntl, time",
  +495              "with open('%s', 'w+b') as f:" % support.TESTFN,
  +496              "   fcntl.%s(f, fcntl.LOCK_EX)" % lock_name,
  +497              "   time.sleep(%s)" % self.sleep_time))
  +498          start_time = time.monotonic()
  +499          proc = self.subprocess(code)
  +500          with kill_on_error(proc):
  +501              with open(support.TESTFN, 'w+b') as f:
  +502                  while True:  # synchronize the subprocess
  +503                      dt = time.monotonic() - start_time
  +504                      if dt > 60.0:
  +505                          raise Exception("failed to sync child in
%.1f sec" % dt)
  +506                      try:
  +507                          lock_func(f, fcntl.LOCK_EX | fcntl.LOCK_NB)
  +508                          lock_func(f, fcntl.LOCK_UN)
  +509                          time.sleep(0.01)
  +510                      except BlockingIOError:
  +511                          break

I get - PermissionError - as before.

root@x066:[/data/prj/python/python3-3.8]./python -m test -v test_eintr
== CPython 3.8.0a0 (heads/master-dirty:b4ea8bb080, Jan 1 2019, 18:24:36) [C]
== AIX-1-00C291F54C00-powerpc-32bit big-endian
== cwd: /data/prj/python/python3-3.8/build/test_python_3342514
== CPU count: 8
== encodings: locale=ISO8859-1, FS=iso8859-1
Run tests sequentially
0:00:00 [1/1] test_eintr
test_all (test.test_eintr.EINTRTests) ...
--- run eintr_tester.py ---
test_flock (__main__.FNTLEINTRTest) ... ok
test_lockf (__main__.FNTLEINTRTest) ... ERROR
test_read (__main__.OSEINTRTest) ... ok
test_wait (__main__.OSEINTRTest) ... ok
test_wait3 (__main__.OSEINTRTest) ... ok
test_wait4 (__main__.OSEINTRTest) ... ok
test_waitpid (__main__.OSEINTRTest) ... ok
test_write (__main__.OSEINTRTest) ... ok
test_devpoll (__main__.SelectEINTRTest) ... skipped 'need select.devpoll'
test_epoll (__main__.SelectEINTRTest) ... skipped 'need select.epoll'
test_kqueue (__main__.SelectEINTRTest) ... skipped 'need select.kqueue'
test_poll (__main__.SelectEINTRTest) ... ok
test_select (__main__.SelectEINTRTest) ... ok
test_sigtimedwait (__main__.SignalEINTRTest) ... ok
test_sigwaitinfo (__main__.SignalEINTRTest) ... ok
test_accept (__main__.SocketEINTRTest) ... ok
test_open (__main__.SocketEINTRTest) ... ok
test_os_open (__main__.SocketEINTRTest) ... ok
test_recv (__main__.SocketEINTRTest) ... ok
test_recvmsg (__main__.SocketEINTRTest) ... ok
test_send (__main__.SocketEINTRTest) ... ok
test_sendall (__main__.SocketEINTRTest) ... ok
test_sendmsg (__main__.SocketEINTRTest) ... ok
test_sleep (__main__.TimeEINTRTest) ... ok

======================================================================
ERROR: test_lockf (__main__.FNTLEINTRTest)
----------------------------------------------------------------------
Traceback (most recent call last):
  File
"/data/prj/python/git/python3-3.8/Lib/test/eintrdata/eintr_tester.py",
line 522, in test_lockf
    self._lock(fcntl.lockf, "lockf")
  File
"/data/prj/python/git/python3-3.8/Lib/test/eintrdata/eintr_tester.py",
line 507, in _lock
    lock_func(f, fcntl.LOCK_EX | fcntl.LOCK_NB)
PermissionError: [Errno 13] Permission denied

----------------------------------------------------------------------
Ran 24 tests in 9.098s

FAILED (errors=1, skipped=3)
--- eintr_tester.py completed: exit code 1 ---
FAIL

======================================================================
FAIL: test_all (test.test_eintr.EINTRTests)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/data/prj/python/git/python3-3.8/Lib/test/test_eintr.py", line
31, in test_all
    self.fail("eintr_tester.py failed")
AssertionError: eintr_tester.py failed

----------------------------------------------------------------------

Ran 1 test in 9.674s

FAILED (failures=1)
test test_eintr failed
test_eintr failed

== Tests result: FAILURE ==

>
> diff --git a/Lib/test/eintrdata/eintr_tester.py b/Lib/test/eintrdata/eintr_tester.py
> index 25c169bde5..4db5dc9045 100644
> --- a/Lib/test/eintrdata/eintr_tester.py
> +++ b/Lib/test/eintrdata/eintr_tester.py
> @@ -492,13 +492,13 @@ class FNTLEINTRTest(EINTRBaseTest):
>          self.addCleanup(support.unlink, support.TESTFN)
>          code = '\n'.join((
>              "import fcntl, time",
> -            "with open('%s', 'wb') as f:" % support.TESTFN,
> +            "with open('%s', 'w+b') as f:" % support.TESTFN,
>              "   fcntl.%s(f, fcntl.LOCK_EX)" % lock_name,
>              "   time.sleep(%s)" % self.sleep_time))
>          start_time = time.monotonic()
>          proc = self.subprocess(code)
>          with kill_on_error(proc):
> -            with open(support.TESTFN, 'wb') as f:
> +            with open(support.TESTFN, 'w+b') as f:
>                  while True:  # synchronize the subprocess
>                      dt = time.monotonic() - start_time
>                      if dt > 60.0:
>
> ----------
>
> _______________________________________
> Python tracker <report@bugs.python.org>
> <https://bugs.python.org/issue35633>
> _______________________________________
>
History
Date User Action Args
2019-01-07 17:44:28Michael.Feltsetrecipients: + Michael.Felt, vstinner
2019-01-07 17:44:27Michael.Feltlinkissue35633 messages
2019-01-07 17:44:27Michael.Feltcreate