Skip to content

Conversation

vstinner
Copy link
Member

@vstinner vstinner commented Oct 2, 2025

@vstinner
Copy link
Member Author

vstinner commented Oct 2, 2025

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

commit 0151b8eddada4062b9efc18fffe87956fd90db09
Author: Brian Curtin <brian.curtin@gmail.com>
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.

@picnixz
Copy link
Member

picnixz commented Oct 2, 2025

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)

Skip test_getlogin() is getlogin() fails with ENOTTY.
@vstinner
Copy link
Member Author

vstinner commented Oct 2, 2025

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.

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

🤖 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.

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

vstinner commented Oct 2, 2025

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

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

🤖 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.

@bedevere-bot bedevere-bot removed the 🔨 test-with-buildbots Test PR w/ buildbots; report in status section label Oct 2, 2025
@vstinner vstinner enabled auto-merge (squash) October 2, 2025 20:23
@vstinner vstinner merged commit 4e7e2dd into python:main Oct 2, 2025
45 checks passed
@vstinner vstinner deleted the reenable_test_getlogin branch October 2, 2025 20:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
skip news tests Tests in the Lib/test dir
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants