GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Make privileged functions available on Android · Issue #152936 · python/cpython

Make privileged functions available on Android #152936

New issue
Copy link
New issue
Copy link
Closed
#152977
Closed
Make privileged functions available on Android#152936
#152977
Copy link
Labels
OS-androidstdlibStandard Library Python modules in the Lib/ directoryStandard Library Python modules in the Lib/ directorytype-featureA feature request or enhancementA feature request or enhancement

Description

@mhsmith
mhsmith
opened on Jul 3, 2026
Issue body actions

Proposal:

configure.ac contains a list of privileged functions which are "blocked" on Android, i.e. they simply won't exist in the stdlib. This was because when any of the underlying C functions are called by a non-root user, instead of returning a PermissionError as they would on Linux, they cause a low-level crash of the whole process.

This approach has 2 problems:

  • Users of these functions will probably be able to handle a PermissionError, but not an AttributeError.
  • It prevents using the functions on rooted devices.

Termux is working around this by making Python check the UID and raise the PermissionError itself in a non-root context. I think it would be a good idea to adopt this upstream.

  • This change should only affect Android; on other platforms, UID checks should continue to be done by the underlying C function.
  • Most of these functions are documented as "not Android"; that should also be removed.
  • Functions which are blocked in configure.ac for other reasons should continue to be blocked.

Has this already been discussed elsewhere?

I have already discussed this feature proposal on the Termux issue tracker

Links to previous discussion of this feature:

  • enhance(main/python): enable some blocked POSIX functions and enable _zstd termux/termux-packages#30310

Linked PRs

  • gh-152936: Make privileged functions available on Android #152977
Reacted by Yaksh Bariya and flameastro

Activity

  1. mhsmith
    added
    type-featureA feature request or enhancementA feature request or enhancement
    OS-android
    stdlibStandard Library Python modules in the Lib/ directoryStandard Library Python modules in the Lib/ directory
    on Jul 3, 2026
  2. sabamdarif
    added a commit that references this issue on Jul 3, 2026

    pythongh-152936: Make privileged functions available on Android

    8b77d9d
  3. freakboy3742 commented on Jul 6, 2026

    @freakboy3742
    freakboy3742
    on Jul 6, 2026
    Contributor
    More actions

    To clarify - do these methods work as expected when invoked as root?

    If so - this seems reasonable; my only question would be around documentation. If EPERM isn't a documented POSIX-expected result from any of the affected methods, we should make sure the docs for those methods clarify the "extension" that Python is adding.

  4. mhsmith commented on Jul 7, 2026

    @mhsmith
    mhsmith
    on Jul 7, 2026
    MemberAuthor
    More actions

    do these methods work as expected when invoked as root?

    According to termux/termux-packages#30310 (comment), "chroot, sethostname & setgid, setuid" have all been verified to work. Running apps as root isn't an officially supported mode of Android, but it's reasonably common among power users, so we might as well support it if we can.

    If EPERM isn't a documented POSIX-expected result from any of the affected methods

    I'm pretty sure it is, but I'll check when reviewing the PR. If so, then the proposed behavior would be identical to POSIX as far as the Python user can tell, so no extra documentation is required.

    Reacted by Russell Keith-Magee and flameastro
  5. sabamdarif
    added 4 commits that reference this issue on Jul 8, 2026

    pythongh-152936: Use posix_error for Android checks

    dd73903

    pythongh-152936: Document Android support in os and socket

    27e854c

    pythongh-152936: Fix test_os and test_posix failures on Android

    907676b

    pythongh-152936: Fix AttributeError for os.chroot on platforms withou…

    16b633c
  6. freakboy3742
    added a commit that references this issue on Sep 8, 2026

    gh-152936: Make privileged functions available on Android (#152977)

    adea841
  7. freakboy3742
    closed this as completedin #152977on Sep 8, 2026
  8. maurycy
    added a commit that references this issue on Sep 10, 2026

    Merge branch 'main' into tachyon-native-callable

    e028ff5
  9. clin1234
    added a commit that references this issue on Sep 12, 2026

    pythongh-152936: Make privileged functions available on Android (pyth…

    d2a5cab
  10. johnslavik
    added a commit that references this issue on Sep 14, 2026

    pythongh-152936: Make privileged functions available on Android (pyth…

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    OS-androidstdlibStandard Library Python modules in the Lib/ directoryStandard Library Python modules in the Lib/ directorytype-featureA feature request or enhancementA feature request or enhancement

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

      You are visitor 01402503 — GeezerVison does not store the pages you look up.
      Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.