Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test_os fails on non-English (Russian) Windows #74769

Closed
denis-osipov mannequin opened this issue Jun 7, 2017 · 9 comments
Closed

test_os fails on non-English (Russian) Windows #74769

denis-osipov mannequin opened this issue Jun 7, 2017 · 9 comments
Labels
3.7 (EOL) end of life tests Tests in the Lib/test dir type-bug An unexpected behavior, bug, or error

Comments

@denis-osipov
Copy link
Mannequin

denis-osipov mannequin commented Jun 7, 2017

BPO 30584
Nosy @vstinner, @denis-osipov
PRs
  • bpo-30584: Fix test_os fails on non-English Windows #1980
  • [3.6] bpo-30584: Fix test_os fails on non-English Windows (GH-1980) #1999
  • [3.5] bpo-30584: Fix test_os fails on non-English Windows (GH-1980) #2000
  • Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

    Show more details

    GitHub fields:

    assignee = None
    closed_at = <Date 2017-06-08.12:33:42.197>
    created_at = <Date 2017-06-07.07:39:23.759>
    labels = ['3.7', 'type-bug', 'tests']
    title = 'test_os fails on non-English (Russian) Windows'
    updated_at = <Date 2017-06-08.12:38:43.389>
    user = 'https://github.com/denis-osipov'

    bugs.python.org fields:

    activity = <Date 2017-06-08.12:38:43.389>
    actor = 'vstinner'
    assignee = 'none'
    closed = True
    closed_date = <Date 2017-06-08.12:33:42.197>
    closer = 'denis-osipov'
    components = ['Tests']
    creation = <Date 2017-06-07.07:39:23.759>
    creator = 'denis-osipov'
    dependencies = []
    files = []
    hgrepos = []
    issue_num = 30584
    keywords = []
    message_count = 9.0
    messages = ['295315', '295316', '295322', '295358', '295359', '295411', '295422', '295425', '295433']
    nosy_count = 2.0
    nosy_names = ['vstinner', 'denis-osipov']
    pr_nums = ['1980', '1999', '2000']
    priority = 'normal'
    resolution = 'fixed'
    stage = 'resolved'
    status = 'closed'
    superseder = None
    type = 'behavior'
    url = 'https://bugs.python.org/issue30584'
    versions = ['Python 3.5', 'Python 3.6', 'Python 3.7']

    @denis-osipov
    Copy link
    Mannequin Author

    denis-osipov mannequin commented Jun 7, 2017

    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.

    @denis-osipov denis-osipov mannequin added 3.7 (EOL) end of life tests Tests in the Lib/test dir type-bug An unexpected behavior, bug, or error labels Jun 7, 2017
    @vstinner
    Copy link
    Member

    vstinner commented Jun 7, 2017

    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 bpo-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)
    

    @denis-osipov
    Copy link
    Mannequin Author

    denis-osipov mannequin commented Jun 7, 2017

    Using the numeric SID instead of localized name in test_access_denied works for me (I've made PR).

    @vstinner
    Copy link
    Member

    vstinner commented Jun 7, 2017

    New changeset 897bba7 by Victor Stinner (Denis Osipov) in branch 'master':
    bpo-30584: Fix test_os fails on non-English Windows (bpo-1980)
    897bba7

    @vstinner
    Copy link
    Member

    vstinner commented Jun 7, 2017

    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

    @denis-osipov
    Copy link
    Mannequin Author

    denis-osipov mannequin commented Jun 8, 2017

    Tests on Windows buildbots passed. I've made PR for 3.5 and 3.6 backporting.

    @vstinner
    Copy link
    Member

    vstinner commented Jun 8, 2017

    New changeset ca1b66f by Victor Stinner (Denis Osipov) in branch '3.6':
    [3.6] bpo-30584: Fix test_os fails on non-English Windows (GH-1980) (bpo-1999)
    ca1b66f

    @vstinner
    Copy link
    Member

    vstinner commented Jun 8, 2017

    New changeset a0b9088 by Victor Stinner (Denis Osipov) in branch '3.5':
    [3.5] bpo-30584: Fix test_os fails on non-English Windows (GH-1980) (bpo-2000)
    a0b9088

    @denis-osipov denis-osipov mannequin closed this as completed Jun 8, 2017
    @vstinner
    Copy link
    Member

    vstinner commented Jun 8, 2017

    Thanks Denis Osipov for the fix and backports!

    @ezio-melotti ezio-melotti transferred this issue from another repository Apr 10, 2022
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
    Labels
    3.7 (EOL) end of life tests Tests in the Lib/test dir type-bug An unexpected behavior, bug, or error
    Projects
    None yet
    Development

    No branches or pull requests

    1 participant