[Python-Dev] Tests failing on Windows with TESTFN (original) (raw)
eryk sun eryksun at gmail.com
Sat Jul 28 18:02:20 EDT 2018
- Previous message (by thread): [Python-Dev] Tests failing on Windows with TESTFN
- Next message (by thread): [Python-Dev] Tests failing on Windows with TESTFN
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
On Sat, Jul 28, 2018 at 5:20 PM, Tim Golden <mail at timgolden.me.uk> wrote:
I've got a mixture of Permission (winerror 13) & Access errors (winerror 5)
EACCES (13) is a CRT errno value. Python raises PermissionError for EACCES and EPERM (1, not used). It also does the reverse mapping for WinAPI calls, so PermissionError is raised either way. About 25 WinAPI error codes map to EACCES. Commonly it's due to either ERROR_ACCESS_DENIED (5) or ERROR_SHARING_VIOLATION (32).
open() uses read-write sharing but not delete sharing. In this case trying to either delete an already open file or open a file that's already open with delete access (e.g. an O_TEMPORARY open) both fail with a sharing violation.
An access-denied error could be due to a range of causes. Over 20 NTAPI status codes map to ERROR_ACCESS_DENIED. Commonly for a file it's due to one of the following status codes:
STATUS_ACCESS_DENIED (0xc0000022)
The file security doesn't grant the requested access
to the caller.
STATUS_DELETE_PENDING (0xc0000056)
The file's delete disposition is set, i.e. it's flagged to be
deleted when the last handle is closed. Opening a new
handle is disallowed for any access.
STATUS_FILE_IS_A_DIRECTORY (0xc00000ba)
Except when using backup semantics, CreateFile calls
NtCreateFile with the flag FILE_NON_DIRECTORY_FILE,
so only non-directory files/devices can be opened.
STATUS_CANNOT_DELETE (0xc0000121)
The file is either readonly or memory mapped.
- Previous message (by thread): [Python-Dev] Tests failing on Windows with TESTFN
- Next message (by thread): [Python-Dev] Tests failing on Windows with TESTFN
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]