Skip to content

python@3.13.5.arm64_sequoia: os.getlogin() fails with OSError: [Errno 34] for usernames > 9 characters #226857

@rstanevich

Description

@rstanevich

brew gist-logs <formula> link OR brew config AND brew doctor output

brew config
HOMEBREW_VERSION: 4.5.6-71-ge3ae002-dirty
ORIGIN: https://github.com/Homebrew/brew
HEAD: e3ae002054e2069987757ee75baa9a03420a6da5
Last commit: 4 hours ago
Branch: master
Core tap JSON: 13 Jun 21:13 UTC
Core cask tap JSON: 13 Jun 21:13 UTC
HOMEBREW_PREFIX: /opt/homebrew
HOMEBREW_AUTO_UPDATE_SECS: 180
HOMEBREW_CASK_OPTS: []
HOMEBREW_MAKE_JOBS: 10
HOMEBREW_SORBET_RUNTIME: set
Homebrew Ruby: 3.4.4 => /opt/homebrew/Library/Homebrew/vendor/portable-ruby/3.4.4/bin/ruby
CPU: deca-core 64-bit arm_firestorm_icestorm
Clang: 17.0.0 build 1700
Git: 2.39.5 => /Library/Developer/CommandLineTools/usr/bin/git
Curl: 8.7.1 => /usr/bin/curl
macOS: 15.5-arm64
CLT: 16.4.0.0.1.1747106510
Xcode: N/A
Rosetta 2: false

Verification

  • My brew doctor output says Your system is ready to brew. and am still able to reproduce my issue.
  • I ran brew update and am still able to reproduce my issue.
  • I have resolved all warnings from brew doctor and that did not fix my problem.
  • I searched for recent similar issues at https://github.com/Homebrew/homebrew-core/issues?q=is%3Aissue and found no duplicates.

What were you trying to do (and why)?

python3 -c "import os; print(os.getlogin())"

What happened (include all command output)?

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

Hypothesys:
This may be due to changes in https://github.com/python/cpython/pull/132751/files
So if python is compiled in an environment without HAVE_GETLOGIN_R but with HAVE_UT_NAMESIZE - getlogin_r will return error 34 if username is >9 characters

What did you expect to happen?

os.getlogin() is functioning

Step-by-step reproduction instructions (by running brew commands)

brew install python@3.13
# On a macOS Sequoia, be logged in as a user with a long name (>9 characters), for example, testuser123
python3 -c "import os; print(os.getlogin())

So I'm wondering if this issue can be resolved by changing the build environment settings?

Metadata

Metadata

Assignees

No one assigned

    Labels

    upstream issueAn upstream issue report is needed

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions