Does windows edit .py file shebangs?

Eryk Sun eryksun at gmail.com
Sun Jan 3 10:13:40 EST 2021


On 1/3/21, Barry Scott <barry at barrys-emacs.org> wrote:
>
> I've been doing some more investigation and found that the change happened
> at 01/01/2021 16:16. The shebang is pointing to a 0 length PYTHON3.EXE.

The files in "%LocalAppData%\Microsoft\WindowsApps" are AppExec
reparse points. NT filesystem reparse points are a generalized form of
filesystem link, with registered handlers indentified by a tag value
in the reparse data buffer. Various reparse-point types implement
Unix-style mountpoints and symlinks, as well as dynamic offline and
virtual files such as OneDrive.

AppExec reparse points (aka app execution aliases) have no handler in
the kernel, so they can only be accessed by directly opening them.
WinAPI CreateProcessW uses information in the link to locate the app
and create an access token that allows executing it. The app itself is
usually installed in a directory in "%ProgramFiles%\WindowsApps".

You can view the raw contents of a reparse point using `fsutil.exe
reparsepoint query <filename>`.

> Thinking back to the 1st I did run Visual Studio 2019 Community edition at
> that time. It was first time on a long time and I had to login and update it.

You could try to reproduce the scenario to see whether it modifies
your files. I wouldn't expect it to do something like that
automatically, but it does seem like the kind of 'helpful' thing a
full-service IDE would do when saving a script.


More information about the Python-list mailing list