GeezerVison is showing github.com — gh-140239: Check for statx on Android by jbosboom · Pull Request #140395 · python/cpython
Conversation
jbosboom
commented
Oct 21, 2025
•
edited
Loading
Uh oh!
There was an error while loading. Please reload this page.
#140249 inadvertently disabled checking for statx on Android because MACHDEP is "android" on Android. You can verify this by looking at the logs from the Android runner from #140249. This is a cross-compile. In the "Configure build Python" logs, MACHDEP is linux and configure checks for statx; in the "Configure host Python" logs, MACHDEP is android and configure doesn't check for statx (would be just after checking for writev).
Base the check for statx on ac_sys_system instead, which is Linux-android on Android, Linux on other Linux distributions, and AIX on AIX (which has an incompatible function named statx that prompted #140249).
Before merging:
Please look at the Android build log to make sure both the build and host Python configure check for statx. (The host Python check will result in no because the Android CI uses Android API level 24 and statx was introduced in Android API level 30.) Verified, the host Python configure checks for statx.
- People are building for API levels higher than 30, given issue #123014, so this PR is not theoretical.
- If the Android buildbots still exist and use API level 30 or higher (#123014 indicates they "will" use 34), please run the Android buildbots to make sure the tests pass. (I can't do this myself.)
cc @ayappanec as author of #140249
cc @vstinner as reviewer of statx-related PRs
cc @mhsmith as Android buildbot operator and Android maintainer
(There's a "$MACHDEP" != linux check just below the code this PR changes, which does not exclude Android as may have been intended. Android introduced lchmod in API level 36. lchmod delegates to fchmodat with AT_SYMLINK_NOFOLLOW, and fchmodat has code that should work on non-symlinks and give the correct errno for symlinks, so I think the behavior is acceptable, but we aren't testing it. That can be a separate issue/PR if it's a problem.)
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Android has Linux's statx, but MACHDEP is "android" on Android, so
configure doesn't check for statx on Android. Base the check for statx
on ac_sys_system instead, which is "Linux-android" on Android, "Linux"
on other Linux distributions, and "AIX" on AIX (which has an
incompatible function named statx).
|
I didn't knew MACHDEP is not Linux in Android. Sorry for that. Thanks for all the details. Will be more thorough in the future.,
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
|
@ayappanec I appreciate that you're keeping up with the main branch and reporting issues promptly. Don't worry about this. Given the maybe-also-wrong check right below it, it took me about 30 minutes to figure this out.
|
ayappanec reacted with thumbs up emoji
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- If the Android buildbots still exist and use API level 30 or higher (#123014 indicates they "will" use 34), please run the Android buildbots to make sure the tests pass.
The buildbots may run on API level 34, but they build against API level 21 or 24, so they still won't detect the function. However, I've tested this PR manually by setting the ANDROID_API_LEVEL environment variable to 30, and it builds and passes the statx tests.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
vstinner and jbosboom reacted with thumbs up emoji
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
|
I merged your PR, thanks.
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
buildbot/AMD64 Android PR Build done.
configure says checking for statx... yes. But I don't see test_os in run tests.
buildbot/aarch64 Android PR Build done.
configure says checking for statx... no.
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
|
As expected, the AMD64 build says statx... yes for the "build Python" for Linux, but no for the "host Python" for Android. And it looks like test_os appears normally at line 390 of the test log.
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
|
Oh ok, I looked at the wrong line. Thanks for correcting me :-)
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
StanFromIreland
pushed a commit
to StanFromIreland/cpython
that referenced
this pull request
Dec 6, 2025
Android has Linux's statx, but MACHDEP is "android" on Android, so
configure doesn't check for statx on Android. Base the check for statx
on ac_sys_system instead, which is "Linux-android" on Android, "Linux"
on other Linux distributions, and "AIX" on AIX (which has an
incompatible function named statx).
Uh oh!
There was an error while loading. Please reload this page.
Assignees
No one assigned
Milestone
No milestone
Development
Successfully merging this pull request may close these issues.
Uh oh!
There was an error while loading. Please reload this page.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
|