Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

spawnve_test flakes w/ enomem #14

Closed
tankf33der opened this issue Dec 28, 2020 · 10 comments
Closed

spawnve_test flakes w/ enomem #14

tankf33der opened this issue Dec 28, 2020 · 10 comments
Assignees

Comments

@tankf33der
Copy link

tankf33der commented Dec 28, 2020

$ git clone https://github.com/jart/cosmopolitan.git
$ cd cosmopolitan
$ sudo sh -c "echo ':APE:M::MZqFpD::/bin/sh:' >/proc/sys/fs/binfmt_misc/register"
$ make -j8
OBJCOPY        o//test/libc/dns/dnsnamecmp_test.com
error:test/libc/calls/hefty/spawnve_test.c:55: spawnve_testExit()
	ASSERT_NE(-1, (pid = spawnlp(0, NULL, CMD, CMD, ARG, "exit 42", NULL)))
		need -1	(or 0xffffffffffffffffffffffffffffffff) ≠
		 got -1	(or 0xffffffffffffffffffffffffffffffff)
	ENOMEM/err=12/errno:12/GetLastError:0
	o//test/libc/calls/hefty/spawnve_test.com
1 / 4 tests failed
make: *** [build/rules.mk:76: o//test/libc/calls/hefty/spawnve_test.com.runs] Error 1
OBJCOPY        o//test/libc/fmt/basename_test.com
@tankf33der tankf33der changed the title cant build on Manjaro (ArchLinux) cant build on Manjaro (x64) Dec 28, 2020
@jart jart changed the title cant build on Manjaro (x64) spawnve_test flakes w/ enomem Dec 29, 2020
@jart
Copy link
Owner

jart commented Dec 29, 2020

image

Looks like Manjaro Linux is fully supported. I'm still attempting to reproduce this error. Out of curiosity what are the specs on your system? I.e. how much RAM etc.

@jart
Copy link
Owner

jart commented Dec 29, 2020

Could you run:

strace -ff o/test/libc/calls/hefty/spawnve_test.com 2>log.txt

And post the contents of log.txt here?

@tankf33der
Copy link
Author

8GB RAM on laptop, no running software, only firefox and terminal.

$ cat /proc/meminfo | head -3
MemTotal:        8044996 kB
MemFree:         2453924 kB
MemAvailable:    6305244 kB
$
$ strace -ff o/test/libc/calls/hefty/spawnve_test.com 2>log.txt
Trace/breakpoint trap (core dumped)
$ cat log.txt 
execve("o/test/libc/calls/hefty/spawnve_test.com", ["o/test/libc/calls/hefty/spawnve_"...], 0x7fffb7c92428 /* 61 vars */) = 0
brk(NULL)                               = 0x563cbe98c000
arch_prctl(0x3001 /* ARCH_??? */, 0x7ffdce8dd990) = -1 EINVAL (Invalid argument)
access("/etc/ld.so.preload", R_OK)      = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/etc/ld.so.cache", O_RDONLY|O_CLOEXEC) = 3
fstat(3, {st_mode=S_IFREG|0644, st_size=266599, ...}) = 0
mmap(NULL, 266599, PROT_READ, MAP_PRIVATE, 3, 0) = 0x7f1c632d7000
close(3)                                = 0
openat(AT_FDCWD, "/usr/lib/libreadline.so.8", O_RDONLY|O_CLOEXEC) = 3
read(3, "\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0 `\1\0\0\0\0\0"..., 832) = 832
fstat(3, {st_mode=S_IFREG|0755, st_size=326416, ...}) = 0
mmap(NULL, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f1c632d5000
mmap(NULL, 334344, PROT_READ, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x7f1c63283000
mmap(0x7f1c63299000, 163840, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x16000) = 0x7f1c63299000
mmap(0x7f1c632c1000, 40960, PROT_READ, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x3e000) = 0x7f1c632c1000
mmap(0x7f1c632cb000, 36864, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x47000) = 0x7f1c632cb000
mmap(0x7f1c632d4000, 2568, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0x7f1c632d4000
close(3)                                = 0
openat(AT_FDCWD, "/usr/lib/libdl.so.2", O_RDONLY|O_CLOEXEC) = 3
read(3, "\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0\20\22\0\0\0\0\0\0"..., 832) = 832
fstat(3, {st_mode=S_IFREG|0755, st_size=18608, ...}) = 0
mmap(NULL, 20624, PROT_READ, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x7f1c6327d000
mmap(0x7f1c6327e000, 8192, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x1000) = 0x7f1c6327e000
mmap(0x7f1c63280000, 4096, PROT_READ, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x3000) = 0x7f1c63280000
mmap(0x7f1c63281000, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x3000) = 0x7f1c63281000
close(3)                                = 0
openat(AT_FDCWD, "/usr/lib/libc.so.6", O_RDONLY|O_CLOEXEC) = 3
read(3, "\177ELF\2\1\1\3\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0\220\202\2\0\0\0\0\0"..., 832) = 832
pread64(3, "\6\0\0\0\4\0\0\0@\0\0\0\0\0\0\0@\0\0\0\0\0\0\0@\0\0\0\0\0\0\0"..., 784, 64) = 784
pread64(3, "\4\0\0\0\20\0\0\0\5\0\0\0GNU\0\2\0\0\300\4\0\0\0\3\0\0\0\0\0\0\0", 32, 848) = 32
pread64(3, "\4\0\0\0\24\0\0\0\3\0\0\0GNU\0\207\360\21\247\344\314?\306\nT\320\323\335i\16t"..., 68, 880) = 68
fstat(3, {st_mode=S_IFREG|0755, st_size=2159552, ...}) = 0
pread64(3, "\6\0\0\0\4\0\0\0@\0\0\0\0\0\0\0@\0\0\0\0\0\0\0@\0\0\0\0\0\0\0"..., 784, 64) = 784
mmap(NULL, 1868448, PROT_READ, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x7f1c630b4000
mmap(0x7f1c630da000, 1363968, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x26000) = 0x7f1c630da000
mmap(0x7f1c63227000, 311296, PROT_READ, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x173000) = 0x7f1c63227000
mmap(0x7f1c63273000, 24576, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x1be000) = 0x7f1c63273000
mmap(0x7f1c63279000, 12960, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0x7f1c63279000
close(3)                                = 0
openat(AT_FDCWD, "/usr/lib/libncursesw.so.6", O_RDONLY|O_CLOEXEC) = 3
read(3, "\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0 p\1\0\0\0\0\0"..., 832) = 832
fstat(3, {st_mode=S_IFREG|0755, st_size=457736, ...}) = 0
mmap(NULL, 462072, PROT_READ, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x7f1c63043000
mmap(0x7f1c6305a000, 245760, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x17000) = 0x7f1c6305a000
mmap(0x7f1c63096000, 98304, PROT_READ, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x53000) = 0x7f1c63096000
mmap(0x7f1c630ae000, 24576, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x6a000) = 0x7f1c630ae000
close(3)                                = 0
mmap(NULL, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f1c63041000
arch_prctl(ARCH_SET_FS, 0x7f1c63041b80) = 0
mprotect(0x7f1c63273000, 12288, PROT_READ) = 0
mprotect(0x7f1c630ae000, 20480, PROT_READ) = 0
mprotect(0x7f1c63281000, 4096, PROT_READ) = 0
mprotect(0x7f1c632cb000, 12288, PROT_READ) = 0
mprotect(0x563cbe3d7000, 12288, PROT_READ) = 0
mprotect(0x7f1c63345000, 4096, PROT_READ) = 0
munmap(0x7f1c632d7000, 266599)          = 0
openat(AT_FDCWD, "/dev/tty", O_RDWR|O_NONBLOCK) = 3
close(3)                                = 0
brk(NULL)                               = 0x563cbe98c000
brk(0x563cbe9ad000)                     = 0x563cbe9ad000
openat(AT_FDCWD, "/usr/lib/locale/locale-archive", O_RDONLY|O_CLOEXEC) = 3
fstat(3, {st_mode=S_IFREG|0644, st_size=5632848, ...}) = 0
mmap(NULL, 5632848, PROT_READ, MAP_PRIVATE, 3, 0) = 0x7f1c62ae1000
close(3)                                = 0
openat(AT_FDCWD, "/usr/lib/gconv/gconv-modules.cache", O_RDONLY) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/usr/lib/gconv/gconv-modules", O_RDONLY|O_CLOEXEC) = 3
fstat(3, {st_mode=S_IFREG|0644, st_size=56353, ...}) = 0
read(3, "# GNU libc iconv configuration.\n"..., 4096) = 4096
read(3, "B1002//\tJUS_I.B1.002//\nmodule\tJU"..., 4096) = 4096
read(3, "\tISO-IR-110//\t\tISO-8859-4//\nalia"..., 4096) = 4096
read(3, "\t\t\tISO-8859-14//\nalias\tISO_8859-"..., 4096) = 4096
read(3, "DIC-ES//\nalias\tEBCDICES//\t\tEBCDI"..., 4096) = 4096
read(3, "CDIC-CP-ES//\t\tIBM284//\nalias\tCSI"..., 4096) = 4096
read(3, "\t\tIBM863//\nalias\tOSF1002035F//\t\t"..., 4096) = 4096
read(3, "937//\t\tIBM937//\nmodule\tIBM937//\t"..., 4096) = 4096
read(3, "UJIS//\t\t\tEUC-JP//\nmodule\tEUC-JP/"..., 4096) = 4096
read(3, "lias\tISO2022CN//\t\tISO-2022-CN//\n"..., 4096) = 4096
read(3, "O_5427-EXT//\nalias\tISO_5427EXT//"..., 4096) = 4096
read(3, "ost\nmodule\tMAC-SAMI//\t\tINTERNAL\t"..., 4096) = 4096
read(3, "112//\t\tINTERNAL\t\tIBM1112\t\t1\nmodu"..., 4096) = 4096
brk(0x563cbe9ce000)                     = 0x563cbe9ce000
read(3, "s\tCP9448//\t\tIBM9448//\nalias\tCSIB"..., 4096) = 3105
read(3, "", 4096)                       = 0
close(3)                                = 0
getuid()                                = 1000
getgid()                                = 1001
geteuid()                               = 1000
getegid()                               = 1001
rt_sigprocmask(SIG_BLOCK, NULL, [], 8)  = 0
ioctl(-1, TIOCGPGRP, 0x7ffdce8dd7e4)    = -1 EBADF (Bad file descriptor)
sysinfo({uptime=139402, loads=[64928, 72736, 66912], totalram=8238075904, freeram=2517905408, sharedram=237871104, bufferram=585768960, totalswap=9446825984, freeswap=9446825984, procs=683, totalhigh=0, freehigh=0, mem_unit=1}) = 0
rt_sigaction(SIGCHLD, {sa_handler=SIG_DFL, sa_mask=[], sa_flags=SA_RESTORER|SA_RESTART, sa_restorer=0x7f1c630f16a0}, {sa_handler=SIG_DFL, sa_mask=[], sa_flags=0}, 8) = 0
rt_sigaction(SIGCHLD, {sa_handler=SIG_DFL, sa_mask=[], sa_flags=SA_RESTORER|SA_RESTART, sa_restorer=0x7f1c630f16a0}, {sa_handler=SIG_DFL, sa_mask=[], sa_flags=SA_RESTORER|SA_RESTART, sa_restorer=0x7f1c630f16a0}, 8) = 0
rt_sigaction(SIGINT, {sa_handler=SIG_DFL, sa_mask=[], sa_flags=SA_RESTORER, sa_restorer=0x7f1c630f16a0}, {sa_handler=SIG_DFL, sa_mask=[], sa_flags=0}, 8) = 0
rt_sigaction(SIGINT, {sa_handler=SIG_DFL, sa_mask=[], sa_flags=SA_RESTORER, sa_restorer=0x7f1c630f16a0}, {sa_handler=SIG_DFL, sa_mask=[], sa_flags=SA_RESTORER, sa_restorer=0x7f1c630f16a0}, 8) = 0
rt_sigaction(SIGQUIT, {sa_handler=SIG_DFL, sa_mask=[], sa_flags=SA_RESTORER, sa_restorer=0x7f1c630f16a0}, {sa_handler=SIG_DFL, sa_mask=[], sa_flags=0}, 8) = 0
rt_sigaction(SIGQUIT, {sa_handler=SIG_DFL, sa_mask=[], sa_flags=SA_RESTORER, sa_restorer=0x7f1c630f16a0}, {sa_handler=SIG_DFL, sa_mask=[], sa_flags=SA_RESTORER, sa_restorer=0x7f1c630f16a0}, 8) = 0
rt_sigaction(SIGTSTP, {sa_handler=SIG_DFL, sa_mask=[], sa_flags=SA_RESTORER, sa_restorer=0x7f1c630f16a0}, {sa_handler=SIG_DFL, sa_mask=[], sa_flags=0}, 8) = 0
rt_sigaction(SIGTSTP, {sa_handler=SIG_DFL, sa_mask=[], sa_flags=SA_RESTORER, sa_restorer=0x7f1c630f16a0}, {sa_handler=SIG_DFL, sa_mask=[], sa_flags=SA_RESTORER, sa_restorer=0x7f1c630f16a0}, 8) = 0
rt_sigaction(SIGTTIN, {sa_handler=SIG_DFL, sa_mask=[], sa_flags=SA_RESTORER, sa_restorer=0x7f1c630f16a0}, {sa_handler=SIG_DFL, sa_mask=[], sa_flags=0}, 8) = 0
rt_sigaction(SIGTTIN, {sa_handler=SIG_DFL, sa_mask=[], sa_flags=SA_RESTORER, sa_restorer=0x7f1c630f16a0}, {sa_handler=SIG_DFL, sa_mask=[], sa_flags=SA_RESTORER, sa_restorer=0x7f1c630f16a0}, 8) = 0
rt_sigaction(SIGTTOU, {sa_handler=SIG_DFL, sa_mask=[], sa_flags=SA_RESTORER, sa_restorer=0x7f1c630f16a0}, {sa_handler=SIG_DFL, sa_mask=[], sa_flags=0}, 8) = 0
rt_sigaction(SIGTTOU, {sa_handler=SIG_DFL, sa_mask=[], sa_flags=SA_RESTORER, sa_restorer=0x7f1c630f16a0}, {sa_handler=SIG_DFL, sa_mask=[], sa_flags=SA_RESTORER, sa_restorer=0x7f1c630f16a0}, 8) = 0
rt_sigprocmask(SIG_BLOCK, NULL, [], 8)  = 0
rt_sigaction(SIGQUIT, {sa_handler=SIG_IGN, sa_mask=[], sa_flags=SA_RESTORER, sa_restorer=0x7f1c630f16a0}, {sa_handler=SIG_DFL, sa_mask=[], sa_flags=SA_RESTORER, sa_restorer=0x7f1c630f16a0}, 8) = 0
uname({sysname="Linux", nodename="lambda", ...}) = 0
stat("/home/mpech/cosmopolitan", {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0
stat(".", {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0
stat("/home", {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0
stat("/home/mpech", {st_mode=S_IFDIR|0700, st_size=20480, ...}) = 0
stat("/home/mpech/cosmopolitan", {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0
stat("/home/mpech", {st_mode=S_IFDIR|0700, st_size=20480, ...}) = 0
getpid()                                = 79421
getppid()                               = 79418
getpid()                                = 79421
getpgrp()                               = 79418
ioctl(2, TIOCGPGRP, 0x7ffdce8dd6a4)     = -1 ENOTTY (Inappropriate ioctl for device)
rt_sigaction(SIGCHLD, {sa_handler=0x563cbe3485a0, sa_mask=[], sa_flags=SA_RESTORER|SA_RESTART, sa_restorer=0x7f1c630f16a0}, {sa_handler=SIG_DFL, sa_mask=[], sa_flags=SA_RESTORER|SA_RESTART, sa_restorer=0x7f1c630f16a0}, 8) = 0
ioctl(2, TIOCGPGRP, 0x7ffdce8dd684)     = -1 ENOTTY (Inappropriate ioctl for device)
prlimit64(0, RLIMIT_NPROC, NULL, {rlim_cur=31334, rlim_max=31334}) = 0
rt_sigprocmask(SIG_BLOCK, NULL, [], 8)  = 0
openat(AT_FDCWD, "o/test/libc/calls/hefty/spawnve_test.com", O_RDONLY) = 3
stat("o/test/libc/calls/hefty/spawnve_test.com", {st_mode=S_IFREG|0755, st_size=94208, ...}) = 0
ioctl(3, TCGETS, 0x7ffdce8dd770)        = -1 ENOTTY (Inappropriate ioctl for device)
lseek(3, 0, SEEK_CUR)                   = 0
read(3, "MZqFpD='\n\0\0\20\0\370\0\0\0\0\0\0\0\1\0\10@\0\0\0\0\0\0\0"..., 80) = 80
lseek(3, 0, SEEK_SET)                   = 0
prlimit64(0, RLIMIT_NOFILE, NULL, {rlim_cur=1024, rlim_max=512*1024}) = 0
fcntl(255, F_GETFD)                     = -1 EBADF (Bad file descriptor)
dup2(3, 255)                            = 255
close(3)                                = 0
fcntl(255, F_SETFD, FD_CLOEXEC)         = 0
fcntl(255, F_GETFL)                     = 0x8000 (flags O_RDONLY|O_LARGEFILE)
fstat(255, {st_mode=S_IFREG|0755, st_size=94208, ...}) = 0
lseek(255, 0, SEEK_CUR)                 = 0
read(255, "MZqFpD='\n\0\0\20\0\370\0\0\0\0\0\0\0\1\0\10@\0\0\0\0\0\0\0"..., 8192) = 8192
rt_sigprocmask(SIG_BLOCK, NULL, [], 8)  = 0
rt_sigprocmask(SIG_BLOCK, NULL, [], 8)  = 0
pipe([3, 4])                            = 0
rt_sigprocmask(SIG_BLOCK, [CHLD], [], 8) = 0
rt_sigprocmask(SIG_SETMASK, [], NULL, 8) = 0
rt_sigprocmask(SIG_BLOCK, [INT CHLD], [], 8) = 0
lseek(255, -7651, SEEK_CUR)             = 541
clone(child_stack=NULL, flags=CLONE_CHILD_CLEARTID|CLONE_CHILD_SETTID|SIGCHLD, child_tidptr=0x7f1c63041e50) = 79422
strace: Process 79422 attached
[pid 79421] rt_sigprocmask(SIG_SETMASK, [],  <unfinished ...>
[pid 79422] getpid( <unfinished ...>
[pid 79421] <... rt_sigprocmask resumed>NULL, 8) = 0
[pid 79422] <... getpid resumed>)       = 79422
[pid 79421] rt_sigaction(SIGCHLD, {sa_handler=0x563cbe3485a0, sa_mask=[], sa_flags=SA_RESTORER|SA_RESTART, sa_restorer=0x7f1c630f16a0}, {sa_handler=0x563cbe3485a0, sa_mask=[], sa_flags=SA_RESTORER|SA_RESTART, sa_restorer=0x7f1c630f16a0}, 8) = 0
[pid 79421] close(4 <unfinished ...>
[pid 79422] close(255 <unfinished ...>
[pid 79421] <... close resumed>)        = 0
[pid 79421] read(3,  <unfinished ...>
[pid 79422] <... close resumed>)        = 0
[pid 79422] rt_sigprocmask(SIG_SETMASK, [], NULL, 8) = 0
[pid 79422] rt_sigaction(SIGTSTP, {sa_handler=SIG_DFL, sa_mask=[], sa_flags=SA_RESTORER, sa_restorer=0x7f1c630f16a0}, {sa_handler=SIG_DFL, sa_mask=[], sa_flags=SA_RESTORER, sa_restorer=0x7f1c630f16a0}, 8) = 0
[pid 79422] rt_sigaction(SIGTTIN, {sa_handler=SIG_DFL, sa_mask=[], sa_flags=SA_RESTORER, sa_restorer=0x7f1c630f16a0}, {sa_handler=SIG_DFL, sa_mask=[], sa_flags=SA_RESTORER, sa_restorer=0x7f1c630f16a0}, 8) = 0
[pid 79422] rt_sigaction(SIGTTOU, {sa_handler=SIG_DFL, sa_mask=[], sa_flags=SA_RESTORER, sa_restorer=0x7f1c630f16a0}, {sa_handler=SIG_DFL, sa_mask=[], sa_flags=SA_RESTORER, sa_restorer=0x7f1c630f16a0}, 8) = 0
[pid 79422] rt_sigaction(SIGINT, {sa_handler=SIG_DFL, sa_mask=[], sa_flags=SA_RESTORER, sa_restorer=0x7f1c630f16a0}, {sa_handler=SIG_DFL, sa_mask=[], sa_flags=SA_RESTORER, sa_restorer=0x7f1c630f16a0}, 8) = 0
[pid 79422] rt_sigaction(SIGQUIT, {sa_handler=SIG_DFL, sa_mask=[], sa_flags=SA_RESTORER, sa_restorer=0x7f1c630f16a0}, {sa_handler=SIG_IGN, sa_mask=[], sa_flags=SA_RESTORER, sa_restorer=0x7f1c630f16a0}, 8) = 0
[pid 79422] rt_sigaction(SIGCHLD, {sa_handler=SIG_DFL, sa_mask=[], sa_flags=SA_RESTORER|SA_RESTART, sa_restorer=0x7f1c630f16a0}, {sa_handler=0x563cbe3485a0, sa_mask=[], sa_flags=SA_RESTORER|SA_RESTART, sa_restorer=0x7f1c630f16a0}, 8) = 0
[pid 79422] rt_sigaction(SIGCHLD, {sa_handler=0x563cbe3485a0, sa_mask=[], sa_flags=SA_RESTORER|SA_RESTART, sa_restorer=0x7f1c630f16a0}, {sa_handler=SIG_DFL, sa_mask=[], sa_flags=SA_RESTORER|SA_RESTART, sa_restorer=0x7f1c630f16a0}, 8) = 0
[pid 79422] rt_sigaction(SIGINT, {sa_handler=0x563cbe366d20, sa_mask=[], sa_flags=SA_RESTORER, sa_restorer=0x7f1c630f16a0}, {sa_handler=SIG_DFL, sa_mask=[], sa_flags=SA_RESTORER, sa_restorer=0x7f1c630f16a0}, 8) = 0
[pid 79422] dup2(4, 1)                  = 1
[pid 79422] close(4)                    = 0
[pid 79422] close(3)                    = 0
[pid 79422] rt_sigprocmask(SIG_BLOCK, NULL, [], 8) = 0
[pid 79422] stat("o/test/libc/calls/hefty/spawnve_test.com", {st_mode=S_IFREG|0755, st_size=94208, ...}) = 0
[pid 79422] stat("o/test/libc/calls/hefty/spawnve_test.com", {st_mode=S_IFREG|0755, st_size=94208, ...}) = 0
[pid 79422] geteuid()                   = 1000
[pid 79422] getegid()                   = 1001
[pid 79422] getuid()                    = 1000
[pid 79422] getgid()                    = 1001
[pid 79422] access("o/test/libc/calls/hefty/spawnve_test.com", X_OK) = 0
[pid 79422] stat("o/test/libc/calls/hefty/spawnve_test.com", {st_mode=S_IFREG|0755, st_size=94208, ...}) = 0
[pid 79422] geteuid()                   = 1000
[pid 79422] getegid()                   = 1001
[pid 79422] getuid()                    = 1000
[pid 79422] getgid()                    = 1001
[pid 79422] access("o/test/libc/calls/hefty/spawnve_test.com", R_OK) = 0
[pid 79422] fstat(1, {st_mode=S_IFIFO|0600, st_size=0, ...}) = 0
[pid 79422] write(1, "o/test/libc/calls/hefty/spawnve_"..., 41) = 41
[pid 79421] <... read resumed>"o/test/libc/calls/hefty/spawnve_"..., 128) = 41
[pid 79421] read(3,  <unfinished ...>
[pid 79422] exit_group(0)               = ?
[pid 79421] <... read resumed>"", 128)  = 0
[pid 79422] +++ exited with 0 +++
--- SIGCHLD {si_signo=SIGCHLD, si_code=CLD_EXITED, si_pid=79422, si_uid=1000, si_status=0, si_utime=0, si_stime=0} ---
wait4(-1, [{WIFEXITED(s) && WEXITSTATUS(s) == 0}], WNOHANG, NULL) = 79422
wait4(-1, 0x7ffdce8dca10, WNOHANG, NULL) = -1 ECHILD (No child processes)
rt_sigreturn({mask=[]})                 = 0
close(3)                                = 0
rt_sigprocmask(SIG_BLOCK, [CHLD], [], 8) = 0
rt_sigaction(SIGINT, {sa_handler=0x563cbe345aa0, sa_mask=[], sa_flags=SA_RESTORER, sa_restorer=0x7f1c630f16a0}, {sa_handler=SIG_DFL, sa_mask=[], sa_flags=SA_RESTORER, sa_restorer=0x7f1c630f16a0}, 8) = 0
rt_sigaction(SIGINT, {sa_handler=SIG_DFL, sa_mask=[], sa_flags=SA_RESTORER, sa_restorer=0x7f1c630f16a0}, {sa_handler=0x563cbe345aa0, sa_mask=[], sa_flags=SA_RESTORER, sa_restorer=0x7f1c630f16a0}, 8) = 0
rt_sigprocmask(SIG_SETMASK, [], NULL, 8) = 0
read(255, "if [ -d /Applications ]; then\ndd"..., 8192) = 8192
stat("/Applications", 0x7ffdce8dd440)   = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "o/test/libc/calls/hefty/spawnve_test.com", O_RDWR|O_CREAT, 0666) = 3
fcntl(7, F_GETFD)                       = -1 EBADF (Bad file descriptor)
dup2(3, 7)                              = 7
close(3)                                = 0
fcntl(1, F_GETFD)                       = 0
fcntl(1, F_DUPFD, 10)                   = 10
fcntl(1, F_GETFD)                       = 0
fcntl(10, F_SETFD, FD_CLOEXEC)          = 0
dup2(7, 1)                              = 1
fcntl(7, F_GETFD)                       = 0
fstat(1, {st_mode=S_IFREG|0755, st_size=94208, ...}) = 0
write(1, "\177ELF\2\1\1\t\0\0\0\0\0\0\0\0\2\0>\0\1\0\0\0\20\22@\0\0\0\0\0"..., 64) = 64
dup2(10, 1)                             = 1
fcntl(10, F_GETFD)                      = 0x1 (flags FD_CLOEXEC)
close(10)                               = 0
fcntl(7, F_GETFD)                       = 0
fcntl(7, F_DUPFD, 10)                   = 10
fcntl(7, F_GETFD)                       = 0
fcntl(10, F_SETFD, FD_CLOEXEC)          = 0
close(7)                                = 0
close(10)                               = 0
rt_sigaction(SIGINT, {sa_handler=SIG_DFL, sa_mask=[], sa_flags=SA_RESTORER, sa_restorer=0x7f1c630f16a0}, {sa_handler=SIG_DFL, sa_mask=[], sa_flags=SA_RESTORER, sa_restorer=0x7f1c630f16a0}, 8) = 0
rt_sigaction(SIGQUIT, {sa_handler=SIG_DFL, sa_mask=[], sa_flags=SA_RESTORER, sa_restorer=0x7f1c630f16a0}, {sa_handler=SIG_IGN, sa_mask=[], sa_flags=SA_RESTORER, sa_restorer=0x7f1c630f16a0}, 8) = 0
rt_sigaction(SIGCHLD, {sa_handler=SIG_DFL, sa_mask=[], sa_flags=SA_RESTORER|SA_RESTART, sa_restorer=0x7f1c630f16a0}, {sa_handler=0x563cbe3485a0, sa_mask=[], sa_flags=SA_RESTORER|SA_RESTART, sa_restorer=0x7f1c630f16a0}, 8) = 0
lseek(255, -7818, SEEK_CUR)             = 915
execve("/home/mpech/cosmopolitan/o/test/libc/calls/hefty/spawnve_test.com", ["o/test/libc/calls/hefty/spawnve_"...], 0x563cbe9c4660 /* 60 vars */) = 0
fstat(1, {st_mode=S_IFCHR|0620, st_rdev=makedev(0x88, 0), ...}) = 0
mmap(0x100080000000, 65536, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0x100080000000
rt_sigaction(SIGQUIT, {sa_handler=0x40da04, sa_mask=~[QUIT ILL TRAP ABRT BUS FPE SEGV], sa_flags=SA_RESTORER|SA_RESETHAND, sa_restorer=0x40fb00}, {sa_handler=SIG_DFL, sa_mask=[], sa_flags=0}, 8) = 0
rt_sigaction(SIGFPE, {sa_handler=0x40da04, sa_mask=~[QUIT ILL TRAP ABRT BUS FPE SEGV], sa_flags=SA_RESTORER|SA_RESETHAND, sa_restorer=0x40fb00}, {sa_handler=SIG_DFL, sa_mask=[], sa_flags=0}, 8) = 0
rt_sigaction(SIGILL, {sa_handler=0x40da04, sa_mask=~[QUIT ILL TRAP ABRT BUS FPE SEGV], sa_flags=SA_RESTORER|SA_RESETHAND, sa_restorer=0x40fb00}, {sa_handler=SIG_DFL, sa_mask=[], sa_flags=0}, 8) = 0
rt_sigaction(SIGSEGV, {sa_handler=0x40da04, sa_mask=~[QUIT ILL TRAP ABRT BUS FPE SEGV], sa_flags=SA_RESTORER|SA_RESETHAND, sa_restorer=0x40fb00}, {sa_handler=SIG_DFL, sa_mask=[], sa_flags=0}, 8) = 0
rt_sigaction(SIGTRAP, {sa_handler=0x40da04, sa_mask=~[QUIT ILL TRAP ABRT BUS FPE SEGV], sa_flags=SA_RESTORER|SA_RESETHAND, sa_restorer=0x40fb00}, {sa_handler=SIG_DFL, sa_mask=[], sa_flags=0}, 8) = 0
rt_sigaction(SIGABRT, {sa_handler=0x40da04, sa_mask=~[QUIT ILL TRAP ABRT BUS FPE SEGV], sa_flags=SA_RESTORER|SA_RESETHAND, sa_restorer=0x40fb00}, {sa_handler=SIG_DFL, sa_mask=[], sa_flags=0}, 8) = 0
rt_sigaction(SIGBUS, {sa_handler=0x40da04, sa_mask=~[QUIT ILL TRAP ABRT BUS FPE SEGV], sa_flags=SA_RESTORER|SA_RESETHAND, sa_restorer=0x40fb00}, {sa_handler=SIG_DFL, sa_mask=[], sa_flags=0}, 8) = 0
openat(AT_FDCWD, "/proc/self/status", O_RDONLY) = 3
read(3, "Name:\tspawnve_test.co\nUmask:\t002"..., 1012) = 1012
close(3)                                = 0
getpid()                                = 79421
getpid()                                = 79421
newfstatat(AT_FDCWD, "/home/mpech/cosmopolitan/o/test/libc/calls/hefty/spawnve_test.com", {st_mode=S_IFREG|0755, st_size=94208, ...}, 0) = 0
openat(AT_FDCWD, "/home/mpech/cosmopolitan/o/test/libc/calls/hefty/spawnve_test.com", O_RDONLY) = 3
read(3, "\177ELF\2\1\1\t", 8)           = 8
close(3)                                = 0
vfork(strace: Process 79423 attached
 <unfinished ...>
[pid 79423] dup2(0, 0)                  = 0
[pid 79423] dup2(1, 1)                  = 1
[pid 79423] dup2(2, 2)                  = 2
[pid 79423] execve("/home/mpech/cosmopolitan/o/test/libc/calls/hefty/spawnve_test.com", ["o/test/libc/calls/hefty/spawnve_"..., "--testSpawnSelf"], 0x100080000010 /* 59 vars */ <unfinished ...>
[pid 79421] <... vfork resumed>)        = 79423
[pid 79421] wait4(79423,  <unfinished ...>
[pid 79423] <... execve resumed>)       = 0
[pid 79423] exit_group(123)             = ?
[pid 79423] +++ exited with 123 +++
<... wait4 resumed>[{WIFEXITED(s) && WEXITSTATUS(s) == 123}], 0, NULL) = 79423
--- SIGCHLD {si_signo=SIGCHLD, si_code=CLD_EXITED, si_pid=79423, si_uid=1000, si_status=123, si_utime=0, si_stime=0} ---
getpid()                                = 79421
getpid()                                = 79421
newfstatat(AT_FDCWD, "sh.com", 0x7ffd808c6270, 0) = -1 ENOENT (No such file or directory)
newfstatat(AT_FDCWD, "sh", 0x7ffd808c6270, 0) = -1 ENOENT (No such file or directory)
--- SIGTRAP {si_signo=SIGTRAP, si_code=SI_KERNEL} ---
openat(AT_FDCWD, "/proc/self/status", O_RDONLY) = 3
read(3, "Name:\tspawnve_test.co\nUmask:\t002"..., 1012) = 1012
close(3)                                = 0
--- SIGTRAP {si_signo=SIGTRAP, si_code=SI_KERNEL} ---
+++ killed by SIGTRAP (core dumped) +++
$ 

@tankf33der
Copy link
Author

BTW, my Manjaro is under xfce.

After laptop reboot I got and cant explain how it happened:

$ rm -rf o
$ sudo sh -c "echo ':APE:M::MZqFpD::/bin/sh:' >/proc/sys/fs/binfmt_misc/register"
$ make -j 8
MKDEPS         o//depend
OBJECTIFY.s    o//libc/nt/shell32/CreateStorageItemFromShellItem_FullTrustCaller_ForPackage_WithProcesOBJECTIFY.s    o//libc/nt/shell32/CreateStorageItemFromShellItem_FullTrustCaller_UseImplicitFlagsAndPaPACKAGE        o//tool/viz/viz.pkg
/home/mpech/cosmopolitan/o/tool/build/package.com: /home/mpech/cosmopolitan/o/tool/build/package.com: cannot execute binary file
make: *** [build/rules.mk:77: o//tool/viz/viz.pkg] Error 126
LINK.elf       o//tool/calc/calc.com.dbg
$

@ghost
Copy link

ghost commented Dec 30, 2020

I get the same error on Ubuntu running in WSL2:

user@desktop:~/cosmopolitan$ make
MKDEPS         o//depend
OBJECTIFY.s    o//libc/nt/shell32/CreateStorageItemFromShellItem_FullTrustCaller_ForPackage_WithProcessHandle.OBJCOPY        o//test/libc/calls/hefty/mkntcmdline_test.com
error:test/libc/calls/hefty/spawnve_test.c:55: spawnve_testExit()
        ASSERT_NE(-1, (pid = spawnlp(0, NULL, CMD, CMD, ARG, "exit 42", NULL)))
                need -1 (or 0xffffffffffffffffffffffffffffffff) ≠
                 got -1 (or 0xffffffffffffffffffffffffffffffff)
        ENOMEM/err=12/errno:12/GetLastError:0
        o//test/libc/calls/hefty/spawnve_test.com
1 / 4 tests failed
make: *** [build/rules.mk:76: o//test/libc/calls/hefty/spawnve_test.com.runs] Error 1
user@desktop:~/cosmopolitan$ make
♥cosmo
error:test/libc/calls/hefty/spawnve_test.c:55: spawnve_testExit()
        ASSERT_NE(-1, (pid = spawnlp(0, NULL, CMD, CMD, ARG, "exit 42", NULL)))
                need -1 (or 0xffffffffffffffffffffffffffffffff) ≠
                 got -1 (or 0xffffffffffffffffffffffffffffffff)
        ENOMEM/err=12/errno:12/GetLastError:0
        o//test/libc/calls/hefty/spawnve_test.com
1 / 4 tests failed
make: *** [build/rules.mk:76: o//test/libc/calls/hefty/spawnve_test.com.runs] Error 1

@paususe
Copy link

paususe commented Dec 30, 2020

I get the same error on openSUSE Leap 15.2:

user@leap:~/dev/cosmopolitan/cosmopolitan> make
MKDEPS         o//depend
OBJCOPY        o//test/libc/calls/hefty/dirstream_test.com
error:test/libc/calls/hefty/spawnve_test.c:55: spawnve_testExit()
ASSERT_NE(-1, (pid = spawnlp(0, NULL, CMD, CMD, ARG, "exit 42", NULL)))
need -1 (or 0xffffffffffffffffffffffffffffffff) ≠
got -1 (or 0xffffffffffffffffffffffffffffffff)
ENOMEM/err=12/errno:12/GetLastError:0
o//test/libc/calls/hefty/spawnve_test.com
1 / 4 tests failed
make: *** [build/rules.mk:76: o//test/libc/calls/hefty/spawnve_test.com.runs] Error 1

@nsauzede
Copy link

nsauzede commented Dec 31, 2020

I get the same error on Ubuntu 20.10 in a Virtualbox VM (16GiB Virtual RAM) running on Windows 10 host (32 GiB RAM).

~/perso/git/cosmopolitan$ make
OBJCOPY        o//test/libc/calls/hefty/sortenvp_test.com
error:test/libc/calls/hefty/spawnve_test.c:55: spawnve_testExit()
	ASSERT_NE(-1, (pid = spawnlp(0, NULL, CMD, CMD, ARG, "exit 42", NULL)))
		need -1	(or 0xffffffffffffffffffffffffffffffff) ≠
		 got -1	(or 0xffffffffffffffffffffffffffffffff)
	ENOMEM/err=12/errno:12/GetLastError:0
	o//test/libc/calls/hefty/spawnve_test.com
1 / 4 tests failed
make: *** [build/rules.mk:76: o//test/libc/calls/hefty/spawnve_test.com.runs] Error 1

[Maybe off-topic ?]
Also, the same binary gives this on the same Windows 10 host :

C:\nico>spawnve_test.com
error:test/libc/calls/hefty/spawnve_test.c:46: spawnve_testIpc()
        ASSERT_NE(-1, (got = read(tubes[1], buf, sizeof(buf))))
                need -1 (or 0xffffffffffffffffffffffffffffffff) ≠
                 got -1 (or 0xffffffffffffffffffffffffffffffff)
        ENOSYS/err=1/errno:1/GetLastError:6 Incorrect function.
        spawnve_test.com
1 / 4 tests failed

[/Maybe off-topic ?]

@nsauzede
Copy link

nsauzede commented Jan 2, 2021

Interestingly, I just tried on a linux laptop running Xubuntu 20.10 with 8GiB RAM, and the build pass !

nico@laptop:~/perso/git/cosmopolitan$ make -j8 -O
MKDEPS         o//depend
OBJECTIFY.c    o//net/http/negotiatehttprequest.o
make: ragel: No such file or directory
make: *** [build/rules.mk:98: build/bootstrap/net/http/uricspn.c.gz] Error 127
OBJECTIFY.c    o//dsp/tty/ttyraster.o
nico@laptop:~/perso/git/cosmopolitan$ ragel
Command 'ragel' not found, but can be installed with:
sudo apt install ragel
nico@laptop:~/perso/git/cosmopolitan$ sudo apt install ragel
[sudo] password for nico: 
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following NEW packages will be installed:
  ragel
0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded.
Need to get 1 048 kB of archives.
After this operation, 3 066 kB of additional disk space will be used.
Get:1 http://fr.archive.ubuntu.com/ubuntu groovy/universe amd64 ragel amd64 6.10-1build1 [1 048 kB]
Fetched 1 048 kB in 2s (538 kB/s)      
Selecting previously unselected package ragel.
(Reading database ... 241427 files and directories currently installed.)
Preparing to unpack .../ragel_6.10-1build1_amd64.deb ...
Unpacking ragel (6.10-1build1) ...
Setting up ragel (6.10-1build1) ...
Processing triggers for man-db (2.9.3-2) ...
nico@laptop:~/perso/git/cosmopolitan$ make -j8 -O
OBJCOPY        o//third_party/chibicc/test/vla_test2.com
nico@laptop:~/perso/git/cosmopolitan$

@jart jart self-assigned this Jan 16, 2021
jart added a commit that referenced this issue Jan 17, 2021
Multiple users have reported that this test fails, for reasons that
are currently unknown. It's possible that, some type of environment
variable configuration, e.g. PATH, CC, etc. is causing the failure.

Once the root cause is identified and addressed we'll re-enable it.
Anyone who is able to help us do that, please comment on the issue.
@jart
Copy link
Owner

jart commented Jan 17, 2021

I've disabled the test in question, due to the number of reports, even though I'm not able to reproduce it.

Please leave a comment if you figure why it's failing, in which case I'll re-open this issue and fix it.

@jart jart closed this as completed Jan 17, 2021
jart added a commit that referenced this issue Jan 26, 2021
For the first time ever, all tests in this codebase now pass, when
run automatically on macos, freebsd, openbsd, rhel5, rhel7, alpine
and windows via the network using the runit and runitd build tools

- Fix vfork exec path etc.
- Add XNU opendir() support
- Add OpenBSD opendir() support
- Add Linux history to syscalls.sh
- Use copy_file_range on FreeBSD 13+
- Fix system calls with 7+ arguments
- Fix Windows with greater than 16 FDs
- Fix RUNIT.COM and RUNITD.COM flakiness
- Fix OpenBSD munmap() when files are mapped
- Fix long double so it's actually long on Windows
- Fix OpenBSD truncate() and ftruncate() thunk typo
- Let Windows fcntl() be used on socket files descriptors
- Fix Windows fstat() which had an accidental printf statement
- Fix RHEL5 CLOCK_MONOTONIC by not aliasing to CLOCK_MONOTONIC_RAW

This is wonderful. I never could have dreamed it would be possible
to get it working so well on so many platforms with tiny binaries.

Fixes #31
Fixes #25
Fixes #14
@jart
Copy link
Owner

jart commented Jan 26, 2021

Hey everyone! Thanks again for trying Cosmopolitan. I believe I've fully and properly addressed the root cause in 45b7248 where some technical debt needed to be paid off regarding fork, vfork, and exec. So now would be the perfect time to give Cosmopolitan a second try. If you encounter any further issues, then please file an issue and it'll get addressed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants