This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Title: test.test_spwd.TestSpwdNonRoot failure with FileNotFoundError:
Type: behavior Stage: resolved
Components: Tests Versions: Python 3.6
Status: closed Resolution: out of date
Dependencies: Superseder:
Assigned To: Nosy List: Gerrit.Holl, iritkatriel, r.david.murray, rgbyrnes, serhiy.storchaka
Priority: normal Keywords:

Created on 2017-01-04 16:42 by Gerrit.Holl, last changed 2022-04-11 14:58 by admin. This issue is now closed.

Messages (5)
msg284651 - (view) Author: Gerrit Holl (Gerrit.Holl) * Date: 2017-01-04 16:42
I am building and testing Python 3.6 on the JASMIN Analysis Platform <http://www.jasmin.ac.uk/services/jasmin-analysis-platform/>, which runs Red Hat Enterprise Linux Server release 6.8 on a machine with 48 Ɨ Intel(R) Xeon(R) CPU E7-4860 v2 @ 2.60GHz, 2 TiB RAM, and a PanFSā“‡ <http://www.panasas.com/products/panfs> distributed file system.  test.test_spwd.TestSpwdNonRoot is failing with FileNotFoundError.  Below is the full verbose output of `./python -m test -v test_spwd`:

== CPython 3.6.0 (default, Jan 4 2017, 14:11:04) [GCC 4.4.7 20120313 (Red Hat 4.4.7-17)]
==   Linux-2.6.32-642.6.2.el6.x86_64-x86_64-with-redhat-6.8-Santiago little-endian
==   hash algorithm: siphash24 64bit
==  cwd: /home/users/gholl/src/Python-3.6.0/build/test_python_40357
==  encodings: locale=UTF-8, FS=utf-8
Testing with flags: sys.flags(debug=0, inspect=0, interactive=0, optimize=0, dont_write_bytecode=0, no_user_site=0, no_site=0, ignore_environment=0, verbose=0, bytes_warning=0, quiet=0, hash_randomization=1, isolated=0)
Run tests sequentially
0:00:00 [1/1] test_spwd
test_getspnam_exception (test.test_spwd.TestSpwdNonRoot) ... ERROR
test_getspall (test.test_spwd.TestSpwdRoot) ... skipped 'root privileges required'
test_getspnam (test.test_spwd.TestSpwdRoot) ... skipped 'root privileges required'

ERROR: test_getspnam_exception (test.test_spwd.TestSpwdNonRoot)
Traceback (most recent call last):
  File "/home/users/gholl/src/Python-3.6.0/Lib/test/test_spwd.py", line 67, in test_getspnam_exception
FileNotFoundError: [Errno 2] No such file or directory

Ran 3 tests in 0.002s

FAILED (errors=1, skipped=2)
test_spwd failed

1 test failed:

Total duration: 66 ms
Tests result: FAILURE
msg284656 - (view) Author: R. David Murray (r.david.murray) * (Python committer) Date: 2017-01-04 16:59
Since you are seeing errors on your platform that we are not seeing, and we do not have access to your platform, you are going to have to track down the cause, I'm afraid.
msg284657 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2017-01-04 17:06
It is easy to add FileNotFoundError to the list of expected exceptions. But it seems to me that the only error that gespname() can return on Linux is EACCES. [1] May be this is a bug of your platform.

[1] http://man7.org/linux/man-pages/man3/getspnam.3.html
msg299712 - (view) Author: Robert Byrnes (rgbyrnes) Date: 2017-08-03 15:51
We are seeing this too, on RHEL 7.

It happens when /etc/nsswitch.conf has ...

    shadow: files ldap

The ldap nss back end seems to set errno = ENOENT when it gets no response from the ldap server.  If we remove ldap (leaving only files), then we see errno = EACCES.

Is it correct to insist on EACCES?  The man page cited in the last message says only that ...

    The functions that return a pointer return NULL if no more entries are available or if an error occurs during processing.  The functions which have int as the return value return 0 for success and -1 for failure, with errno set to indicate the cause of the error.

getspnam isn't one of the "functions which have int as the return value," so it isn't clear whether application code should make any assumptions about errno when it returns.
msg412181 - (view) Author: Irit Katriel (iritkatriel) * (Python committer) Date: 2022-01-31 00:02
3.6 is no longer maintained. Please create a new issue if you are seeing this problem on a current version (>= 3.9).
Date User Action Args
2022-04-11 14:58:41adminsetgithub: 73341
2022-01-31 00:02:31iritkatrielsetstatus: open -> closed

nosy: + iritkatriel
messages: + msg412181

resolution: out of date
stage: resolved
2017-08-03 15:51:05rgbyrnessetnosy: + rgbyrnes
messages: + msg299712

components: + Tests
type: behavior
2017-01-04 17:06:50serhiy.storchakasetnosy: + serhiy.storchaka
messages: + msg284657
2017-01-04 16:59:20r.david.murraysetnosy: + r.david.murray
messages: + msg284656
2017-01-04 16:42:51Gerrit.Hollsetversions: + Python 3.6
2017-01-04 16:42:46Gerrit.Hollcreate