New submission from sfmc :
In Windows shutil.copy() uses _copyfileobj_readinto which copies file in user
mode.
In Windows there is an fast API to copy file in kernel mode: CopyFile (see
https://docs.microsoft.com/en-us/windows/win32/api/winbase/nf-winbase-copyfile).
--
components
sfmc added the comment:
> How about keeping a substitute or mapped drive from the input path
> if resolving the root path on the drive prefixes the overall real
> path? That would be pretty easy to implement.
So if the resolved path is accessible from the original path's drive,
sfmc added the comment:
> If you don't need to resolve symlinks, just use os.path.abspath() in Windows
> and os.path.realpath() in POSIX.
As I said, we already fixed it in our scripts.
The problem is with Python debugger and third-party tools - we can't make
changes there.
sfmc added the comment:
I see the point: the real path may not be accessible from the substitute drive:
- if symlink (or junction) is used, pointing to path not visible from the
substitute drive.
- if different security context is used (e.g. different user or UAC).
But that is the
New submission from sfmc :
For example if I mount directory
C:\example\dir
to
Z:\
the
os.path.realpath('Z:\\')
returns the real directory.
Use following commands in Windows to reproduce the issue:
md C:\example\dir
subst Z: C:\example\dir
python.exe -c "i