Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

os.getlogin() fails with OSError: [Errno 34] for usernames > 9 characters #135497

Closed
Labels
extension-modulesC modules in the Modules dirtype-bugAn unexpected behavior, bug, or error
@alebcay

Description

@alebcay

Bug report

Bug description:

importosprint(os.getlogin())
$python3 -c"import os; print(os.getlogin())"Traceback (most recent call last):  File "<string>", line 1, in <module>    import os; print(os.getlogin())                     ~~~~~~~~~~~^^OSError: [Errno -34] Unknown error: -34

It appears that if Python is compiled in an environment withoutHAVE_MAXLOGNAME but withHAVE_UT_NAMESIZE,getlogin_r will return error 34 if username is >9 characters.

This appears to be a regression introduced in#132751:

https://github.com/duaneg/cpython/blob/675342cf59ffe53337d92af989b97dad687a10ea/configure.ac#L5434

The correct header file to search for issys/param.h, notsys/params.h. As a result,HAVE_UT_NAMESIZE is satisfied (viautmp.h) butHAVE_MAXLOGNAME is not.

This was originally reported to Homebrew viaHomebrew/homebrew-core#226857.

CPython versions tested on:

3.15

Operating systems tested on:

macOS

Linked PRs

Metadata

Metadata

Assignees

No one assigned

    Labels

    extension-modulesC modules in the Modules dirtype-bugAn unexpected behavior, bug, or error

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions


      [8]ページ先頭

      ©2009-2025 Movatter.jp