-
-
Notifications
You must be signed in to change notification settings - Fork 32.2k
gh-114435: Add test skip when running as admin. #114571
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
Conversation
Also makes _winapi.CreateFile unconditionally use Unicode.
Lib/test/test_os.py
Outdated
# We should now not be able to open the file. | ||
# If we can, the test isn't going to be useful. | ||
try: | ||
_winapi.CloseHandle(_winapi.CreateFile( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is it different from using open()
or os.open()
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, admin may have additional privileges that make FILE_FLAG_BACKUP_SEMANTICS
able to access files that are supposed to be locked away. (One earlier issue with this test is that CreateJunction
was enabling the privilege but not disabling it.)
The flags passed here match what stat
uses, so we should get equivalent behaviour. Though there's a new quirk that I'm looking into, so we may end up having to just remove the checks in the test that make sure ino/dev are zero, since in some cases they may legitimately get the real value.
@serhiy-storchaka Sorry to make changes just after you approved, but I think we need to remove the skip and instead allow dev/ino to be correctly read. I'm confirming, but I think the new stat API we use on newer Windows is able to read them even in this case, so we don't really have a choice but to allow both values. The test will still catch wildly invalid results, like the ones that triggered the original issue. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please don't forget to change the commit message.
|
This PR didn't touch the above listed tests, and it's a nogil buildbot, so someone working on that stuff can look into it. |
… ino/dev (pythonGH-114571) This may occur if Windows allows reading stat information from a file even if the current user does not have access.
Thanks @zooba for the PR 🌮🎉.. I'm working now to backport this PR to: 3.12. |
… ino/dev (pythonGH-114571) This may occur if Windows allows reading stat information from a file even if the current user does not have access. (cherry picked from commit d91ddff) Co-authored-by: Steve Dower <[email protected]>
GH-115851 is a backport of this pull request to the 3.12 branch. |
…ev (GH-114571) This may occur if Windows allows reading stat information from a file even if the current user does not have access. (cherry picked from commit d91ddff) Co-authored-by: Steve Dower <[email protected]>
… ino/dev (pythonGH-114571) This may occur if Windows allows reading stat information from a file even if the current user does not have access.
Also makes _winapi.CreateFile unconditionally use Unicode.