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.

classification
Title: lockf() is available now on Android API level 24, but the F_LOCK macro is not defined
Type: behavior Stage: resolved
Components: Interpreter Core Versions: Python 3.7, Python 3.6
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: xdegaye Nosy List: python-dev, vstinner, xdegaye, yan12125
Priority: normal Keywords: patch

Created on 2016-11-21 10:19 by xdegaye, last changed 2022-04-11 14:58 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
test_posix_flock.patch xdegaye, 2016-11-21 10:19 review
test_posix_lockf_2.patch xdegaye, 2016-12-21 21:09 review
Pull Requests
URL Status Linked Edit
PR 552 closed dstufft, 2017-03-31 16:36
PR 4488 merged xdegaye, 2017-11-21 09:05
Messages (11)
msg281344 - (view) Author: Xavier de Gaye (xdegaye) * (Python triager) Date: 2016-11-21 10:19
The patch fixes the following error:

======================================================================
ERROR: test_lockf (test.test_posix.PosixTester)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/sdcard/org.bitbucket.pyona/lib/python3.7/test/test_posix.py", line 195, in test_lockf
    posix.lockf(fd, posix.F_LOCK, 4)
AttributeError: module 'posix' has no attribute 'F_LOCK'
msg283752 - (view) Author: (yan12125) * Date: 2016-12-21 12:36
FYI: Since Android NDK r14 beta1, F_LOCK is defined in unified headers. [1] In $ANDROID_NDK/sysroot/usr/include/bits/lockf.h:

#define F_ULOCK 0
#define F_LOCK 1
#define F_TLOCK 2
#define F_TEST 3

[1] https://android.googlesource.com/platform/ndk.git/+/master/docs/UnifiedHeaders.md
msg283758 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2016-12-21 14:54
> The patch fixes the following error:

Do you mean that the patch adds posix.F_LOCK constant on Android?
msg283759 - (view) Author: Xavier de Gaye (xdegaye) * (Python triager) Date: 2016-12-21 15:12
No, the patch prevents posix.flock() to be defined on Android API 24 with android-ndk-r13. But I plan to change it so that the test is skipped when posix does not have the F_LOCK attribute as this problem is not worth a change in the build machinery. It makes even more sense now that android-ndk-r14 will be released with "Unified Headers". BTW thanks Chi Hsuan Yen for this important information.
msg283767 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2016-12-21 16:28
Oh ok, the issue is more subtle than what I understood.

I reviewed test_posix_flock.patch and proposed some changes to the comment/doc.
msg283781 - (view) Author: Xavier de Gaye (xdegaye) * (Python triager) Date: 2016-12-21 20:33
Thanks for the review Victor.

I have created issue 29040: building Android with android-ndk-r14.
msg283785 - (view) Author: Xavier de Gaye (xdegaye) * (Python triager) Date: 2016-12-21 21:09
New patch.
Please use autoreconf before running the patch (autoreconf instead of autoconf because the description of HAVE_LOCKF has been updated).
msg283788 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2016-12-21 21:57
The new patch now looks good to me.
msg283823 - (view) Author: Roundup Robot (python-dev) (Python triager) Date: 2016-12-22 09:41
New changeset 51b09b10d4f8 by Xavier de Gaye in branch '3.6':
Issue #28762: lockf() is available on Android API level 24, but the
https://hg.python.org/cpython/rev/51b09b10d4f8

New changeset 146157d91283 by Xavier de Gaye in branch 'default':
Issue #28762: Merge 3.6.
https://hg.python.org/cpython/rev/146157d91283
msg306634 - (view) Author: Xavier de Gaye (xdegaye) * (Python triager) Date: 2017-11-21 09:06
This change is not needed anymore now that Unified Headers are supported by android-ndk-r14 (see issue 29040)
msg306801 - (view) Author: Xavier de Gaye (xdegaye) * (Python triager) Date: 2017-11-23 11:01
New changeset 5ce1069a6ff0d5443074d33ba1d403ccd2eaf3d3 by xdegaye in branch 'master':
bpo-28762: Revert last commit (now using Android Unified Headers) (GH-4488)
https://github.com/python/cpython/commit/5ce1069a6ff0d5443074d33ba1d403ccd2eaf3d3
History
Date User Action Args
2022-04-11 14:58:39adminsetgithub: 72948
2017-11-23 11:02:01xdegayesetstatus: open -> closed
resolution: not a bug -> fixed
stage: patch review -> resolved
2017-11-23 11:01:43xdegayesetmessages: + msg306801
2017-11-21 09:07:00xdegayesetstatus: closed -> open
resolution: fixed -> not a bug
messages: + msg306634

stage: resolved -> patch review
2017-11-21 09:05:27xdegayesetpull_requests: + pull_request4426
2017-03-31 16:36:07dstufftsetpull_requests: + pull_request829
2016-12-22 11:28:02xdegayesetstatus: open -> closed
resolution: fixed
stage: patch review -> resolved
2016-12-22 09:41:19python-devsetnosy: + python-dev
messages: + msg283823
2016-12-21 21:57:17vstinnersetmessages: + msg283788
2016-12-21 21:09:38xdegayesetfiles: + test_posix_lockf_2.patch

messages: + msg283785
title: configure links with lockf and F_LOCK is not declared in Android API 24 -> lockf() is available now on Android API level 24, but the F_LOCK macro is not defined
2016-12-21 20:33:03xdegayesetmessages: + msg283781
2016-12-21 16:28:18vstinnersetmessages: + msg283767
2016-12-21 15:12:02xdegayesetmessages: + msg283759
2016-12-21 14:54:58vstinnersetnosy: + vstinner
messages: + msg283758
2016-12-21 12:36:55yan12125setnosy: + yan12125
messages: + msg283752
2016-11-21 15:40:04xdegayelinkissue26865 dependencies
2016-11-21 10:19:49xdegayecreate