Skip to content

Conversation

jbosboom
Copy link
Contributor

@jbosboom jbosboom commented Oct 21, 2025

#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.)

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).
@ayappanec
Copy link
Contributor

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.,

@jbosboom
Copy link
Contributor Author

@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.

@vstinner
Copy link
Member

!buildbot Android

@bedevere-bot
Copy link

🤖 New build scheduled with the buildbot fleet by @vstinner for commit 0a8f9cc 🤖

Results will be shown at:

https://buildbot.python.org/all/#/grid?branch=refs%2Fpull%2F140395%2Fmerge

The command will test the builders whose names match following regular expression: Android

The builders matched are:

  • AMD64 Android PR
  • aarch64 Android PR

Copy link
Member

@mhsmith mhsmith left a 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.

Copy link
Member

@vstinner vstinner left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@vstinner vstinner merged commit c788bfb into python:main Oct 21, 2025
53 checks passed
@vstinner
Copy link
Member

I merged your PR, thanks.

@vstinner
Copy link
Member

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.

@mhsmith
Copy link
Member

mhsmith commented Oct 21, 2025

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.

@vstinner
Copy link
Member

Oh ok, I looked at the wrong line. Thanks for correcting me :-)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants