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.

classification
Title: test_os fails on non-English (Russian) Windows
Type: behavior Stage: resolved
Components: Tests Versions: Python 3.7, Python 3.6, Python 3.5
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: Nosy List: denis-osipov, vstinner
Priority: normal Keywords:

Created on 2017-06-07 07:39 by denis-osipov, last changed 2022-04-11 14:58 by admin. This issue is now closed.

Pull Requests
URL Status Linked Edit
PR 1980 merged denis-osipov, 2017-06-07 07:44
PR 1999 merged denis-osipov, 2017-06-08 11:30
PR 2000 merged denis-osipov, 2017-06-08 11:30
Messages (9)
msg295315 - (view) Author: Denis Osipov (denis-osipov) * Date: 2017-06-07 07:39
test_os fails on non-English (Russian) Windows 7 Home Extended 6.1.7601 x64

======================================================================
ERROR: test_access_denied (test.test_os.StatAttributeTests)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "C:\repos\cpython\lib\test\test_os.py", line 476, in test_access_denied
    creationflags=DETACHED_PROCESS
  File "C:\repos\cpython\lib\subprocess.py", line 293, in check_call
    raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '['icacls.exe', 'C:\\Users\\User\

\AppData\\Local\\Temp\\@test_6804_tmp', '/deny', 'Users:(S)']' returned non-zero 

exit status 1332.

----------------------------------------------------------------------
Ran 250 tests in 5.120s

FAILED (errors=1, skipped=92)
test_os failed

1 test failed:
    test_os

Total duration: 5 sec
Tests result: FAILURE

There is no group BUILTIN\Users on my Windows. There is BUILTIN\Пользователи instead.
msg295316 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2017-06-07 07:51
> exit status 1332.

On the Internet, I found:

1332 	No mapping between account names and security IDs was done.

The unit test:

    @unittest.skipUnless(sys.platform == "win32", "Win32 specific tests")
    def test_access_denied(self):
        # Default to FindFirstFile WIN32_FIND_DATA when access is
        # denied. See issue 28075.
        # os.environ['TEMP'] should be located on a volume that
        # supports file ACLs.
        fname = os.path.join(os.environ['TEMP'], self.fname)
        self.addCleanup(support.unlink, fname)
        create_file(fname, b'ABC')
        # Deny the right to [S]YNCHRONIZE on the file to
        # force CreateFile to fail with ERROR_ACCESS_DENIED.
        DETACHED_PROCESS = 8
        subprocess.check_call(
            ['icacls.exe', fname, '/deny', 'Users:(S)'],
            creationflags=DETACHED_PROCESS
        )
        result = os.stat(fname)
        self.assertNotEqual(result.st_size, 0)
msg295322 - (view) Author: Denis Osipov (denis-osipov) * Date: 2017-06-07 08:48
Using the numeric SID instead of localized name in test_access_denied works for me (I've made PR).
msg295358 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2017-06-07 17:15
New changeset 897bba75632dfce87c355e3cd4700468357715a7 by Victor Stinner (Denis Osipov) in branch 'master':
bpo-30584: Fix test_os fails on non-English Windows (#1980)
https://github.com/python/cpython/commit/897bba75632dfce87c355e3cd4700468357715a7
msg295359 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2017-06-07 17:16
I merged your fix. Thanks!

Let's wait for Windows buildbots. If tests pass on buildbots, the change should be backported to other branches impacted by the bug.

http://buildbot.python.org/all/waterfall?category=3.x.stable&category=3.x.unstable
msg295411 - (view) Author: Denis Osipov (denis-osipov) * Date: 2017-06-08 11:34
Tests on Windows buildbots passed. I've made PR for 3.5 and 3.6 backporting.
msg295422 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2017-06-08 12:02
New changeset ca1b66fd059758bbd6e2cc62c8f2adecefe8f942 by Victor Stinner (Denis Osipov) in branch '3.6':
[3.6] bpo-30584: Fix test_os fails on non-English Windows (GH-1980) (#1999)
https://github.com/python/cpython/commit/ca1b66fd059758bbd6e2cc62c8f2adecefe8f942
msg295425 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2017-06-08 12:16
New changeset a0b9088881b8fcfda864070335b249071508ee0c by Victor Stinner (Denis Osipov) in branch '3.5':
[3.5] bpo-30584: Fix test_os fails on non-English Windows (GH-1980) (#2000)
https://github.com/python/cpython/commit/a0b9088881b8fcfda864070335b249071508ee0c
msg295433 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2017-06-08 12:38
Thanks Denis Osipov for the fix and backports!
History
Date User Action Args
2022-04-11 14:58:47adminsetgithub: 74769
2017-06-08 12:38:43vstinnersetmessages: + msg295433
2017-06-08 12:33:42denis-osipovsetstatus: open -> closed
resolution: fixed
stage: resolved
2017-06-08 12:16:50vstinnersetmessages: + msg295425
2017-06-08 12:02:07vstinnersetmessages: + msg295422
2017-06-08 11:38:25denis-osipovsetversions: + Python 3.5, Python 3.6
2017-06-08 11:34:57denis-osipovsetmessages: + msg295411
2017-06-08 11:30:50denis-osipovsetpull_requests: + pull_request2067
2017-06-08 11:30:27denis-osipovsetpull_requests: + pull_request2066
2017-06-07 17:16:26vstinnersetmessages: + msg295359
2017-06-07 17:15:28vstinnersetmessages: + msg295358
2017-06-07 08:48:30denis-osipovsetmessages: + msg295322
2017-06-07 07:51:42vstinnersetnosy: + vstinner
messages: + msg295316
2017-06-07 07:44:59denis-osipovsetpull_requests: + pull_request2046
2017-06-07 07:39:23denis-osipovcreate