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 — gh-139322: Reenable test_os.test_getlogin() by vstinner · Pull Request #139498 · python/cpython

Conversation

@vstinner

@vstinner vstinner commented Oct 2, 2025 •
edited by bedevere-app Bot
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Member
  • Issue: Tests: move test_posix.py and test_os.py into a new test_os package #139322

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@vstinner
pythongh-139322: Reenable test_os.test_getlogin()
3f415ab
@vstinner vstinner added the skip news label Oct 2, 2025
@bedevere-app bedevere-app Bot added the tests Tests in the Lib/test dir label Oct 2, 2025
@bedevere-app bedevere-app Bot mentioned this pull request Oct 2, 2025
Tests: move test_posix.py and test_os.py into a new test_os package #139322
Closed
@bedevere-app bedevere-app Bot added the awaiting core review label Oct 2, 2025
@vstinner

vstinner commented Oct 2, 2025

Copy link
Copy Markdown
Member Author

The test is skipped temporarily for 15 years :-D Since commit 0151b8e:

commit 0151b8eddada4062b9efc18fffe87956fd90db09
Author: Brian Curtin <[email protected]>
Date:   Fri Sep 24 13:43:43 2010 +0000

    LoginTests fails on a number of buildbots with different errors. Skip
    it for now until a buildbot-safe solution comes up.
All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@picnixz

picnixz commented Oct 2, 2025 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Member

Note that we are actually setting a negative errno instead of a positive one (and thus we have errno = -25 which is actually the negative value for "ENOTTY Inappropriate ioctl for device").

  1. I don't know why we are using a negative errno here.
  2. I think we should fix the test by fixing it by calling setlogin beforehand (see https://man.freebsd.org/cgi/man.cgi?setlogin(2) for instance). But I'm not sure it's actually possible in the CI or on the build bots (maybe that's why we skipped this test...)

See also pytest-dev/pytest#1156 and #84998. The manpage also says:

Note that glibc does not follow the POSIX specification and uses stdin instead of /dev/tty. A bug. (Other recent systems, like SunOS 5.8 and HP-UX 11.11 and FreeBSD 4.8 all return the login name also when stdin is redirected.)

So, this may also be an issue with glibc itself when we're running in the CI (on my laptop, I can do os.getlogin() in a REPL)

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@vstinner
Fix getlogin() errno
ecd2fdc
Skip test_getlogin() is getlogin() fails with ENOTTY.
@vstinner

vstinner commented Oct 2, 2025

Copy link
Copy Markdown
Member Author

Note that we are actually setting a negative errno instead of a positive one (and thus we have errno = -25 which is actually the negative value for "ENOTTY Inappropriate ioctl for device").
I don't know why we are using a negative errno here.

I fixed os.getlogin() to report the correct errno.

I think we should fix the test by fixing it by calling setlogin beforehand

I would prefer to avoid that. It has a side effect and it requires to implement (expose) setlogin() in Python.

So, this may also be an issue with glibc itself when we're running in the CI (on my laptop, I can do os.getlogin() in a REPL)

errno 25 is ENOTTY. The getlogin() manual page says:

ENOTTY Standard input didn't refer to a terminal. (See BUGS.)

I modified my PR to skip the test is getlogin() fails with ENOTTY.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@vstinner vstinner added the 🔨 test-with-buildbots Test PR w/ buildbots; report in status section label Oct 2, 2025
@bedevere-bot

bedevere-bot commented Oct 2, 2025

Copy link
Copy Markdown

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

Results will be shown at:

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

If you want to schedule another build, you need to add the 🔨 test-with-buildbots label again.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@bedevere-bot bedevere-bot removed the 🔨 test-with-buildbots Test PR w/ buildbots; report in status section label Oct 2, 2025
@vstinner

vstinner commented Oct 2, 2025

Copy link
Copy Markdown
Member Author

buildbot/x86 Debian Installed with X PR

Oh, that's a real failure:

ERROR: test_getlogin (test.test_os.test_os.LoginTests.test_getlogin)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/buildbot/buildarea/pull_request.ware-debian-x86.installed/build/target/lib/python3.15/test/test_os/test_os.py", line 3204, in test_getlogin
    user_name = os.getlogin()
OSError: [Errno 6] No such device or address
All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@vstinner
Skip also the test on ENXIO
cd42a96
@vstinner vstinner added the 🔨 test-with-buildbots Test PR w/ buildbots; report in status section label Oct 2, 2025
@bedevere-bot

bedevere-bot commented Oct 2, 2025

Copy link
Copy Markdown

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

Results will be shown at:

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

If you want to schedule another build, you need to add the 🔨 test-with-buildbots label again.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@bedevere-bot bedevere-bot removed the 🔨 test-with-buildbots Test PR w/ buildbots; report in status section label Oct 2, 2025
@vstinner
Merge branch 'main' into reenable_test_getlogin
70cf34f
@vstinner
vstinner enabled auto-merge (squash) October 2, 2025 20:23
@vstinner
vstinner merged commit 4e7e2dd into python:main Oct 2, 2025
4 checks passed

Uh oh!

There was an error while loading. Please reload this page.

@vstinner
vstinner deleted the reenable_test_getlogin branch October 2, 2025 20:51
@bedevere-app bedevere-app Bot removed the awaiting core review label Oct 2, 2025
@yihong0618 yihong0618 mentioned this pull request Oct 11, 2025
Some errors are not caught by test_os.LoginTests.test_getlogin #139935
Closed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

No reviews

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

skip news tests Tests in the Lib/test dir

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

3 participants

@vstinner @picnixz @bedevere-bot
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.