Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make pwd module optional for wasm32-emscripten and wasi #91089

Closed
tiran opened this issue Mar 5, 2022 · 3 comments
Closed

Make pwd module optional for wasm32-emscripten and wasi #91089

tiran opened this issue Mar 5, 2022 · 3 comments
Assignees
Labels
3.11 only security fixes stdlib Python modules in the Lib dir type-bug An unexpected behavior, bug, or error

Comments

@tiran
Copy link
Member

tiran commented Mar 5, 2022

BPO 46933
Nosy @tiran, @erlend-aasland
PRs
  • bpo-46933: Make pwd module optional (GH-31700) #31700
  • bpo-46933: Fix make distclean regression (GH-31737) #31737
  • Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

    Show more details

    GitHub fields:

    assignee = 'https://github.com/tiran'
    closed_at = <Date 2022-03-07.12:40:22.912>
    created_at = <Date 2022-03-05.20:50:25.168>
    labels = ['type-bug', 'library', '3.11']
    title = 'Make pwd module optional for wasm32-emscripten and wasi'
    updated_at = <Date 2022-03-07.22:18:58.077>
    user = 'https://github.com/tiran'

    bugs.python.org fields:

    activity = <Date 2022-03-07.22:18:58.077>
    actor = 'christian.heimes'
    assignee = 'christian.heimes'
    closed = True
    closed_date = <Date 2022-03-07.12:40:22.912>
    closer = 'christian.heimes'
    components = ['Library (Lib)']
    creation = <Date 2022-03-05.20:50:25.168>
    creator = 'christian.heimes'
    dependencies = []
    files = []
    hgrepos = []
    issue_num = 46933
    keywords = ['patch']
    message_count = 3.0
    messages = ['414595', '414662', '414704']
    nosy_count = 2.0
    nosy_names = ['christian.heimes', 'erlendaasland']
    pr_nums = ['31700', '31737']
    priority = 'normal'
    resolution = 'fixed'
    stage = 'resolved'
    status = 'closed'
    superseder = None
    type = 'behavior'
    url = 'https://bugs.python.org/issue46933'
    versions = ['Python 3.11']

    @tiran
    Copy link
    Member Author

    tiran commented Mar 5, 2022

    WebAssembly platforms like wasm32-emscripten and wasm32-wasi don't have a typical user and group database.

    WASI platform does not provide necessary API functions at all. Emscripten provides dummy stubs. On Emscripten the pwd module compiles, but is non-functional:

    Python 3.11.0a4+ (heads/main-dirty:b1a3446, Jan 25 2022, 10:19:07) [Clang 14.0.0 (https://github.com/llvm/llvm-project f142c45f1e494f8dbdcc1bcf1412 on emscripten
    Type "help", "copyright", "credits" or "license" for more information.
    >>> import pwd, os
    >>> os.getuid()
    0
    >>> pwd.getpwall()
    []
    >>> pwd.getpwuid(os.getuid())
    Traceback (most recent call last):
      File "<stdin>", line 1, in <module>
    KeyError: 'getpwuid(): uid not found: 0'

    I propose to make the pwd optional and catch import error in few places where the pwd module is used to look up user home directory.

    @tiran tiran added the 3.11 only security fixes label Mar 5, 2022
    @tiran tiran self-assigned this Mar 5, 2022
    @tiran tiran added stdlib Python modules in the Lib dir type-bug An unexpected behavior, bug, or error 3.11 only security fixes labels Mar 5, 2022
    @tiran tiran self-assigned this Mar 5, 2022
    @tiran tiran added stdlib Python modules in the Lib dir type-bug An unexpected behavior, bug, or error labels Mar 5, 2022
    @tiran
    Copy link
    Member Author

    tiran commented Mar 7, 2022

    New changeset ca9689f by Christian Heimes in branch 'main':
    bpo-46933: Make pwd module optional (GH-31700)
    ca9689f

    @tiran tiran closed this as completed Mar 7, 2022
    @tiran tiran closed this as completed Mar 7, 2022
    @tiran
    Copy link
    Member Author

    tiran commented Mar 7, 2022

    New changeset 47cca04 by Erlend Egeberg Aasland in branch 'main':
    bpo-46933: Fix make distclean regression (GH-31737)
    47cca04

    @ezio-melotti ezio-melotti transferred this issue from another repository Apr 10, 2022
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
    Labels
    3.11 only security fixes stdlib Python modules in the Lib dir type-bug An unexpected behavior, bug, or error
    Projects
    None yet
    Development

    No branches or pull requests

    1 participant