Does windows edit .py file shebangs?

Barry Scott barry at barrys-emacs.org
Sun Jan 3 10:29:13 EST 2021



> On 3 Jan 2021, at 15:13, Eryk Sun <eryksun at gmail.com> wrote:
> 
> 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>`.

Aha a reparse point! I've cleaned up too much to do this. 
I had to get back to a working state.

If it breaks again I'll use fsutils to investigate.

> 
>> 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.

The only time I every use the IDE is when I run the debugger everything
else I do from the command line. The only reason I ran the IDE at all is
that is the way to get it to update itself.

In other words its not that it "fixed" a file I was editing. I can only think
that it was part of the updating of Visual Studio that did this.

Barry


> -- 
> https://mail.python.org/mailman/listinfo/python-list
> 



More information about the Python-list mailing list