Comments (14)
Thanks for the report and to everyone who's participated so far. I believe I've fixed this issue in 218ef49 and you can download the latest release binary here: https://justine.lol/redbean/index.html Please take a look and let me know if there's still any issues. See also #68
from cosmopolitan.
Same problem. Looks like zip
utility is corrupting it somehow.
This is how this executable looks in 7-zip before adding a file:
.data
file contains embedded files, but I can't add more with 7-zip, though I can see them:
Windows Explorer also can't add the files, so I've tried it on Debian and this is what I got after in exe viewed in 7-zip:
I can't even view file list anymore and launching, of course, gives an error. 0
file leads to infinite recursion, 1
gives a data error, and other two suggest opening them in other apps.
UPD: Tried InfoZIP and got the same problem. Even though file structure stood the same as original, it couldn't run on both Windows 10 and Debian Linux.
from cosmopolitan.
Awesome to hear!
from cosmopolitan.
Exactly the same error message.
Environment: Linux mine-OptiPlex-3020 4.15.0-136-generic #140~16.04.1-Ubuntu SMP Wed Feb 3 18:51:03 UTC 2021
from cosmopolitan.
Also seeing this on gentoo.
Linux athena 5.7.19-gentoo #1 SMP Fri Feb 12 18:48:22 PST 2021 x86_64 Intel(R) Core(TM) i7-4770K CPU @ 3.50GHz GenuineIntel GNU/Linux
.
Not sure if relevant, but the source is built from info zip 3.0 with these patches https://github.com/gentoo/gentoo/tree/master/app-arch/zip/files.
from cosmopolitan.
Same erro here after "zip redbean.zip index.htm":
$ strace ./redbean.zip -vv
execve("./redbean.zip", ["./redbean.zip", "-vv"], 0x7ffd17064ed8 /* 49 vars */) = 0
mmap(0x6ffffff00000, 1048576, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS|MAP_GROWSDOWN, -1, 0) = 0x6ffffff00000
fstat(1, {st_mode=S_IFCHR|0620, st_rdev=makedev(0x88, 0x4), ...}) = 0
rt_sigaction(SIGQUIT, {sa_handler=0x40bacd, sa_mask=~[QUIT ILL TRAP ABRT BUS FPE SEGV], sa_flags=SA_RESTORER|SA_RESETHAND, sa_restorer=0x423270}, {sa_handler=SIG_DFL, sa_mask=[], sa_flags=0}, 8) = 0
rt_sigaction(SIGFPE, {sa_handler=0x40bad8, sa_mask=~[QUIT ILL TRAP ABRT BUS FPE SEGV], sa_flags=SA_RESTORER|SA_RESETHAND, sa_restorer=0x423270}, {sa_handler=SIG_DFL, sa_mask=[], sa_flags=0}, 8) = 0
rt_sigaction(SIGILL, {sa_handler=0x40bae3, sa_mask=~[QUIT ILL TRAP ABRT BUS FPE SEGV], sa_flags=SA_RESTORER|SA_RESETHAND, sa_restorer=0x423270}, {sa_handler=SIG_DFL, sa_mask=[], sa_flags=0}, 8) = 0
rt_sigaction(SIGSEGV, {sa_handler=0x40baee, sa_mask=~[QUIT ILL TRAP ABRT BUS FPE SEGV], sa_flags=SA_RESTORER|SA_RESETHAND, sa_restorer=0x423270}, {sa_handler=SIG_DFL, sa_mask=[], sa_flags=0}, 8) = 0
rt_sigaction(SIGTRAP, {sa_handler=0x40baf9, sa_mask=~[QUIT ILL TRAP ABRT BUS FPE SEGV], sa_flags=SA_RESTORER|SA_RESETHAND, sa_restorer=0x423270}, {sa_handler=SIG_DFL, sa_mask=[], sa_flags=0}, 8) = 0
rt_sigaction(SIGABRT, {sa_handler=0x40bb04, sa_mask=~[QUIT ILL TRAP ABRT BUS FPE SEGV], sa_flags=SA_RESTORER|SA_RESETHAND, sa_restorer=0x423270}, {sa_handler=SIG_DFL, sa_mask=[], sa_flags=0}, 8) = 0
rt_sigaction(SIGBUS, {sa_handler=0x40bb0f, sa_mask=~[QUIT ILL TRAP ABRT BUS FPE SEGV], sa_flags=SA_RESTORER|SA_RESETHAND, sa_restorer=0x423270}, {sa_handler=SIG_DFL, sa_mask=[], sa_flags=0}, 8) = 0
sched_yield() = 0
clock_gettime(CLOCK_MONOTONIC, {tv_sec=1825028, tv_nsec=167775005}) = 0
nanosleep({tv_sec=0, tv_nsec=100000}, NULL) = 0
clock_gettime(CLOCK_MONOTONIC, {tv_sec=1825028, tv_nsec=168076770}) = 0
sched_yield() = 0
clock_gettime(CLOCK_MONOTONIC, {tv_sec=1825028, tv_nsec=168201910}) = 0
nanosleep({tv_sec=0, tv_nsec=100000}, NULL) = 0
clock_gettime(CLOCK_MONOTONIC, {tv_sec=1825028, tv_nsec=168496581}) = 0
sched_yield() = 0
clock_gettime(CLOCK_MONOTONIC, {tv_sec=1825028, tv_nsec=168631620}) = 0
nanosleep({tv_sec=0, tv_nsec=100000}, NULL) = 0
clock_gettime(CLOCK_MONOTONIC, {tv_sec=1825028, tv_nsec=168917611}) = 0
sched_yield() = 0
clock_gettime(CLOCK_MONOTONIC, {tv_sec=1825028, tv_nsec=169070493}) = 0
nanosleep({tv_sec=0, tv_nsec=100000}, NULL) = 0
clock_gettime(CLOCK_MONOTONIC, {tv_sec=1825028, tv_nsec=169410658}) = 0
clock_gettime(CLOCK_REALTIME, {tv_sec=1614401175, tv_nsec=351402}) = 0
mmap(0x100080000000, 65536, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0x100080000000
openat(AT_FDCWD, "./redbean.zip", O_RDONLY) = 3
fstat(3, {st_mode=S_IFREG|0755, st_size=204927, ...}) = 0
mmap(0x100080010000, 204927, PROT_READ, MAP_SHARED|MAP_FIXED, 3, 0) = 0x100080010000
mmap(0x100080050000, 65536, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0x100080050000
dup(3) = 4
close(4) = 0
mmap(0x100080060000, 65536, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0x100080060000
dup(3) = 4
close(4) = 0
openat(AT_FDCWD, "./redbean.zip", O_RDONLY) = 4
fstat(4, {st_mode=S_IFREG|0755, st_size=204927, ...}) = 0
mmap(0x100080070000, 204927, PROT_READ, MAP_SHARED|MAP_FIXED, 4, 0) = 0x100080070000
--- SIGSEGV {si_signo=SIGSEGV, si_code=SEGV_MAPERR, si_addr=0xffffffffffffffea} ---
openat(AT_FDCWD, "/proc/self/status", O_RDONLY) = 5
read(5, "Name:\tredbean.zip\nUmask:\t0022\nSt"..., 1012) = 1012
close(5) = 0
--- SIGTRAP {si_signo=SIGTRAP, si_code=SI_KERNEL} ---
rt_sigprocmask(SIG_SETMASK, 0x6ffffffff030, NULL, 16) = -1 EINVAL (Invalid argument)
getpid() = 34429
kill(34429, SIGABRT) = 0
--- SIGABRT {si_signo=SIGABRT, si_code=SI_USER, si_pid=34429, si_uid=1000} ---
rt_sigprocmask(SIG_SETMASK, 0x6fffffffe8f0, NULL, 16) = -1 EINVAL (Invalid argument)
getpid() = 34429
kill(34429, SIGABRT) = 0
exit_group(34429) = ?
+++ exited with 125 +++
from cosmopolitan.
FWIW, HN thread about this issue https://news.ycombinator.com/item?id=26272791
Looks like it doesn't work in Debian, Ubuntu, gentoo, Windows
from cosmopolitan.
Looks like it doesn't work in Debian, Ubuntu, gentoo, Windows
also ArchLinux has the same issue (after adding the index.html)
./redbean.com -vv
error: Uncaught SIGSEGV on archibold
./redbean.com
EINVAL/err=22/errno:2/GetLastError:0
Linux archibold 5.10.16-arch1-1 #1 SMP PREEMPT Sat, 13 Feb 2021 20:50:18 +0000
6fffffffef50 0000004228e9 UNKNOWN
6fffffffff80 00000040a2f1 UNKNOWN
6fffffffffc0 0000004027f3 UNKNOWN
6fffffffffe0 000000402a21 UNKNOWN
7ffe83877e50 00000040227b UNKNOWN
the zip version looks the same others are using too:
zip -v
Copyright (c) 1990-2008 Info-ZIP - Type 'zip "-L"' for software license.
This is Zip 3.0 (July 5th 2008), by Info-ZIP.
from cosmopolitan.
Same thing on alpine
Dockerfile
FROM alpine:3.13.2
RUN apk add curl
RUN apk add zip
RUN curl https://justine.lol/redbean/redbean-latest.com >redbean.com
RUN chmod +x redbean.com
RUN echo '<b>hello</b>' >index.html
RUN zip redbean.com index.html
CMD ./redbean.com -vv
Logs:
gaschu95@cloudshell:~/redbean-test$ docker build -t redbean .
Sending build context to Docker daemon 208.4kB
Step 1/8 : FROM alpine:3.13.2
3.13.2: Pulling from library/alpine
ba3557a56b15: Pull complete
Digest: sha256:a75afd8b57e7f34e4dad8d65e2c7ba2e1975c795ce1ee22fa34f8cf46f96a3be
Status: Downloaded newer image for alpine:3.13.2
---> 28f6e2705743
Step 2/8 : RUN apk add curl
---> Running in 91a7491d3de4
fetch https://dl-cdn.alpinelinux.org/alpine/v3.13/main/x86_64/APKINDEX.tar.gz
fetch https://dl-cdn.alpinelinux.org/alpine/v3.13/community/x86_64/APKINDEX.tar.gz
(1/5) Installing ca-certificates (20191127-r5)
(2/5) Installing brotli-libs (1.0.9-r3)
(3/5) Installing nghttp2-libs (1.42.0-r1)
(4/5) Installing libcurl (7.74.0-r0)
(5/5) Installing curl (7.74.0-r0)
Executing busybox-1.32.1-r3.trigger
Executing ca-certificates-20191127-r5.trigger
OK: 8 MiB in 19 packages
Removing intermediate container 91a7491d3de4
---> 7e8a28a77b5a
Step 3/8 : RUN apk add zip
---> Running in 8ab63d0e112d
(1/2) Installing unzip (6.0-r8)
(2/2) Installing zip (3.0-r9)
Executing busybox-1.32.1-r3.trigger
OK: 9 MiB in 21 packages
Removing intermediate container 8ab63d0e112d
---> c2471ba54769
Step 4/8 : RUN curl https://justine.lol/redbean/redbean-latest.com >redbean.com
---> Running in ea32a67eaac6
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 200k 100 200k 0 0 220k 0 --:--:-- --:--:-- --:--:-- 220k
Removing intermediate container ea32a67eaac6
---> 8879f3f2c32a
Step 5/8 : RUN chmod +x redbean.com
---> Running in 8c0a07dbd87e
Removing intermediate container 8c0a07dbd87e
---> d66b02e888e9
Step 6/8 : RUN echo '<b>hello</b>' >index.html
---> Running in def46d5e5196
Removing intermediate container def46d5e5196
---> b5b22af43778
Step 7/8 : RUN zip redbean.com index.html
---> Running in 52bb628e71e0
adding: index.html (stored 0%)
Removing intermediate container 52bb628e71e0
---> 41873995e17c
Step 8/8 : CMD ./redbean.com -vv
---> Running in 3a4aa8beddd1
Removing intermediate container 3a4aa8beddd1
---> f223aa23735e
Successfully built f223aa23735e
Successfully tagged redbean:latest
gaschu95@cloudshell:~/redbean-test$ docker run -p 8080:8080 redbean
error: Uncaught SIGSEGV on 0f54c1099f79
./redbean.com
EINVAL/err=22/errno:2/GetLastError:0
Linux 0f54c1099f79 5.4.89+ #1 SMP Sat Feb 13 19:45:14 PST 2021
6ffffffff050 0000004228e9 UNKNOWN
6fffffffff80 00000040a2f1 UNKNOWN
6fffffffffc0 0000004027f3 UNKNOWN
6fffffffffe0 000000402a21 UNKNOWN
7fffa27afeb0 00000040227b UNKNOWN
RAX ffffffffffffffea RBX 0000000000000002 RDI 0000000000000000 ST(0) 0.000000
RCX 0000000000000000 RDX fffffffffffeffea RSI 0000000000000000 ST(1) 0.000000
RBP 00006fffffffff80 RSP 00006ffffffffe78 RIP 00000000004228e9 ST(2) 0.000000
R8 0000000000000003 R9 0000000000000000 R10 0000000000000011 ST(3) 0.000000
R11 0000000000000297 R12 0000000000000004 R13 00007fffa27afec8 ST(4) 0.000000
R14 0000100080070000 R15 00007fffa27aff10 CF VF AF IF PE
XMM0 00000000000000004152c96020000000 XMM8 00000001c6e415960000000154442bd4
XMM1 0000001400000000ffffffffffff8f80 XMM9 c7ffff0c992785596d9b49152a4acc1a
XMM2 00000000ffffffff00000000ffffffff XMM10 00000000000000000000000000000000
XMM3 ffffffffffffffffff00000000000000 XMM11 00000000000000000000000000000000
XMM4 00000000000000000000000000000000 XMM12 00000000000000000000000000000000
XMM5 00000000e29ed9b33e8a30a710b5f380 XMM13 00000000000000000000000000000000
XMM6 302e322e334d2c544445355453450a01 XMM14 00000000000000000000000000000000
XMM7 01c0c7ffff00009ebaffff0201020102 XMM15 00000000000000000000000000000000
mm->i == 5;
mm->p[ 0]=={0x10008000,0x10008000}; /* 1 */
mm->p[ 1]=={0x10008001,0x10008004}; /* 4 */
mm->p[ 2]=={0x10008005,0x10008006}; /* 2 */
mm->p[ 3]=={0x10008007,0x1000800a}; /* 4 */
/* 1,610,579,941 */
mm->p[ 4]=={0x6ffffff0,0x6fffffff}; /* 16 */
/* 27 frames mapped w/ 1,610,579,941 frames gapped */
00400000-0042a000 r-xp 00000000 08:01 3457479 /redbean.com
0042a000-00432000 rw-p 0002a000 08:01 3457479 /redbean.com
00432000-00460000 rw-p 00000000 00:00 0
100080000000-100080010000 rw-p 00000000 00:00 0
100080010000-100080042000 r--s 00000000 08:01 3457479 /redbean.com
100080050000-100080070000 rw-p 00000000 00:00 0
100080070000-1000800a2000 r--s 00000000 08:01 3457479 /redbean.com
6ffffff00000-700000000000 rw-p 00000000 00:00 0
7fffa2790000-7fffa27b1000 rw-p 00000000 00:00 0 [stack]
7fffa27ef000-7fffa27f2000 r--p 00000000 00:00 0 [vvar]
7fffa27f2000-7fffa27f4000 r-xp 00000000 00:00 0 [vdso]
ffffffffff600000-ffffffffff601000 r-xp 00000000 00:00 0 [vsyscall]
./redbean.com -vv
from cosmopolitan.
I wonder what zip version would do the trick here ... but at this point, after reading so much awesome wizardry, I also wonder if the executable could ship within itself a zip executable with an --add file
in it 😅 (and a --remove file
too)
that would make it even more universally awesome, as it wouldn't need OS specific version of a zip format, still keeping zip compatibility 🥳
from cosmopolitan.
I can confirm, at least in ArchLinux, everything works as expected. Thank you very much again for this wonder 👍
from cosmopolitan.
Confirm, works now on my Debian Linux. Keep up the good work!
from cosmopolitan.
Confirmed working on MacOS 11 (Big Sur).
from cosmopolitan.
Confirming Ubuntu. Now, posted some features wishlist #95
from cosmopolitan.
Related Issues (20)
- Allow replacing `jartsr=` magic with `#!/bin/sh` header
- cosmocc segfaults on static struct sigaction HOT 2
- confstr() is declared in <stdio.h> rather than <unistd.h>
- Python binary is packaged without certificates HOT 4
- [Windows] execve regression
- test/posix/fread3gb_test fails on XnuSilicon
- cosmo.zip offiline? HOT 3
- llamafile --assimilate: corrupted program header size HOT 1
- test/libc/calls/open_test: open_readOnlyCreatMode gives wrong errno, but not with --strace, on linux aarch64 HOT 1
- Bug: Mac llamafile make issue HOT 1
- testing github autolabeler label is too noisy
- Bug: On Windows, cosmos GNU coreutils ls not printing correct result for `ls ../../` HOT 6
- compile_commands.json generator for clangd integration HOT 1
- Bug: Lua fails a `seek`-related test
- Bug: Lua's `ltests.c` doesn't compile
- Bug: secondary redbean SQLite WAL connections lock after first write HOT 4
- With set_toolchains("@cosmocc") : fatal error: string: No such file or directory HOT 4
- Feature Request: use versioned files at https://cosmo.zip/pub/cosmos/zip/
- Bug: cosmo rsync appears to hang on Windows arm64 HOT 5
- Typo in new specification HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from cosmopolitan.