Live data from Hacker News

Show HN: Redbean – Single-file distributable web server

justine.lol

251–260 of 264 posts

Re: Show HN: Redbean – Single-file distributable web server

#251

error:./printimage.com: check failed: 0x0 != 0x0 (0) 6ffffffffe30 0000004025db UNKNOWN 6ffffffffe40 0000004023a7 UNKNOWN 6fffffffffb0 000000401862 UNKNOWN 6ffffffffff0 000000401ed1 UNKNOWN Run on ubuntu 14? There's nothing running on :8080. Not sure what I'm going wrong.

Upd: works. printimage didn't like the jpeg I tried testing with the first time.

Re: Show HN: Redbean – Single-file distributable web server

#252

Earlier quoted context omitted.

This is too real. Except at this point, after 25 years I have probably ten of these.

I've been thinking of putting together github repo which is just an index out to people's snowflakes. If I do, I'll reach out.

Do it. I’d enjoy perusing it.

Re: Show HN: Redbean – Single-file distributable web server

#253
post #42

Am I the only one having issues trying to get this working? The webserver starts just fine, but once I add the index.html with zip as in the example, it stops working. This is on Mac 10.15, CentOS 8 and Ubuntu 18.04 LTS. Centos: [centos@test ~]$ ./redbean.com -vv error: Uncaught SIGSEGV on test.novalocal ./redbean.com EINVAL/err=22/errno:2/GetLastError:0 Linux test.novalocal 4.18.0-240.10.1.el8_3.x86_64 #1 SMP Mon Ja…

IIRC, from vague memories of things flying past, Big Sur won't let a modified binary run once it's been checked by Gatekeeper. Which means the first run gets checked and notarised but when you add the `index.html`, the on-disk binary has changed and Gatekeeper won't allow it to run - I guess it's to prevent malicious code modifications, etc.

What happens if you switch off Gatekeeper?

`sudo spctl --master-disable`

Re: Show HN: Redbean – Single-file distributable web server

#254
post #244

Earlier quoted context omitted.

I've been programming since before you were born... and this is the most impressive hacking feat I've ever seen. A single executable, that doubles as a valid ZIP file, that you can put a complete website into, also doubles as a valid executable on Windows, Mac, Linux. The build infrastructure is a complete reworking of C to make it far more portable than even K&R thought possible. I probably wouldn't have believed it…

Multi OS/arch executables exists for decades. They were called fat-binaries[0]. Old trick is new again. [0]: https://en.wikipedia.org/wiki/Fat_binary https://en.wikipedia.org/wiki/Universal_binary

But compared to what jart has done, those were effectively cheating. ;) They just smooshed multiple binaries into a single file.

Re: Show HN: Redbean – Single-file distributable web server

#255
post #10

I just spent 30 minutes reading about this. I'm so shocked that I'm logging in to comment after 5 years of lurking. Justine has built a c library that allows you compile a binary once and have it run it on any os or baremetal. The SAME binary. Quite frankly, that sentence doesn't even make sense to me. Check out https://storage.googleapis.com/justine/cosmopolitan/index.ht... As far as I'm concerned, this is literal m…

Agreed, this is the best programming-related thing I've seen on the internet in a long time. It reminds me of when I was a teenager, excited to become a computer programmer. Then I grew up and joined the real world workforce and it was all far less exciting than I imagined. The coolest thing about this Actually Portable Executable is that once there's a compiler and linker built with it, I can play around with writin…

I think it's really cool project; but could you explain why it's important that a binary works everywhere for you? I don't really get the enthusiasm for this sort of thing.

Maybe I have a blind spot or something or I've just been in Unix-land for too long.

Re: Show HN: Redbean – Single-file distributable web server

#256

As amazing as this is unfortunately it doesn't work for me and I am on Linux. I get bash: ./redbean.com: No such file or directory after chmod-ing. Maybe I am dumb but yeah.

When I downloaded the file, it also had the date in the name. You have to accommodate that change in the instructions. Also be sure to run bash -c './redbean.com -vv' (also with the name as downloaded).

Re: Show HN: Redbean – Single-file distributable web server

#257
post #255

Earlier quoted context omitted.

Agreed, this is the best programming-related thing I've seen on the internet in a long time. It reminds me of when I was a teenager, excited to become a computer programmer. Then I grew up and joined the real world workforce and it was all far less exciting than I imagined. The coolest thing about this Actually Portable Executable is that once there's a compiler and linker built with it, I can play around with writin…

I think it's really cool project; but could you explain why it's important that a binary works everywhere for you? I don't really get the enthusiasm for this sort of thing. Maybe I have a blind spot or something or I've just been in Unix-land for too long.

I think the UNIX thing is the blind spot. People who run Linux or BSD don't seem so bothered to recompile for their own platform, safe in the knowledge that it will almost certainly just work.

But on Windows, trying to get open source software written in C to compile has been a pain for decades. There have been some attempts to make it work (notably Cygwin, and now MSYS2), but it can still be challenging, especially with programs that were never designed to be compiled for non-UNIX (or non-Linux!) targets.

Having a C library that is designed from the ground up to target multiple operating systems, and an executable format that means the first compile is the only compile, that takes away a lot of toil that programmers normally have when trying to build their own abstractions around each platform's C library. I guess from UNIX land you could see the benefit as removing the need for autoconf or platform ifdefs.

Re: Show HN: Redbean – Single-file distributable web server

#258
post #42

Am I the only one having issues trying to get this working? The webserver starts just fine, but once I add the index.html with zip as in the example, it stops working. This is on Mac 10.15, CentOS 8 and Ubuntu 18.04 LTS. Centos: [centos@test ~]$ ./redbean.com -vv error: Uncaught SIGSEGV on test.novalocal ./redbean.com EINVAL/err=22/errno:2/GetLastError:0 Linux test.novalocal 4.18.0-240.10.1.el8_3.x86_64 #1 SMP Mon Ja…

Fixed for me (macOS) in this[1] commit.

[1] https://github.com/jart/cosmopolitan/commit/218ef491476f15ab...

Re: Show HN: Redbean – Single-file distributable web server

#259
post #10

I just spent 30 minutes reading about this. I'm so shocked that I'm logging in to comment after 5 years of lurking. Justine has built a c library that allows you compile a binary once and have it run it on any os or baremetal. The SAME binary. Quite frankly, that sentence doesn't even make sense to me. Check out https://storage.googleapis.com/justine/cosmopolitan/index.ht... As far as I'm concerned, this is literal m…

Wow, that cosmopolitan C library is absolutely awesome. The ABI specialization is extremely interesting. Never seen anything like that before. I thought compilers did that. I don't understand why they couldn't properly optimize memcpy. I wonder how it handles system calls. Let me check the source... https://github.com/jart/cosmopolitan/blob/master/tool/build/... https://github.com/jart/cosmopolitan/blob/master/tool/b…

"...it calls Linux "GNU/Systemd""

Yeah, it would have taken less bits to use GNU/POS instead, because it ain't Linux anymore.

Poettering Operating System.

Post reply on HN