News for hackers. Stuff that matters.
Re:Actually Portable Executables by abhinav22 on Sunday February 28, 2021 @06:38AM (#26292648)
Thank you (and thanks to everybody else for their helpful answers). Your note on intel processors meaning in theory programs should run on all operating systems was most helpful and got me across the line - now I get it!
Re:Actually Portable Executables by jart on Sunday February 28, 2021 @06:58AM (#26292757)
That's pretty much it. Cosmopolitan Libc is the simplest project that could have happened decades ago. Anyone could have built it. There's never been a technical reason why an x86 binary can't run on all x86 operating systems. It's just that traditionally only operating systems publish C libraries, and they have no incentive to spend money supporting their competitors. So it's the kind of project that could only happen if it was done by an indie developer just trying to have fun.
Re:Actually Portable Executables by fctorial on Sunday February 28, 2021 @07:25AM (#26292901)
Another reason is that it requires fairly thorough knowledge of 7 different programming environments. Most people don't understand 1.
Re:Actually Portable Executables by jart on Sunday February 28, 2021 @08:03AM (#26293128)
The only programming environment I used to build this was Emacs on Linux. The rest was simply researching the magic numbers needed to use the binary interface of each system. I figured life's too short to be pulling my hair out with MSVC/Xcode warnings.
Re:Actually Portable Executables by fctorial on Sunday February 28, 2021 @12:51PM (#26295250)
s/programming environments/systems/
Re:Actually Portable Executables by lambda_obrien on Sunday February 28, 2021 @10:29AM (#26294018)
Does cosmolibc allow you to run on bare metal? If so, I've got an old project in mind that you may have just made happen, and I'm very very excited to know!
Re:Actually Portable Executables by collinmanderson on Monday March 01, 2021 @02:14PM (#26306882)
"Actually Portable Executable"s can boot from BIOS if that's what you're wondering.

https://justine.lol/ape.html

Re:Actually Portable Executables by lambda_obrien on Monday March 01, 2021 @05:49PM (#26309566)
Cool, thanks! I missed that before. It makes a project idea I had way more realistic for me to implement.
Re:Actually Portable Executables by thysultan on Sunday February 28, 2021 @07:33AM (#26292935)
How does one unzip the .com file? Is that even possible or have i misunderstood how it works?
Re:Actually Portable Executables by jart on Sunday February 28, 2021 @07:50AM (#26293041)
I recommend using InfoZIP on the Linux or Mac command line. For example, to list the files that are in your .com executables you can run a command like:

    $ wget https://justine.lol/redbean/redbean-2021-02-27.com
    $ unzip -vl redbean-2021-02-27.com
    Archive:  redbean-2021-02-27.com
     Length   Method    Size  Cmpr    Date    Time   CRC-32   Name
    --------  ------  ------- ---- ---------- ----- --------  ----
         426  Defl:N      215  50% 02-09-2021 09:24 f9cc9464  tool/net/redbean.css
         896  Defl:N      509  43% 02-09-2021 09:24 eb74f8a0  tool/net/redbean.html
       16958  Defl:N     6093  64% 02-09-2021 09:24 6a76bd39  tool/net/redbean.ico
        5073  Stored     5073   0% 02-09-2021 09:24 86c2afe6  tool/net/redbean.png
         554  Defl:N      285  49% 02-09-2021 09:24 0aa6870a  usr/share/zoneinfo/Beijing
        2335  Defl:N     1093  53% 02-09-2021 09:24 6ccd4450  usr/share/zoneinfo/Berlin
        2453  Defl:N     1170  52% 02-09-2021 09:24 7fed6d80  usr/share/zoneinfo/Boulder
    ...
Another ZIP tool that works well with APE is Windows 10 file explorer. But you have to change the extension from .com to .zip temporarily.