3 ms·
python.exe is the only other option to fulfill the Actually Portable requirement on Windows. Thing is, an APE is a COM file, not an EXE. Different headers, whi
by samatman 4y ago
python.exe is the only other option to fulfill the Actually Portable requirement on Windows.
Thing is, an APE is a COM file, not an EXE. Different headers, which contemporary Windows no longer cares about; but why lie about it? python.com is in COM format, as far as Windows is concerned.
Added for clarity: 'no longer cares about' meaning, Windows loads executables by checking the header for COM or EXE format and behaving accordingly, it's which of the two valid extensions gets used which it no longer cares about.
- jart 4y agoJust to clarify, APE is both an EXE and a COM file. The COM file format is basically just flat executable code. The only thing you need to do, to be a legal .com file, is if the program is loaded and execution starts from the first byte -- it works. APE meets that requirement for Linux and bare metal. It uses a polyglot to tell if the processor is running in real mode or long mode within its DOS stub. https://github.com/jart/cosmopolitan/blob/066ed2b2b229dce4d1f49be86179bb8efa9b9724/ape/ape.S#L171 https://github.com/jart/cosmopolitan/blob/066ed2b2b229dce4d1... APE is also a legal EXE file because it has the MZ header. However... I thought it'd be more cool to signal as a DOS binary than to signal as a Windows binary, since signalling as the latter would probably be a turnoff for the Mac/Linux/BSD crowds, who are also supported by APE.
- TaylorAlexander 4y agoThe base name of the file must be “python” and nothing else? This is where I thought more description could be used.