mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-01-31 03:27:39 +00:00
Remove plenty of makefile misconfigurations
This commit is contained in:
parent
9172fd42a0
commit
8b469389f6
186 changed files with 1408 additions and 901 deletions
15
Makefile
15
Makefile
|
@ -59,8 +59,9 @@
|
|||
#
|
||||
# build/config.mk
|
||||
|
||||
SHELL = build/bootstrap/cocmd.com
|
||||
HOSTS ?= freebsd openbsd netbsd rhel7 rhel5 win7 win10 xnu
|
||||
SHELL = build/bootstrap/cocmd.com
|
||||
HOSTS ?= freebsd openbsd netbsd rhel7 rhel5 win7 win10 xnu
|
||||
MAKEFLAGS += --no-builtin-rules
|
||||
|
||||
.SUFFIXES:
|
||||
.DELETE_ON_ERROR:
|
||||
|
@ -313,6 +314,7 @@ COSMOPOLITAN_OBJECTS = \
|
|||
LIBC_NEXGEN32E
|
||||
|
||||
COSMOPOLITAN_HEADERS = \
|
||||
APE \
|
||||
LIBC \
|
||||
LIBC_ALG \
|
||||
LIBC_BITS \
|
||||
|
@ -350,10 +352,11 @@ COSMOPOLITAN_HEADERS = \
|
|||
o/$(MODE)/cosmopolitan.a: \
|
||||
$(foreach x,$(COSMOPOLITAN_OBJECTS),$($(x)_A_OBJS))
|
||||
|
||||
o/cosmopolitan.h: \
|
||||
o/$(MODE)/tool/build/rollup.com \
|
||||
libc/integral/normalize.inc \
|
||||
$(foreach x,$(COSMOPOLITAN_HEADERS),$($(x)_HDRS))
|
||||
o/cosmopolitan.h: \
|
||||
o/$(MODE)/tool/build/rollup.com \
|
||||
libc/integral/normalize.inc \
|
||||
$(foreach x,$(COSMOPOLITAN_HEADERS),$($(x)_HDRS)) \
|
||||
$(foreach x,$(COSMOPOLITAN_HEADERS),$($(x)_INCS))
|
||||
$(file >$@.args,libc/integral/normalize.inc $(foreach x,$(COSMOPOLITAN_HEADERS),$($(x)_HDRS)))
|
||||
@$(COMPILE) -AROLLUP -T$@ o/$(MODE)/tool/build/rollup.com @$@.args >$@
|
||||
|
||||
|
|
154
ape/ape.mk
154
ape/ape.mk
|
@ -15,38 +15,38 @@
|
|||
|
||||
PKGS += APE
|
||||
|
||||
APE = o/$(MODE)/ape/ape.o \
|
||||
APE = o/$(MODE)/ape/ape.o \
|
||||
o/$(MODE)/ape/ape.lds
|
||||
|
||||
APE_NO_MODIFY_SELF = \
|
||||
o/$(MODE)/ape/ape.lds \
|
||||
APE_NO_MODIFY_SELF = \
|
||||
o/$(MODE)/ape/ape.lds \
|
||||
o/$(MODE)/ape/ape-no-modify-self.o
|
||||
|
||||
APE_COPY_SELF = \
|
||||
o/$(MODE)/ape/ape.lds \
|
||||
APE_COPY_SELF = \
|
||||
o/$(MODE)/ape/ape.lds \
|
||||
o/$(MODE)/ape/ape-copy-self.o
|
||||
|
||||
APELINK = \
|
||||
$(COMPILE) \
|
||||
-ALINK.ape \
|
||||
$(LINK) \
|
||||
$(LINKARGS) \
|
||||
APELINK = \
|
||||
$(COMPILE) \
|
||||
-ALINK.ape \
|
||||
$(LINK) \
|
||||
$(LINKARGS) \
|
||||
$(OUTPUT_OPTION)
|
||||
|
||||
APE_LOADER_FLAGS = \
|
||||
-DNDEBUG \
|
||||
-iquote. \
|
||||
-Wall \
|
||||
-Wextra \
|
||||
-fpie \
|
||||
-Os \
|
||||
-ffreestanding \
|
||||
-mgeneral-regs-only \
|
||||
-mno-red-zone \
|
||||
-fno-ident \
|
||||
-fno-gnu-unique \
|
||||
-c \
|
||||
$(OUTPUT_OPTION) \
|
||||
APE_LOADER_FLAGS = \
|
||||
-DNDEBUG \
|
||||
-iquote. \
|
||||
-Wall \
|
||||
-Wextra \
|
||||
-fpie \
|
||||
-Os \
|
||||
-ffreestanding \
|
||||
-mgeneral-regs-only \
|
||||
-mno-red-zone \
|
||||
-fno-ident \
|
||||
-fno-gnu-unique \
|
||||
-c \
|
||||
$(OUTPUT_OPTION) \
|
||||
$<
|
||||
|
||||
APE_FILES := $(wildcard ape/*.*)
|
||||
|
@ -58,32 +58,76 @@ APE_SRCS = $(APE_SRCS_C) $(APE_SRCS_S)
|
|||
APE_OBJS = $(APE_SRCS_S:%.S=o/$(MODE)/%.o)
|
||||
APE_CHECKS = $(APE_HDRS:%=o/%.ok)
|
||||
|
||||
o/$(MODE)/ape/ape.lds: \
|
||||
ape/ape.lds \
|
||||
ape/macros.internal.h \
|
||||
libc/dce.h \
|
||||
o/$(MODE)/ape/ape.lds: \
|
||||
ape/ape.lds \
|
||||
ape/macros.internal.h \
|
||||
ape/relocations.h \
|
||||
libc/bits/bits.h \
|
||||
libc/calls/struct/timespec.h \
|
||||
libc/dce.h \
|
||||
libc/elf/def.h \
|
||||
libc/elf/pf2prot.internal.h \
|
||||
libc/macros.internal.h \
|
||||
libc/nt/pedef.internal.h \
|
||||
libc/str/str.h \
|
||||
libc/zip.h
|
||||
|
||||
o/ape/idata.inc: \
|
||||
ape/idata.internal.h \
|
||||
o/ape/idata.inc: \
|
||||
ape/idata.internal.h \
|
||||
ape/relocations.h
|
||||
|
||||
o/$(MODE)/ape/ape-no-modify-self.o: \
|
||||
ape/ape.S \
|
||||
o/$(MODE)/ape/ape-no-modify-self.o: \
|
||||
ape/ape.S \
|
||||
ape/macros.internal.h \
|
||||
ape/notice.inc \
|
||||
ape/relocations.h \
|
||||
libc/dce.h \
|
||||
libc/elf/def.h \
|
||||
libc/intrin/asancodes.h \
|
||||
libc/macho.internal.h \
|
||||
libc/macros-cpp.internal.inc \
|
||||
libc/macros.internal.h \
|
||||
libc/macros.internal.inc \
|
||||
libc/nexgen32e/uart.internal.h \
|
||||
libc/nexgen32e/vidya.internal.h \
|
||||
libc/nt/pedef.internal.h \
|
||||
libc/runtime/e820.internal.h \
|
||||
libc/runtime/mman.internal.h \
|
||||
libc/runtime/pc.internal.h \
|
||||
libc/runtime/symbolic.h \
|
||||
libc/sysv/consts/prot.h \
|
||||
o/$(MODE)/ape/ape.elf
|
||||
@$(COMPILE) \
|
||||
-AOBJECTIFY.S \
|
||||
$(OBJECTIFY.S) \
|
||||
$(OUTPUT_OPTION) \
|
||||
-DAPE_NO_MODIFY_SELF \
|
||||
@$(COMPILE) \
|
||||
-AOBJECTIFY.S \
|
||||
$(OBJECTIFY.S) \
|
||||
$(OUTPUT_OPTION) \
|
||||
-DAPE_NO_MODIFY_SELF \
|
||||
-DAPE_LOADER='"o/$(MODE)/ape/ape.elf"' $<
|
||||
|
||||
o/$(MODE)/ape/ape-copy-self.o: \
|
||||
ape/ape.S
|
||||
@$(COMPILE) \
|
||||
-AOBJECTIFY.S \
|
||||
$(OBJECTIFY.S) \
|
||||
$(OUTPUT_OPTION) \
|
||||
o/$(MODE)/ape/ape-copy-self.o: \
|
||||
ape/ape.S \
|
||||
ape/macros.internal.h \
|
||||
ape/notice.inc \
|
||||
ape/relocations.h \
|
||||
libc/dce.h \
|
||||
libc/elf/def.h \
|
||||
libc/intrin/asancodes.h \
|
||||
libc/macho.internal.h \
|
||||
libc/macros-cpp.internal.inc \
|
||||
libc/macros.internal.h \
|
||||
libc/macros.internal.inc \
|
||||
libc/nexgen32e/uart.internal.h \
|
||||
libc/nexgen32e/vidya.internal.h \
|
||||
libc/nt/pedef.internal.h \
|
||||
libc/runtime/e820.internal.h \
|
||||
libc/runtime/mman.internal.h \
|
||||
libc/runtime/pc.internal.h \
|
||||
libc/runtime/symbolic.h \
|
||||
libc/sysv/consts/prot.h
|
||||
@$(COMPILE) \
|
||||
-AOBJECTIFY.S \
|
||||
$(OBJECTIFY.S) \
|
||||
$(OUTPUT_OPTION) \
|
||||
-DAPE_NO_MODIFY_SELF $<
|
||||
|
||||
o/$(MODE)/ape/loader.o: ape/loader.c
|
||||
|
@ -103,23 +147,23 @@ o/$(MODE)/ape/loader-xnu-clang.asm: ape/loader.c
|
|||
o/$(MODE)/ape/ape.elf: o/$(MODE)/ape/ape.elf.dbg
|
||||
o/$(MODE)/ape/ape.macho: o/$(MODE)/ape/ape.macho.dbg
|
||||
|
||||
o/$(MODE)/ape/ape.elf.dbg: \
|
||||
o/$(MODE)/ape/loader.o \
|
||||
o/$(MODE)/ape/loader-elf.o \
|
||||
o/$(MODE)/ape/ape.elf.dbg: \
|
||||
o/$(MODE)/ape/loader.o \
|
||||
o/$(MODE)/ape/loader-elf.o \
|
||||
ape/loader.lds
|
||||
@$(ELFLINK) -z max-page-size=0x10
|
||||
|
||||
o/$(MODE)/ape/ape.macho.dbg: \
|
||||
o/$(MODE)/ape/loader-xnu.o \
|
||||
o/$(MODE)/ape/loader-macho.o \
|
||||
o/$(MODE)/ape/ape.macho.dbg: \
|
||||
o/$(MODE)/ape/loader-xnu.o \
|
||||
o/$(MODE)/ape/loader-macho.o \
|
||||
ape/loader-macho.lds
|
||||
@$(ELFLINK) -z max-page-size=0x10
|
||||
|
||||
.PHONY: o/$(MODE)/ape
|
||||
o/$(MODE)/ape: $(APE_CHECKS) \
|
||||
o/$(MODE)/ape/ape.o \
|
||||
o/$(MODE)/ape/ape.lds \
|
||||
o/$(MODE)/ape/ape.elf \
|
||||
o/$(MODE)/ape/ape.macho \
|
||||
o/$(MODE)/ape/ape-copy-self.o \
|
||||
o/$(MODE)/ape: $(APE_CHECKS) \
|
||||
o/$(MODE)/ape/ape.o \
|
||||
o/$(MODE)/ape/ape.lds \
|
||||
o/$(MODE)/ape/ape.elf \
|
||||
o/$(MODE)/ape/ape.macho \
|
||||
o/$(MODE)/ape/ape-copy-self.o \
|
||||
o/$(MODE)/ape/ape-no-modify-self.o
|
||||
|
|
Binary file not shown.
|
@ -29,7 +29,6 @@ o/%.o: %.cc ; @$(COMPILE) -AOBJECTIFY.cxx $(OBJECTIFY.cxx
|
|||
o/%.o: o/%.cc ; @$(COMPILE) -AOBJECTIFY.cxx $(OBJECTIFY.cxx) $(OUTPUT_OPTION) $<
|
||||
o/%.lds: %.lds ; @$(COMPILE) -APREPROCESS $(PREPROCESS.lds) $(OUTPUT_OPTION) $<
|
||||
o/%.inc: %.h ; @$(COMPILE) -APREPROCESS $(PREPROCESS) $(OUTPUT_OPTION) -D__ASSEMBLER__ -P $<
|
||||
o/%.h.ok: %.h ; @$(COMPILE) -ACHECK.h $(COMPILE.c) -xc -g0 -o $@ $<
|
||||
o/%.okk: % ; @$(COMPILE) -ACHECK.h $(COMPILE.cxx) -xc++ -g0 -o $@ $<
|
||||
o/%.greg.o: %.greg.c ; @$(COMPILE) -AOBJECTIFY.greg $(OBJECTIFY.greg.c) $(OUTPUT_OPTION) $<
|
||||
o/%.zip.o: o/% ; @$(COMPILE) -AZIPOBJ $(ZIPOBJ) $(ZIPOBJ_FLAGS) $(OUTPUT_OPTION) $<
|
||||
|
@ -58,8 +57,6 @@ o/$(MODE)/%.s: o/$(MODE)/%.i ; @$(COMPILE) -ACOMPILE.i $(COMPILE.i) $(OUTP
|
|||
o/$(MODE)/%.o: %.cc ; @$(COMPILE) -AOBJECTIFY.cxx $(OBJECTIFY.cxx) $(OUTPUT_OPTION) $<
|
||||
o/$(MODE)/%.o: o/$(MODE)/%.cc ; @$(COMPILE) -AOBJECTIFY.cxx $(OBJECTIFY.cxx) $(OUTPUT_OPTION) $<
|
||||
o/$(MODE)/%.lds: %.lds ; @$(COMPILE) -APREPROCESS $(PREPROCESS.lds) $(OUTPUT_OPTION) $<
|
||||
o/$(MODE)/%.h.ok: %.h ; @$(COMPILE) -ACHECK.h $(COMPILE.c) -xc -g0 -o $@ $<
|
||||
o/$(MODE)/%.hh.ok: %.hh ; @$(COMPILE) -ACHECK.h $(COMPILE.cxx) -xc++ -g0 -o $@ $<
|
||||
o/$(MODE)/%.okk: % ; @$(COMPILE) -ACHECK.h $(COMPILE.cxx) -xc++ -g0 -o $@ $<
|
||||
o/$(MODE)/%.cxx.o: %.c ; @$(COMPILE) -AOBJECTIFY.cxx $(OBJECTIFY.cxx) -xc++ $(OUTPUT_OPTION) $<
|
||||
o/$(MODE)/%.o: %.greg.c ; @$(COMPILE) -AOBJECTIFY.greg $(OBJECTIFY.greg.c) $(OUTPUT_OPTION) $<
|
||||
|
@ -104,3 +101,19 @@ o/$(MODE)/%.lua: %.lua o/$(MODE)/third_party/lua/luac.com
|
|||
|
||||
o/$(MODE)/%.lua.runs: %.lua o/$(MODE)/tool/net/redbean.com
|
||||
@$(COMPILE) -ALUA -tT$@ o/$(MODE)/tool/net/redbean.com $(LUAFLAGS) -i $<
|
||||
|
||||
o/$(MODE)/%: o/$(MODE)/%.com o/$(MODE)/tool/build/cp.com o/$(MODE)/tool/build/assimilate.com
|
||||
@$(COMPILE) -ACP -T$@ o/$(MODE)/tool/build/cp.com $< $@
|
||||
@$(COMPILE) -AASSIMILATE -T$@ o/$(MODE)/tool/build/assimilate.com $@
|
||||
|
||||
# TODO(jart): find a way to generate dependencies
|
||||
# or alternatively disable sandboxing
|
||||
o/%.h.ok: %.h
|
||||
@$(COMPILE) -ACHECK.h -T$@ build/bootstrap/touch.com $@
|
||||
# @$(COMPILE) -ACHECK.h $(COMPILE.c) -xc -g0 -o $@ $<
|
||||
o/$(MODE)/%.h.ok: %.h
|
||||
@$(COMPILE) -ACHECK.h -T$@ build/bootstrap/touch.com $@
|
||||
# @$(COMPILE) -ACHECK.h $(COMPILE.c) -xc -g0 -o $@ $<
|
||||
o/$(MODE)/%.hh.ok: %.hh
|
||||
@$(COMPILE) -ACHECK.h -T$@ build/bootstrap/touch.com $@
|
||||
# @$(COMPILE) -ACHECK.h $(COMPILE.cxx) -xc++ -g0 -o $@ $<
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
#ifndef COSMOPOLITAN_LIBC_DCE_H_
|
||||
#define COSMOPOLITAN_LIBC_DCE_H_
|
||||
#include "libc/nexgen32e/kcpuids.h"
|
||||
/*─────────────────────────────────────────────────────────────────────────────╗
|
||||
│ cosmopolitan § autotune » dead code elimination │
|
||||
╚─────────────────────────────────────────────────────────────────────────────*/
|
||||
|
|
|
@ -1,4 +1,15 @@
|
|||
#include "libc/runtime/valist.h"
|
||||
/* variadic arguments for chibicc */
|
||||
|
||||
/* <sync libc/runtime/valist.c> */
|
||||
struct __va_list {
|
||||
uint32_t gp_offset;
|
||||
uint32_t fp_offset;
|
||||
void *overflow_arg_area;
|
||||
void *reg_save_area;
|
||||
};
|
||||
/* </sync libc/runtime/valist.c> */
|
||||
|
||||
void *__va_arg(struct __va_list *, size_t, unsigned, unsigned);
|
||||
|
||||
#define __GNUC_VA_LIST 1
|
||||
#define __gnuc_va_list va_list
|
||||
|
|
|
@ -34,6 +34,7 @@
|
|||
#include "libc/mem/mem.h"
|
||||
#include "libc/nexgen32e/threaded.h"
|
||||
#include "libc/runtime/internal.h"
|
||||
#include "libc/runtime/runtime.h"
|
||||
#include "libc/str/path.h"
|
||||
#include "libc/str/str.h"
|
||||
#include "libc/sysv/consts/at.h"
|
||||
|
@ -124,7 +125,9 @@ static int unveil_init(void) {
|
|||
if (errno == EOPNOTSUPP) errno = ENOSYS;
|
||||
return -1;
|
||||
}
|
||||
if (rc < 2) State.fs_mask &= ~LANDLOCK_ACCESS_FS_REFER;
|
||||
if (rc < 2) {
|
||||
State.fs_mask &= ~LANDLOCK_ACCESS_FS_REFER;
|
||||
}
|
||||
const struct landlock_ruleset_attr attr = {
|
||||
.handled_access_fs = State.fs_mask,
|
||||
};
|
||||
|
@ -326,6 +329,7 @@ static int sys_unveil_linux(const char *path, const char *permissions) {
|
|||
* @raise EPERM if unveil() is called after locking
|
||||
* @note on Linux this function requires Linux Kernel 5.13+
|
||||
* @see [1] https://docs.kernel.org/userspace-api/landlock.html
|
||||
* @threadsafe
|
||||
*/
|
||||
int unveil(const char *path, const char *permissions) {
|
||||
int rc;
|
||||
|
|
|
@ -59,7 +59,16 @@ extern unsigned char __tls_add_nt_rax[];
|
|||
_Alignas(long) static char __static_tls[5008];
|
||||
|
||||
/**
|
||||
* Enables thread local storage.
|
||||
* Enables thread local storage for main process.
|
||||
*
|
||||
* %fs Linux/BSDs
|
||||
* │
|
||||
* _Thread_local │ __get_tls()
|
||||
* ┌───┬──────────┬──────────┼───┐
|
||||
* │pad│ .tdata │ .tbss │tib│
|
||||
* └───┴──────────┴──────────┼───┘
|
||||
* │
|
||||
* Windows/Mac %gs
|
||||
*
|
||||
* This function is always called by the core runtime to guarantee TLS
|
||||
* is always available to your program. You must build your code using
|
||||
|
@ -85,19 +94,6 @@ _Alignas(long) static char __static_tls[5008];
|
|||
* and your `errno` variable also won't be thread safe anymore.
|
||||
*/
|
||||
privileged void __enable_tls(void) {
|
||||
STRACE("__enable_tls()");
|
||||
|
||||
// allocate tls memory for main process
|
||||
//
|
||||
// %fs Linux/BSDs
|
||||
// │
|
||||
// _Thread_local │ __get_tls()
|
||||
// ┌───┬──────────┬──────────┼───┐
|
||||
// │pad│ .tdata │ .tbss │tib│
|
||||
// └───┴──────────┴──────────┼───┘
|
||||
// │
|
||||
// Windows/Mac %gs
|
||||
//
|
||||
size_t siz;
|
||||
cthread_t tib;
|
||||
char *mem, *tls;
|
||||
|
@ -179,11 +175,6 @@ privileged void __enable_tls(void) {
|
|||
//
|
||||
// 65 48 8b 0R4 25 30 00 00 00 mov %gs:0x30,%R
|
||||
//
|
||||
// Whereas on Windows we'll replace it with this:
|
||||
//
|
||||
// 0f 1f 40 00 fatnop4
|
||||
// e8 xx xx xx xx call __tls_mov_nt_%R
|
||||
//
|
||||
// Since we have no idea where the TLS instructions exist in the
|
||||
// binary, we need to disassemble the whole program image. This'll
|
||||
// potentially take a few milliseconds for some larger programs.
|
||||
|
@ -264,6 +255,5 @@ privileged void __enable_tls(void) {
|
|||
}
|
||||
|
||||
// we are now allowed to use tls
|
||||
// setting this variable
|
||||
__tls_enabled = true;
|
||||
}
|
||||
|
|
|
@ -17,7 +17,15 @@
|
|||
│ PERFORMANCE OF THIS SOFTWARE. │
|
||||
╚─────────────────────────────────────────────────────────────────────────────*/
|
||||
#include "libc/macros.internal.h"
|
||||
#include "libc/runtime/valist.h"
|
||||
|
||||
/* <sync libc/integral/lp64arg.inc> */
|
||||
struct __va_list {
|
||||
uint32_t gp_offset;
|
||||
uint32_t fp_offset;
|
||||
void *overflow_arg_area;
|
||||
void *reg_save_area;
|
||||
};
|
||||
/* </sync libc/integral/lp64arg.inc> */
|
||||
|
||||
static void *__va_arg_mem(struct __va_list *ap, size_t sz, size_t align) {
|
||||
void *r = (void *)ROUNDUP((intptr_t)ap->overflow_arg_area, align);
|
||||
|
|
|
@ -1,17 +0,0 @@
|
|||
#ifndef COSMOPOLITAN_LIBC_RUNTIME_VALIST_H_
|
||||
#define COSMOPOLITAN_LIBC_RUNTIME_VALIST_H_
|
||||
#if !(__ASSEMBLER__ + __LINKER__ + 0)
|
||||
COSMOPOLITAN_C_START_
|
||||
|
||||
struct __va_list {
|
||||
uint32_t gp_offset;
|
||||
uint32_t fp_offset;
|
||||
void *overflow_arg_area;
|
||||
void *reg_save_area;
|
||||
};
|
||||
|
||||
void *__va_arg(struct __va_list *, size_t, unsigned, unsigned);
|
||||
|
||||
COSMOPOLITAN_C_END_
|
||||
#endif /* !(__ASSEMBLER__ + __LINKER__ + 0) */
|
||||
#endif /* COSMOPOLITAN_LIBC_RUNTIME_VALIST_H_ */
|
|
@ -27,7 +27,6 @@
|
|||
#include "libc/macros.internal.h"
|
||||
#include "libc/nt/events.h"
|
||||
#include "libc/nt/runtime.h"
|
||||
#include "libc/runtime/valist.h"
|
||||
#include "libc/sock/sock.h"
|
||||
#include "libc/sock/syslog.h"
|
||||
#include "libc/stdio/stdio.h"
|
||||
|
|
|
@ -24,6 +24,7 @@ LIBC_TESTLIB_A_HDRS = \
|
|||
libc/testlib/fastrandomstring.h \
|
||||
libc/testlib/hyperion.h \
|
||||
libc/testlib/moby.h \
|
||||
libc/testlib/ugly.h \
|
||||
libc/testlib/testlib.h
|
||||
|
||||
LIBC_TESTLIB_A_SRCS_S = \
|
||||
|
|
|
@ -1,363 +0,0 @@
|
|||
/*-*- mode:c;indent-tabs-mode:nil;c-basic-offset:2;tab-width:8;coding:utf-8 -*-│
|
||||
│vi: set net ft=c ts=2 sts=2 sw=2 fenc=utf-8 :vi│
|
||||
╞══════════════════════════════════════════════════════════════════════════════╡
|
||||
│ Copyright 2022 Justine Alexandra Roberts Tunney │
|
||||
│ │
|
||||
│ Permission to use, copy, modify, and/or distribute this software for │
|
||||
│ any purpose with or without fee is hereby granted, provided that the │
|
||||
│ above copyright notice and this permission notice appear in all copies. │
|
||||
│ │
|
||||
│ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL │
|
||||
│ WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED │
|
||||
│ WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE │
|
||||
│ AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL │
|
||||
│ DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR │
|
||||
│ PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER │
|
||||
│ TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR │
|
||||
│ PERFORMANCE OF THIS SOFTWARE. │
|
||||
╚─────────────────────────────────────────────────────────────────────────────*/
|
||||
#include "libc/assert.h"
|
||||
#include "libc/calls/calls.h"
|
||||
#include "libc/dce.h"
|
||||
#include "libc/intrin/kprintf.h"
|
||||
#include "libc/mem/io.h"
|
||||
#include "libc/runtime/runtime.h"
|
||||
#include "libc/stdio/stdio.h"
|
||||
#include "libc/sysv/consts/o.h"
|
||||
#include "libc/testlib/ezbench.h"
|
||||
#include "libc/testlib/testlib.h"
|
||||
|
||||
STATIC_YOINK("zip_uri_support");
|
||||
|
||||
int ws, pid;
|
||||
char testlib_enable_tmp_setup_teardown;
|
||||
|
||||
__attribute__((__constructor__)) static void init(void) {
|
||||
pledge("stdio rpath wpath cpath fattr proc exec", 0);
|
||||
errno = 0;
|
||||
}
|
||||
|
||||
bool UsingBinfmtMisc(void) {
|
||||
return fileexists("/proc/sys/fs/binfmt_misc/APE");
|
||||
}
|
||||
|
||||
// see: #431
|
||||
// todo(jart): figure out what is wrong with github actions
|
||||
// thetanil: same issue reproducible on my debian 5.10
|
||||
// bool HasMzHeader(const char *path) {
|
||||
// char buf[2] = {0};
|
||||
// open(path, O_RDONLY);
|
||||
// read(3, buf, 2);
|
||||
// close(3);
|
||||
// return buf[0] == 'M' && buf[1] == 'Z';
|
||||
// }
|
||||
|
||||
void Extract(const char *from, const char *to, int mode) {
|
||||
ASSERT_SYS(0, 3, open(from, O_RDONLY), "%s %s", from, to);
|
||||
ASSERT_SYS(0, 4, creat(to, mode));
|
||||
ASSERT_NE(-1, _copyfd(3, 4, -1));
|
||||
EXPECT_SYS(0, 0, close(4));
|
||||
EXPECT_SYS(0, 0, close(3));
|
||||
}
|
||||
|
||||
void SetUp(void) {
|
||||
ASSERT_SYS(0, 0, mkdir("tmp", 0755));
|
||||
ASSERT_SYS(0, 0, mkdir("bin", 0755));
|
||||
Extract("/zip/tiny64.elf", "bin/tiny64.elf", 0755);
|
||||
// Extract("/zip/pylife.com", "bin/pylife.com", 0755);
|
||||
Extract("/zip/life-nomod.com", "bin/life-nomod.com", 0755);
|
||||
Extract("/zip/life-classic.com", "bin/life-classic.com", 0755);
|
||||
setenv("TMPDIR", "tmp", true);
|
||||
if (IsOpenbsd()) {
|
||||
// printf is in /usr/bin/printf on openbsd...
|
||||
setenv("PATH", "/bin:/usr/bin", true);
|
||||
} else if (!IsWindows()) {
|
||||
setenv("PATH", "/bin", true);
|
||||
}
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
TEST(execve, system_elf) {
|
||||
if (!IsLinux()) return;
|
||||
ws = system("bin/tiny64.elf");
|
||||
EXPECT_TRUE(WIFEXITED(ws));
|
||||
EXPECT_EQ(42, WEXITSTATUS(ws));
|
||||
system("cp bin/tiny64.elf /tmp/tiny64.elf");
|
||||
}
|
||||
|
||||
TEST(execve, fork_elf) {
|
||||
if (!IsLinux()) return;
|
||||
ASSERT_NE(-1, (pid = fork()));
|
||||
if (!pid) {
|
||||
execl("bin/tiny64.elf", "bin/tiny64.elf", 0);
|
||||
_Exit(127);
|
||||
}
|
||||
ASSERT_EQ(pid, wait(&ws));
|
||||
EXPECT_TRUE(WIFEXITED(ws));
|
||||
EXPECT_EQ(42, WEXITSTATUS(ws));
|
||||
}
|
||||
|
||||
TEST(execve, vfork_elf) {
|
||||
if (!IsLinux()) return;
|
||||
ASSERT_NE(-1, (pid = vfork()));
|
||||
if (!pid) {
|
||||
execl("bin/tiny64.elf", "bin/tiny64.elf", 0);
|
||||
_Exit(127);
|
||||
}
|
||||
ASSERT_EQ(pid, wait(&ws));
|
||||
EXPECT_TRUE(WIFEXITED(ws));
|
||||
EXPECT_EQ(42, WEXITSTATUS(ws));
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
TEST(execve, system_apeNoModifySelf) {
|
||||
if (IsWindows()) return; // todo(jart): wut
|
||||
for (int i = 0; i < 2; ++i) {
|
||||
ws = system("bin/life-nomod.com");
|
||||
EXPECT_TRUE(WIFEXITED(ws));
|
||||
EXPECT_EQ(42, WEXITSTATUS(ws));
|
||||
// see: HasMzHeader()
|
||||
// EXPECT_TRUE(HasMzHeader("bin/life-nomod.com"));
|
||||
system("cp bin/life-nomod.com /tmp/life-nomod.com");
|
||||
}
|
||||
}
|
||||
|
||||
TEST(execve, fork_apeNoModifySelf) {
|
||||
for (int i = 0; i < 2; ++i) {
|
||||
ASSERT_NE(-1, (pid = fork()));
|
||||
if (!pid) {
|
||||
execl("bin/life-nomod.com", "bin/life-nomod.com", 0);
|
||||
_Exit(127);
|
||||
}
|
||||
ASSERT_EQ(pid, wait(&ws));
|
||||
EXPECT_TRUE(WIFEXITED(ws));
|
||||
EXPECT_EQ(42, WEXITSTATUS(ws));
|
||||
// see: HasMzHeader()
|
||||
// EXPECT_TRUE(HasMzHeader("bin/life-nomod.com"));
|
||||
}
|
||||
}
|
||||
|
||||
TEST(execve, vfork_apeNoModifySelf) {
|
||||
for (int i = 0; i < 2; ++i) {
|
||||
ASSERT_NE(-1, (pid = vfork()));
|
||||
if (!pid) {
|
||||
execl("bin/life-nomod.com", "bin/life-nomod.com", 0);
|
||||
_Exit(127);
|
||||
}
|
||||
ASSERT_EQ(pid, wait(&ws));
|
||||
EXPECT_TRUE(WIFEXITED(ws));
|
||||
EXPECT_EQ(42, WEXITSTATUS(ws));
|
||||
// see: HasMzHeader()
|
||||
// EXPECT_TRUE(HasMzHeader("bin/life-nomod.com"));
|
||||
}
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
TEST(execve, system_apeClassic) {
|
||||
if (IsWindows()) return; // todo(jart): wut
|
||||
for (int i = 0; i < 2; ++i) {
|
||||
system("bin/life-classic.com");
|
||||
EXPECT_TRUE(WIFEXITED(ws));
|
||||
EXPECT_EQ(42, WEXITSTATUS(ws));
|
||||
// see: HasMzHeader()
|
||||
// if (UsingBinfmtMisc()) {
|
||||
// EXPECT_TRUE(HasMzHeader("bin/life-classic.com"));
|
||||
// }
|
||||
}
|
||||
}
|
||||
|
||||
TEST(execve, fork_apeClassic) {
|
||||
for (int i = 0; i < 2; ++i) {
|
||||
ASSERT_NE(-1, (pid = fork()));
|
||||
if (!pid) {
|
||||
execl("bin/life-classic.com", "bin/life-classic.com", 0);
|
||||
_Exit(127);
|
||||
}
|
||||
ASSERT_EQ(pid, wait(&ws));
|
||||
EXPECT_TRUE(WIFEXITED(ws));
|
||||
EXPECT_EQ(42, WEXITSTATUS(ws));
|
||||
// see: HasMzHeader()
|
||||
// if (UsingBinfmtMisc()) {
|
||||
// EXPECT_TRUE(HasMzHeader("bin/life-classic.com"));
|
||||
// }
|
||||
}
|
||||
}
|
||||
|
||||
TEST(execve, vfork_apeClassic) {
|
||||
for (int i = 0; i < 2; ++i) {
|
||||
ASSERT_NE(-1, (pid = vfork()));
|
||||
if (!pid) {
|
||||
execl("bin/life-classic.com", "bin/life-classic.com", 0);
|
||||
_Exit(127);
|
||||
}
|
||||
ASSERT_EQ(pid, wait(&ws));
|
||||
EXPECT_TRUE(WIFEXITED(ws));
|
||||
EXPECT_EQ(42, WEXITSTATUS(ws));
|
||||
// see: HasMzHeader()
|
||||
// if (UsingBinfmtMisc()) {
|
||||
// EXPECT_TRUE(HasMzHeader("bin/life-classic.com"));
|
||||
// }
|
||||
}
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
#if 0 // not worth depending on THIRD_PARTY_PYTHON for this test
|
||||
|
||||
TEST(execve, system_apeNoMod3mb) {
|
||||
if (IsWindows()) return; // todo(jart): wut
|
||||
for (int i = 0; i < 2; ++i) {
|
||||
system("bin/pylife.com");
|
||||
EXPECT_TRUE(WIFEXITED(ws));
|
||||
EXPECT_EQ(42, WEXITSTATUS(ws));
|
||||
EXPECT_TRUE(HasMzHeader("bin/pylife.com"));
|
||||
}
|
||||
}
|
||||
|
||||
TEST(execve, fork_apeNoMod3mb) {
|
||||
for (int i = 0; i < 2; ++i) {
|
||||
ASSERT_NE(-1, (pid = fork()));
|
||||
if (!pid) {
|
||||
execl("bin/pylife.com", "bin/pylife.com", 0);
|
||||
_Exit(127);
|
||||
}
|
||||
ASSERT_EQ(pid, wait(&ws));
|
||||
EXPECT_TRUE(WIFEXITED(ws));
|
||||
EXPECT_EQ(42, WEXITSTATUS(ws));
|
||||
EXPECT_TRUE(HasMzHeader("bin/pylife.com"));
|
||||
}
|
||||
}
|
||||
|
||||
TEST(execve, vfork_apeNoMod3mb) {
|
||||
for (int i = 0; i < 2; ++i) {
|
||||
ASSERT_NE(-1, (pid = vfork()));
|
||||
if (!pid) {
|
||||
execl("bin/pylife.com", "bin/pylife.com", 0);
|
||||
_Exit(127);
|
||||
}
|
||||
ASSERT_EQ(pid, wait(&ws));
|
||||
EXPECT_TRUE(WIFEXITED(ws));
|
||||
EXPECT_EQ(42, WEXITSTATUS(ws));
|
||||
EXPECT_TRUE(HasMzHeader("bin/pylife.com"));
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
void SystemElf(void) {
|
||||
system("bin/tiny64.elf");
|
||||
}
|
||||
|
||||
void ForkElf(void) {
|
||||
if (!(pid = fork())) {
|
||||
execl("bin/tiny64.elf", "bin/tiny64.elf", 0);
|
||||
_Exit(127);
|
||||
}
|
||||
waitpid(pid, 0, 0);
|
||||
}
|
||||
|
||||
void VforkElf(void) {
|
||||
if (!(pid = vfork())) {
|
||||
execl("bin/tiny64.elf", "bin/tiny64.elf", 0);
|
||||
_Exit(127);
|
||||
}
|
||||
waitpid(pid, 0, 0);
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
void SystemNoMod(void) {
|
||||
system("bin/life-nomod.com");
|
||||
}
|
||||
|
||||
void ForkNoMod(void) {
|
||||
if (!(pid = fork())) {
|
||||
execl("bin/life-nomod.com", "bin/life-nomod.com", 0);
|
||||
_Exit(127);
|
||||
}
|
||||
waitpid(pid, 0, 0);
|
||||
}
|
||||
|
||||
void VforkNoMod(void) {
|
||||
if (!(pid = vfork())) {
|
||||
execl("bin/life-nomod.com", "bin/life-nomod.com", 0);
|
||||
_Exit(127);
|
||||
}
|
||||
waitpid(pid, 0, 0);
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
void SystemClassic(void) {
|
||||
system("bin/life-classic.com");
|
||||
}
|
||||
|
||||
void ForkClassic(void) {
|
||||
if (!(pid = fork())) {
|
||||
execl("bin/life-classic.com", "bin/life-classic.com", 0);
|
||||
_Exit(127);
|
||||
}
|
||||
waitpid(pid, 0, 0);
|
||||
}
|
||||
|
||||
void VforkClassic(void) {
|
||||
if (!(pid = vfork())) {
|
||||
execl("bin/life-classic.com", "bin/life-classic.com", 0);
|
||||
_Exit(127);
|
||||
}
|
||||
waitpid(pid, 0, 0);
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
void SystemNoMod3mb(void) {
|
||||
system("bin/life-nomod.com");
|
||||
}
|
||||
|
||||
void ForkNoMod3mb(void) {
|
||||
if (!(pid = fork())) {
|
||||
execl("bin/life-nomod.com", "bin/life-nomod.com", 0);
|
||||
_Exit(127);
|
||||
}
|
||||
waitpid(pid, 0, 0);
|
||||
}
|
||||
|
||||
void VforkNoMod3mb(void) {
|
||||
if (!(pid = vfork())) {
|
||||
execl("bin/life-nomod.com", "bin/life-nomod.com", 0);
|
||||
_Exit(127);
|
||||
}
|
||||
waitpid(pid, 0, 0);
|
||||
}
|
||||
|
||||
BENCH(execve, bench1) {
|
||||
if (IsLinux()) {
|
||||
EZBENCH2("ForkElf", donothing, ForkElf());
|
||||
EZBENCH2("VforkElf", donothing, VforkElf());
|
||||
EZBENCH2("SystemElf", donothing, SystemElf());
|
||||
kprintf("\n");
|
||||
}
|
||||
|
||||
EZBENCH2("ForkApeClassic", donothing, ForkClassic());
|
||||
EZBENCH2("VforkApeClassic", donothing, VforkClassic());
|
||||
if (!IsWindows()) {
|
||||
EZBENCH2("SystemApeClassic", donothing, SystemClassic());
|
||||
}
|
||||
kprintf("\n");
|
||||
|
||||
EZBENCH2("ForkApeNoMod", donothing, ForkNoMod());
|
||||
EZBENCH2("VforkApeNoMod", donothing, VforkNoMod());
|
||||
if (!IsWindows()) {
|
||||
EZBENCH2("SystemApeNoMod", donothing, SystemNoMod());
|
||||
}
|
||||
kprintf("\n");
|
||||
|
||||
EZBENCH2("ForkNoMod3mb", donothing, ForkNoMod3mb());
|
||||
EZBENCH2("VforkNoMod3mb", donothing, VforkNoMod3mb());
|
||||
if (!IsWindows()) {
|
||||
EZBENCH2("SystemNoMod3mb", donothing, SystemNoMod3mb());
|
||||
}
|
||||
}
|
|
@ -23,13 +23,12 @@
|
|||
#include "libc/sysv/consts/o.h"
|
||||
#include "libc/testlib/testlib.h"
|
||||
|
||||
#define PATH "o/vfork_test"
|
||||
char testlib_enable_tmp_setup_teardown;
|
||||
|
||||
TEST(vfork, test) {
|
||||
int fd;
|
||||
char buf[8] = {0};
|
||||
mkdir("o", 0755);
|
||||
ASSERT_NE(-1, (fd = open(PATH, O_RDWR | O_CREAT, 0644)));
|
||||
ASSERT_NE(-1, (fd = open("vfork_test", O_RDWR | O_CREAT, 0644)));
|
||||
ASSERT_EQ(5, write(fd, "hello", 5));
|
||||
ASSERT_NE(-1, lseek(fd, 0, SEEK_SET));
|
||||
if (!vfork()) {
|
||||
|
@ -44,5 +43,4 @@ TEST(vfork, test) {
|
|||
EXPECT_EQ(5, read(fd, buf, 5));
|
||||
EXPECT_STREQ("hello", buf);
|
||||
EXPECT_NE(-1, close(fd));
|
||||
unlink(PATH);
|
||||
}
|
||||
|
|
|
@ -44,10 +44,10 @@ STATIC_YOINK("zip_uri_support");
|
|||
|
||||
#define EACCES_OR_ENOENT (IsOpenbsd() ? ENOENT : EACCES)
|
||||
|
||||
#define SPAWN() \
|
||||
{ \
|
||||
int ws, pid; \
|
||||
ASSERT_NE(-1, (pid = fork())); \
|
||||
#define SPAWN(METHOD) \
|
||||
{ \
|
||||
int ws, pid; \
|
||||
ASSERT_NE(-1, (pid = METHOD())); \
|
||||
if (!pid) {
|
||||
|
||||
#define EXITS(rc) \
|
||||
|
@ -94,7 +94,7 @@ int extract(const char *from, const char *to, int mode) {
|
|||
}
|
||||
|
||||
TEST(unveil, api_differences) {
|
||||
SPAWN();
|
||||
SPAWN(fork);
|
||||
ASSERT_SYS(0, 0, stat("/", &st));
|
||||
ASSERT_SYS(0, 0, unveil(".", "rw"));
|
||||
if (IsOpenbsd()) {
|
||||
|
@ -117,12 +117,12 @@ TEST(unveil, api_differences) {
|
|||
}
|
||||
|
||||
TEST(unveil, rx_readOnlyPreexistingExecutable_worksFine) {
|
||||
SPAWN();
|
||||
SPAWN(fork);
|
||||
ASSERT_SYS(0, 0, mkdir("folder", 0755));
|
||||
ASSERT_SYS(0, 0, extract("/zip/life.elf", "folder/life.elf", 0755));
|
||||
ASSERT_SYS(0, 0, unveil("folder", "rx"));
|
||||
ASSERT_SYS(0, 0, unveil(0, 0));
|
||||
SPAWN();
|
||||
SPAWN(fork);
|
||||
execl("folder/life.elf", "folder/life.elf", 0);
|
||||
kprintf("execve failed! %s\n", strerror(errno));
|
||||
_Exit(127);
|
||||
|
@ -131,24 +131,41 @@ TEST(unveil, rx_readOnlyPreexistingExecutable_worksFine) {
|
|||
}
|
||||
|
||||
TEST(unveil, r_noExecutePreexistingExecutable_raisesEacces) {
|
||||
SPAWN();
|
||||
SPAWN(fork);
|
||||
ASSERT_SYS(0, 0, mkdir("folder", 0755));
|
||||
ASSERT_SYS(0, 0, extract("/zip/life.elf", "folder/life.elf", 0755));
|
||||
ASSERT_SYS(0, 0, unveil("folder", "r"));
|
||||
ASSERT_SYS(0, 0, unveil(0, 0));
|
||||
SPAWN();
|
||||
SPAWN(fork);
|
||||
ASSERT_SYS(EACCES, -1, execl("folder/life.elf", "folder/life.elf", 0));
|
||||
EXITS(0);
|
||||
EXITS(0);
|
||||
}
|
||||
|
||||
TEST(unveil, canBeUsedAgainAfterVfork) {
|
||||
ASSERT_SYS(0, 0, touch("bad", 0644));
|
||||
ASSERT_SYS(0, 0, touch("good", 0644));
|
||||
SPAWN(fork);
|
||||
SPAWN(vfork);
|
||||
ASSERT_SYS(0, 0, unveil("bad", "r"));
|
||||
ASSERT_SYS(0, 0, unveil("good", "r"));
|
||||
ASSERT_SYS(0, 0, unveil(0, 0));
|
||||
ASSERT_SYS(0, 3, open("bad", 0));
|
||||
EXITS(0);
|
||||
ASSERT_SYS(0, 0, unveil("good", "r"));
|
||||
ASSERT_SYS(0, 0, unveil(0, 0));
|
||||
ASSERT_SYS(0, 3, open("good", 0));
|
||||
ASSERT_SYS(EACCES_OR_ENOENT, -1, open("bad", 0));
|
||||
EXITS(0);
|
||||
}
|
||||
|
||||
TEST(unveil, rwc_createExecutableFile_isAllowedButCantBeRun) {
|
||||
SPAWN();
|
||||
SPAWN(fork);
|
||||
ASSERT_SYS(0, 0, mkdir("folder", 0755));
|
||||
ASSERT_SYS(0, 0, unveil("folder", "rwc"));
|
||||
ASSERT_SYS(0, 0, unveil(0, 0));
|
||||
ASSERT_SYS(0, 0, extract("/zip/life.elf", "folder/life.elf", 0755));
|
||||
SPAWN();
|
||||
SPAWN(fork);
|
||||
ASSERT_SYS(0, 0, stat("folder/life.elf", &st));
|
||||
ASSERT_SYS(EACCES, -1, execl("folder/life.elf", "folder/life.elf", 0));
|
||||
EXITS(0);
|
||||
|
@ -156,12 +173,12 @@ TEST(unveil, rwc_createExecutableFile_isAllowedButCantBeRun) {
|
|||
}
|
||||
|
||||
TEST(unveil, rwcx_createExecutableFile_canAlsoBeRun) {
|
||||
SPAWN();
|
||||
SPAWN(fork);
|
||||
ASSERT_SYS(0, 0, mkdir("folder", 0755));
|
||||
ASSERT_SYS(0, 0, unveil("folder", "rwcx"));
|
||||
ASSERT_SYS(0, 0, unveil(0, 0));
|
||||
ASSERT_SYS(0, 0, extract("/zip/life.elf", "folder/life.elf", 0755));
|
||||
SPAWN();
|
||||
SPAWN(fork);
|
||||
ASSERT_SYS(0, 0, stat("folder/life.elf", &st));
|
||||
execl("folder/life.elf", "folder/life.elf", 0);
|
||||
kprintf("execve failed! %s\n", strerror(errno));
|
||||
|
@ -171,7 +188,7 @@ TEST(unveil, rwcx_createExecutableFile_canAlsoBeRun) {
|
|||
}
|
||||
|
||||
TEST(unveil, dirfdHacking_doesntWork) {
|
||||
SPAWN();
|
||||
SPAWN(fork);
|
||||
ASSERT_SYS(0, 0, mkdir("jail", 0755));
|
||||
ASSERT_SYS(0, 0, mkdir("garden", 0755));
|
||||
ASSERT_SYS(0, 0, touch("garden/secret.txt", 0644));
|
||||
|
@ -184,7 +201,7 @@ TEST(unveil, dirfdHacking_doesntWork) {
|
|||
|
||||
TEST(unveil, mostRestrictivePolicy) {
|
||||
if (IsOpenbsd()) return; // openbsd behaves oddly; see docs
|
||||
SPAWN();
|
||||
SPAWN(fork);
|
||||
ASSERT_SYS(0, 0, mkdir("jail", 0755));
|
||||
ASSERT_SYS(0, 0, mkdir("garden", 0755));
|
||||
ASSERT_SYS(0, 0, touch("garden/secret.txt", 0644));
|
||||
|
@ -195,7 +212,7 @@ TEST(unveil, mostRestrictivePolicy) {
|
|||
}
|
||||
|
||||
TEST(unveil, overlappingDirectories_inconsistentBehavior) {
|
||||
SPAWN();
|
||||
SPAWN(fork);
|
||||
ASSERT_SYS(0, 0, makedirs("f1/f2", 0755));
|
||||
ASSERT_SYS(0, 0, extract("/zip/life.elf", "f1/f2/life.elf", 0755));
|
||||
ASSERT_SYS(0, 0, unveil("f1", "x"));
|
||||
|
@ -203,7 +220,7 @@ TEST(unveil, overlappingDirectories_inconsistentBehavior) {
|
|||
ASSERT_SYS(0, 0, unveil(0, 0));
|
||||
if (IsOpenbsd()) {
|
||||
// OpenBSD favors the most restrictive policy
|
||||
SPAWN();
|
||||
SPAWN(fork);
|
||||
ASSERT_SYS(0, 0, stat("f1/f2/life.elf", &st));
|
||||
ASSERT_SYS(EACCES, -1, execl("f1/f2/life.elf", "f1/f2/life.elf", 0));
|
||||
EXITS(0);
|
||||
|
@ -214,7 +231,7 @@ TEST(unveil, overlappingDirectories_inconsistentBehavior) {
|
|||
// exit code of 0! find out why this is happening...
|
||||
// so far it's happened to MODE=rel and MODE=tiny...
|
||||
//
|
||||
// SPAWN();
|
||||
// SPAWN(fork);
|
||||
// ASSERT_SYS(0, 0, stat("f1/f2/life.elf", &st));
|
||||
// execl("f1/f2/life.elf", "f1/f2/life.elf", 0);
|
||||
// kprintf("execve failed! %s\n", strerror(errno));
|
||||
|
@ -225,7 +242,7 @@ TEST(unveil, overlappingDirectories_inconsistentBehavior) {
|
|||
}
|
||||
|
||||
TEST(unveil, usedTwice_forbidden) {
|
||||
SPAWN();
|
||||
SPAWN(fork);
|
||||
ASSERT_SYS(0, 0, mkdir("jail", 0755));
|
||||
ASSERT_SYS(0, 0, mkdir("garden", 0755));
|
||||
ASSERT_SYS(0, 0, xbarf("garden/secret.txt", "hello", 5));
|
||||
|
@ -288,7 +305,7 @@ TEST(unveil, usedTwice_forbidden_worksWithPledge) {
|
|||
|
||||
TEST(unveil, lotsOfPaths) {
|
||||
int i, n;
|
||||
SPAWN();
|
||||
SPAWN(fork);
|
||||
n = 100;
|
||||
for (i = 0; i < n; ++i) {
|
||||
ASSERT_SYS(0, 0, touch(xasprintf("%d", i), 0644));
|
||||
|
@ -305,3 +322,15 @@ TEST(unveil, lotsOfPaths) {
|
|||
}
|
||||
EXITS(0);
|
||||
}
|
||||
|
||||
TEST(unveil, reparent) {
|
||||
return; // need abi 2 :'(
|
||||
SPAWN(fork);
|
||||
ASSERT_SYS(0, 0, mkdir("x", 0755));
|
||||
ASSERT_SYS(0, 0, unveil("x", "rwc"));
|
||||
ASSERT_SYS(0, 0, unveil(0, 0));
|
||||
ASSERT_SYS(0, 0, mkdir("x/y", 0755));
|
||||
ASSERT_SYS(0, 0, touch("x/y/z", 0644));
|
||||
ASSERT_SYS(0, 0, rename("x/y/z", "x/z"));
|
||||
EXITS(0);
|
||||
}
|
||||
|
|
|
@ -9,10 +9,6 @@ int main(int argc, char *argv[]) {
|
|||
fputs(_gc(xiso8601ts(NULL)), f);
|
||||
fputs(_gc(xasprintf("hello world %d %s\n", argc, s)), f);
|
||||
fclose(f);
|
||||
rc = system("exit 42");
|
||||
CHECK_NE(-1, rc);
|
||||
CHECK(WIFEXITED(rc));
|
||||
CHECK_EQ(42, WEXITSTATUS(rc));
|
||||
free(s);
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -1,11 +1,9 @@
|
|||
int main() {
|
||||
int rc;
|
||||
FILE *f;
|
||||
f = fopen("/dev/null", "w");
|
||||
fprintf(f, "hello world\n");
|
||||
fclose(f);
|
||||
rc = system("exit 42");
|
||||
CHECK_NE(-1, rc);
|
||||
CHECK_EQ(42, WEXITSTATUS(rc));
|
||||
return 0;
|
||||
int *x = new int[32];
|
||||
x[0] = 2;
|
||||
x[1] = 2;
|
||||
x[2] = x[0] + x[1];
|
||||
return x[2] - 4;
|
||||
}
|
||||
|
|
|
@ -18,6 +18,7 @@
|
|||
╚─────────────────────────────────────────────────────────────────────────────*/
|
||||
#include "libc/bits/atomic.h"
|
||||
#include "libc/bits/bits.h"
|
||||
#include "libc/bits/safemacros.internal.h"
|
||||
#include "libc/bits/xchg.internal.h"
|
||||
#include "libc/calls/calls.h"
|
||||
#include "libc/calls/ucontext.h"
|
||||
|
@ -46,6 +47,8 @@
|
|||
#include "libc/x/x.h"
|
||||
#include "third_party/xed/x86.h"
|
||||
|
||||
#define TMP firstnonnull(getenv("TMPDIR"), kTmpPath)
|
||||
|
||||
char testlib_enable_tmp_setup_teardown;
|
||||
|
||||
__attribute__((__constructor__)) static void init(void) {
|
||||
|
@ -93,7 +96,7 @@ TEST(mmap, testMapFile) {
|
|||
int fd;
|
||||
char *p;
|
||||
char path[PATH_MAX];
|
||||
sprintf(path, "%s%s.%ld", kTmpPath, program_invocation_short_name, lemur64());
|
||||
sprintf(path, "%s.%ld", program_invocation_short_name, lemur64());
|
||||
ASSERT_NE(-1, (fd = open(path, O_CREAT | O_TRUNC | O_RDWR, 0644)));
|
||||
EXPECT_EQ(5, write(fd, "hello", 5));
|
||||
EXPECT_NE(-1, fdatasync(fd));
|
||||
|
@ -107,7 +110,7 @@ TEST(mmap, testMapFile) {
|
|||
TEST(mmap, testMapFile_fdGetsClosed_makesNoDifference) {
|
||||
int fd;
|
||||
char *p, buf[16], path[PATH_MAX];
|
||||
sprintf(path, "%s%s.%ld", kTmpPath, program_invocation_short_name, lemur64());
|
||||
sprintf(path, "%s.%ld", program_invocation_short_name, lemur64());
|
||||
ASSERT_NE(-1, (fd = open(path, O_CREAT | O_TRUNC | O_RDWR, 0644)));
|
||||
EXPECT_EQ(5, write(fd, "hello", 5));
|
||||
EXPECT_NE(-1, fdatasync(fd));
|
||||
|
@ -227,8 +230,9 @@ TEST(mmap, cow) {
|
|||
int fd;
|
||||
char *p;
|
||||
char path[PATH_MAX];
|
||||
sprintf(path, "%s%s.%ld", kTmpPath, program_invocation_short_name, lemur64());
|
||||
ASSERT_NE(-1, (fd = open(path, O_CREAT | O_TRUNC | O_RDWR, 0644)));
|
||||
sprintf(path, "%s.%ld", program_invocation_short_name, lemur64());
|
||||
ASSERT_NE(-1, (fd = open(path, O_CREAT | O_TRUNC | O_RDWR, 0644)), "%s",
|
||||
path);
|
||||
EXPECT_EQ(5, write(fd, "hello", 5));
|
||||
EXPECT_NE(-1, fdatasync(fd));
|
||||
EXPECT_NE(MAP_FAILED,
|
||||
|
@ -246,7 +250,7 @@ TEST(mmap, cowFileMapReadonlyFork) {
|
|||
char *p;
|
||||
int fd, pid, ws;
|
||||
char path[PATH_MAX], lol[6];
|
||||
sprintf(path, "%s%s.%ld", kTmpPath, program_invocation_short_name, lemur64());
|
||||
sprintf(path, "%s.%ld", program_invocation_short_name, lemur64());
|
||||
ASSERT_NE(-1, (fd = open(path, O_CREAT | O_TRUNC | O_RDWR, 0644)));
|
||||
EXPECT_EQ(6, write(fd, "hello", 6));
|
||||
EXPECT_NE(-1, close(fd));
|
||||
|
@ -271,7 +275,7 @@ TEST(mmap, cowFileMapFork) {
|
|||
char *p;
|
||||
int fd, pid, ws;
|
||||
char path[PATH_MAX], lol[6];
|
||||
sprintf(path, "%s%s.%ld", kTmpPath, program_invocation_short_name, lemur64());
|
||||
sprintf(path, "%s.%ld", program_invocation_short_name, lemur64());
|
||||
ASSERT_NE(-1, (fd = open(path, O_CREAT | O_TRUNC | O_RDWR, 0644)));
|
||||
EXPECT_EQ(6, write(fd, "parnt", 6));
|
||||
EXPECT_NE(-1, fdatasync(fd));
|
||||
|
@ -321,7 +325,7 @@ TEST(mmap, sharedFileMapFork) {
|
|||
char *p;
|
||||
int fd, pid, ws;
|
||||
char path[PATH_MAX], lol[6];
|
||||
sprintf(path, "%s%s.%ld", kTmpPath, program_invocation_short_name, lemur64());
|
||||
sprintf(path, "%s.%ld", program_invocation_short_name, lemur64());
|
||||
ASSERT_NE(-1, (fd = open(path, O_CREAT | O_TRUNC | O_RDWR, 0644)));
|
||||
EXPECT_EQ(6, write(fd, "parnt", 6));
|
||||
EXPECT_NE(-1, fdatasync(fd));
|
||||
|
|
|
@ -1,35 +0,0 @@
|
|||
/*-*- mode:c;indent-tabs-mode:nil;c-basic-offset:2;tab-width:8;coding:utf-8 -*-│
|
||||
│vi: set net ft=c ts=2 sts=2 sw=2 fenc=utf-8 :vi│
|
||||
╞══════════════════════════════════════════════════════════════════════════════╡
|
||||
│ Copyright 2021 Justine Alexandra Roberts Tunney │
|
||||
│ │
|
||||
│ Permission to use, copy, modify, and/or distribute this software for │
|
||||
│ any purpose with or without fee is hereby granted, provided that the │
|
||||
│ above copyright notice and this permission notice appear in all copies. │
|
||||
│ │
|
||||
│ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL │
|
||||
│ WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED │
|
||||
│ WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE │
|
||||
│ AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL │
|
||||
│ DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR │
|
||||
│ PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER │
|
||||
│ TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR │
|
||||
│ PERFORMANCE OF THIS SOFTWARE. │
|
||||
╚─────────────────────────────────────────────────────────────────────────────*/
|
||||
#include "libc/calls/calls.h"
|
||||
#include "libc/log/check.h"
|
||||
#include "libc/stdio/stdio.h"
|
||||
#include "libc/testlib/testlib.h"
|
||||
|
||||
TEST(popen, test) {
|
||||
int ws;
|
||||
FILE *f;
|
||||
f = popen("echo hi", "r");
|
||||
ASSERT_NE(NULL, f);
|
||||
EXPECT_EQ('h', fgetc(f));
|
||||
EXPECT_EQ('i', fgetc(f));
|
||||
ws = pclose(f);
|
||||
EXPECT_NE(-1, ws);
|
||||
EXPECT_TRUE(WIFEXITED(ws));
|
||||
EXPECT_EQ(0, WEXITSTATUS(ws));
|
||||
}
|
|
@ -58,6 +58,7 @@ o/$(MODE)/test/libc/stdio/%.com.dbg: \
|
|||
$(TEST_LIBC_STDIO_DEPS) \
|
||||
o/$(MODE)/test/libc/stdio/%.o \
|
||||
o/$(MODE)/test/libc/stdio/stdio.pkg \
|
||||
o/$(MODE)/tool/build/echo.zip.o \
|
||||
$(LIBC_TESTMAIN) \
|
||||
$(CRT) \
|
||||
$(APE_NO_MODIFY_SELF)
|
||||
|
|
|
@ -22,24 +22,22 @@
|
|||
#include "libc/testlib/testlib.h"
|
||||
#include "libc/x/x.h"
|
||||
|
||||
char testlib_enable_tmp_setup_teardown;
|
||||
|
||||
TEST(xslurp, testEmptyWithNulTerminatedStringBehavior) {
|
||||
size_t got;
|
||||
const char *data;
|
||||
const char *path = gc(xjoinpaths(kTmpPath, "xslurp.txt"));
|
||||
ASSERT_NE(-1, xbarf(path, "", -1));
|
||||
ASSERT_NE(NULL, (data = gc(xslurp(path, &got))));
|
||||
ASSERT_NE(-1, xbarf("xslurp.txt", "", -1));
|
||||
ASSERT_NE(NULL, (data = gc(xslurp("xslurp.txt", &got))));
|
||||
ASSERT_EQ(0, got);
|
||||
ASSERT_STREQ("", data);
|
||||
ASSERT_NE(-1, unlink(path));
|
||||
}
|
||||
|
||||
TEST(xslurp, testHyperion) {
|
||||
size_t got;
|
||||
const char *data;
|
||||
const char *path = gc(xjoinpaths(kTmpPath, "xslurp.txt"));
|
||||
ASSERT_NE(-1, xbarf(path, kHyperion, kHyperionSize));
|
||||
ASSERT_NE(NULL, (data = gc(xslurp(path, &got))));
|
||||
ASSERT_NE(-1, xbarf("xslurp.txt", kHyperion, kHyperionSize));
|
||||
ASSERT_NE(NULL, (data = gc(xslurp("xslurp.txt", &got))));
|
||||
ASSERT_EQ(kHyperionSize, got);
|
||||
ASSERT_EQ(0, memcmp(data, kHyperion, kHyperionSize));
|
||||
ASSERT_NE(-1, unlink(path));
|
||||
}
|
||||
|
|
2
third_party/bzip2/bzip2.mk
vendored
2
third_party/bzip2/bzip2.mk
vendored
|
@ -8,6 +8,7 @@ THIRD_PARTY_BZIP2 = $(THIRD_PARTY_BZIP2_A_DEPS) $(THIRD_PARTY_BZIP2_A)
|
|||
THIRD_PARTY_BZIP2_A = o/$(MODE)/third_party/bzip2/bzip2.a
|
||||
THIRD_PARTY_BZIP2_A_FILES := $(wildcard third_party/bzip2/*)
|
||||
THIRD_PARTY_BZIP2_A_HDRS = $(filter %.h,$(THIRD_PARTY_BZIP2_A_FILES))
|
||||
THIRD_PARTY_BZIP2_A_INCS = $(filter %.inc,$(THIRD_PARTY_BZIP2_A_FILES))
|
||||
THIRD_PARTY_BZIP2_A_SRCS = $(filter %.c,$(THIRD_PARTY_BZIP2_A_FILES))
|
||||
THIRD_PARTY_BZIP2_A_OBJS = $(THIRD_PARTY_BZIP2_A_SRCS:%.c=o/$(MODE)/%.o)
|
||||
THIRD_PARTY_BZIP2_BINS = $(THIRD_PARTY_BZIP2_COMS) $(THIRD_PARTY_BZIP2_COMS:%=%.dbg)
|
||||
|
@ -70,6 +71,7 @@ $(THIRD_PARTY_BZIP2_A_OBJS): \
|
|||
THIRD_PARTY_BZIP2_LIBS = $(foreach x,$(THIRD_PARTY_BZIP2_ARTIFACTS),$($(x)))
|
||||
THIRD_PARTY_BZIP2_SRCS = $(foreach x,$(THIRD_PARTY_BZIP2_ARTIFACTS),$($(x)_SRCS))
|
||||
THIRD_PARTY_BZIP2_HDRS = $(foreach x,$(THIRD_PARTY_BZIP2_ARTIFACTS),$($(x)_HDRS))
|
||||
THIRD_PARTY_BZIP2_INCS = $(foreach x,$(THIRD_PARTY_BZIP2_ARTIFACTS),$($(x)_INCS))
|
||||
THIRD_PARTY_BZIP2_BINS = $(foreach x,$(THIRD_PARTY_BZIP2_ARTIFACTS),$($(x)_BINS))
|
||||
THIRD_PARTY_BZIP2_CHECKS = $(foreach x,$(THIRD_PARTY_BZIP2_ARTIFACTS),$($(x)_CHECKS))
|
||||
THIRD_PARTY_BZIP2_OBJS = $(foreach x,$(THIRD_PARTY_BZIP2_ARTIFACTS),$($(x)_OBJS))
|
||||
|
|
4
third_party/libcxx/__mutex_base
vendored
4
third_party/libcxx/__mutex_base
vendored
|
@ -15,7 +15,9 @@
|
|||
#include "third_party/libcxx/system_error"
|
||||
#include "third_party/libcxx/__threading_support"
|
||||
|
||||
#include "libc/isystem/time.h"
|
||||
#include "libc/sysv/consts/sched.h"
|
||||
#include "libc/time/struct/tm.h"
|
||||
#include "libc/time/time.h"
|
||||
|
||||
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
|
||||
#pragma GCC system_header
|
||||
|
|
3
third_party/libcxx/string.h
vendored
3
third_party/libcxx/string.h
vendored
|
@ -57,7 +57,8 @@ size_t strlen(const char* s);
|
|||
#pragma GCC system_header
|
||||
#endif
|
||||
|
||||
#include "libc/isystem/string.h"
|
||||
#include "libc/alg/alg.h"
|
||||
#include "libc/str/str.h"
|
||||
|
||||
// MSVCRT, GNU libc and its derivates may already have the correct prototype in
|
||||
// <string.h>. This macro can be defined by users if their C library provides
|
||||
|
|
3
third_party/libcxx/wchar.h
vendored
3
third_party/libcxx/wchar.h
vendored
|
@ -9,7 +9,8 @@
|
|||
|
||||
#ifndef _LIBCPP_WCHAR_H
|
||||
#define _LIBCPP_WCHAR_H
|
||||
#include "libc/isystem/wchar.h"
|
||||
#include "libc/str/str.h"
|
||||
#include "libc/time/time.h"
|
||||
|
||||
/*
|
||||
wchar.h synopsis
|
||||
|
|
3
third_party/libcxx/wctype.h
vendored
3
third_party/libcxx/wctype.h
vendored
|
@ -50,7 +50,8 @@ wctrans_t wctrans(const char* property);
|
|||
#pragma GCC system_header
|
||||
#endif
|
||||
|
||||
#include "libc/isystem/wctype.h"
|
||||
#include "libc/str/str.h"
|
||||
#include "libc/time/time.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
|
|
3
third_party/lz4cli/lz4cli.mk
vendored
3
third_party/lz4cli/lz4cli.mk
vendored
|
@ -59,6 +59,9 @@ o/$(MODE)/third_party/lz4cli/lz4cli.com.dbg: \
|
|||
$(APE_NO_MODIFY_SELF)
|
||||
@$(APELINK)
|
||||
|
||||
o/$(MODE)/third_party/lz4cli/lz4cli.o: \
|
||||
third_party/lz4cli/COPYING
|
||||
|
||||
$(THIRD_PARTY_LZ4CLI_OBJS): \
|
||||
$(BUILD_FILES) \
|
||||
third_party/lz4cli/lz4cli.mk
|
||||
|
|
2
third_party/make/dirname.h
vendored
2
third_party/make/dirname.h
vendored
|
@ -20,7 +20,7 @@
|
|||
|
||||
#ifndef DIRNAME_H_
|
||||
# define DIRNAME_H_ 1
|
||||
# include "third_party/make/dosname.h"
|
||||
#include "third_party/make/dosname.h"
|
||||
|
||||
# ifndef DIRECTORY_SEPARATOR
|
||||
# define DIRECTORY_SEPARATOR '/'
|
||||
|
|
8
third_party/make/error.c
vendored
8
third_party/make/error.c
vendored
|
@ -28,7 +28,7 @@
|
|||
#include "third_party/make/stdio.h"
|
||||
|
||||
#if !_LIBC && ENABLE_NLS
|
||||
# include "third_party/make/gettext.h"
|
||||
#include "third_party/make/gettext.h"
|
||||
# define _(msgid) gettext (msgid)
|
||||
#endif
|
||||
|
||||
|
@ -38,11 +38,7 @@
|
|||
# define _GL_ATTRIBUTE_FORMAT_PRINTF(a, b)
|
||||
# define _GL_ARG_NONNULL(a)
|
||||
#else
|
||||
# include "getprogname.h"
|
||||
#endif
|
||||
|
||||
#if USE_UNLOCKED_IO
|
||||
# include "unlocked-io.h"
|
||||
#include "third_party/make/getprogname.h"
|
||||
#endif
|
||||
|
||||
#ifndef _
|
||||
|
|
2
third_party/make/getopt.c
vendored
2
third_party/make/getopt.c
vendored
|
@ -31,7 +31,7 @@ this program. If not, see <http://www.gnu.org/licenses/>. */
|
|||
#endif
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
# include "third_party/make/config.h"
|
||||
#include "third_party/make/config.h"
|
||||
#endif
|
||||
#pragma GCC diagnostic ignored "-Wredundant-decls"
|
||||
|
||||
|
|
36
third_party/make/make.mk
vendored
36
third_party/make/make.mk
vendored
|
@ -13,6 +13,42 @@ THIRD_PARTY_MAKE_BINS = \
|
|||
THIRD_PARTY_MAKE_A = \
|
||||
o/$(MODE)/third_party/make/make.a
|
||||
|
||||
THIRD_PARTY_MAKE_HDRS = \
|
||||
third_party/make/filename.h \
|
||||
third_party/make/dirname.h \
|
||||
third_party/make/stddef.h \
|
||||
third_party/make/error.h \
|
||||
third_party/make/gnumake.h \
|
||||
third_party/make/gettext.h \
|
||||
third_party/make/stdlib.h \
|
||||
third_party/make/xalloc.h \
|
||||
third_party/make/xalloc-oversized.h \
|
||||
third_party/make/os.h \
|
||||
third_party/make/stdint.h \
|
||||
third_party/make/fd-hook.h \
|
||||
third_party/make/job.h \
|
||||
third_party/make/unistd.h \
|
||||
third_party/make/getprogname.h \
|
||||
third_party/make/dosname.h \
|
||||
third_party/make/config.h \
|
||||
third_party/make/concat-filename.h \
|
||||
third_party/make/findprog.h \
|
||||
third_party/make/intprops.h \
|
||||
third_party/make/exitfail.h \
|
||||
third_party/make/alloca.h \
|
||||
third_party/make/hash.h \
|
||||
third_party/make/rule.h \
|
||||
third_party/make/filedef.h \
|
||||
third_party/make/fcntl.h \
|
||||
third_party/make/stdio.h \
|
||||
third_party/make/variable.h \
|
||||
third_party/make/debug.h \
|
||||
third_party/make/output.h \
|
||||
third_party/make/getopt.h \
|
||||
third_party/make/dep.h \
|
||||
third_party/make/commands.h
|
||||
|
||||
|
||||
THIRD_PARTY_MAKE_INCS = \
|
||||
third_party/make/makeint.inc
|
||||
|
||||
|
|
1
third_party/mbedtls/test/lib.c
vendored
1
third_party/mbedtls/test/lib.c
vendored
|
@ -90,6 +90,7 @@ int mbedtls_test_platform_setup(void) {
|
|||
int ret = 0;
|
||||
static char mybuf[2][BUFSIZ];
|
||||
ShowCrashReports();
|
||||
makedirs("o/tmp", 0755);
|
||||
setvbuf(stdout, mybuf[0], _IOLBF, BUFSIZ);
|
||||
setvbuf(stderr, mybuf[1], _IOLBF, BUFSIZ);
|
||||
#if defined(MBEDTLS_PLATFORM_C)
|
||||
|
|
|
@ -15,6 +15,7 @@
|
|||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
#include "libc/intrin/kprintf.h"
|
||||
#include "third_party/mbedtls/test/test.inc"
|
||||
/*
|
||||
* *** THIS FILE WAS MACHINE GENERATED ***
|
||||
|
|
|
@ -1088,10 +1088,10 @@ depends_on:0
|
|||
5:int:256
|
||||
|
||||
CTR_DRBG write/update seed file [#1]
|
||||
7:char*:"/tmp/test_suite_ctr_drbg_seed":int:0
|
||||
7:char*:"o/tmp/test_suite_ctr_drbg_seed":int:0
|
||||
|
||||
CTR_DRBG write/update seed file [#2]
|
||||
7:char*:"/tmp/test_suite_ctr_dbg_no_such_dir/file":exp:1
|
||||
7:char*:"o/tmp/test_suite_ctr_dbg_no_such_dir/file":exp:1
|
||||
|
||||
CTR_DRBG Special Behaviours
|
||||
0
|
||||
|
|
|
@ -8,10 +8,10 @@ Create NV seed_file
|
|||
8
|
||||
|
||||
Entropy write/update seed file: good
|
||||
1:char*:"/tmp/mbedtls_test_suite_entropy_seed":int:0
|
||||
1:char*:"o/tmp/mbedtls_test_suite_entropy_seed":int:0
|
||||
|
||||
Entropy write/update seed file: nonexistent
|
||||
1:char*:"/tmp/no_such_dir/file":exp:0
|
||||
1:char*:"o/tmp/no_such_dir/file":exp:0
|
||||
|
||||
Entropy no sources
|
||||
2
|
||||
|
|
|
@ -20,7 +20,7 @@ depends_on:2
|
|||
|
||||
HMAC_DRBG write/update seed file SHA-1 [#1]
|
||||
depends_on:0
|
||||
1:exp:0:char*:"/tmp/test_suite_hmac_drbg_seed":int:0
|
||||
1:exp:0:char*:"o/tmp/test_suite_hmac_drbg_seed":int:0
|
||||
|
||||
HMAC_DRBG write/update seed file SHA-1 [#2]
|
||||
depends_on:0
|
||||
|
@ -28,7 +28,7 @@ depends_on:0
|
|||
|
||||
HMAC_DRBG write/update seed file SHA-224 [#1]
|
||||
depends_on:1
|
||||
1:exp:1:char*:"/tmp/test_suite_hmac_drbg_seed":int:0
|
||||
1:exp:1:char*:"o/tmp/test_suite_hmac_drbg_seed":int:0
|
||||
|
||||
HMAC_DRBG write/update seed file SHA-224 [#2]
|
||||
depends_on:1
|
||||
|
@ -36,7 +36,7 @@ depends_on:1
|
|||
|
||||
HMAC_DRBG write/update seed file SHA-256 [#1]
|
||||
depends_on:1
|
||||
1:exp:2:char*:"/tmp/test_suite_hmac_drbg_seed":int:0
|
||||
1:exp:2:char*:"o/tmp/test_suite_hmac_drbg_seed":int:0
|
||||
|
||||
HMAC_DRBG write/update seed file SHA-256 [#2]
|
||||
depends_on:1
|
||||
|
@ -44,7 +44,7 @@ depends_on:1
|
|||
|
||||
HMAC_DRBG write/update seed file SHA-384 [#1]
|
||||
depends_on:2:3
|
||||
1:exp:3:char*:"/tmp/test_suite_hmac_drbg_seed":int:0
|
||||
1:exp:3:char*:"o/tmp/test_suite_hmac_drbg_seed":int:0
|
||||
|
||||
HMAC_DRBG write/update seed file SHA-384 [#2]
|
||||
depends_on:2:3
|
||||
|
@ -52,11 +52,11 @@ depends_on:2:3
|
|||
|
||||
HMAC_DRBG write/update seed file SHA-512 [#1]
|
||||
depends_on:2
|
||||
1:exp:4:char*:"/tmp/test_suite_hmac_drbg_seed":int:0
|
||||
1:exp:4:char*:"o/tmp/test_suite_hmac_drbg_seed":int:0
|
||||
|
||||
HMAC_DRBG write/update seed file SHA-512 [#2]
|
||||
depends_on:2
|
||||
1:exp:4:char*:"/tmp/test_suite_hmac_drbg_no_such_dir/file":exp:5
|
||||
1:exp:4:char*:"o/tmp/test_suite_hmac_drbg_no_such_dir/file":exp:5
|
||||
|
||||
HMAC_DRBG from buffer SHA-1
|
||||
depends_on:0
|
||||
|
|
|
@ -95,7 +95,7 @@ Test mbedtls_mpi_read_file #3 (Input too big)
|
|||
8:int:10:char*:"/zip/third_party/mbedtls/test/data/mpi_too_big":hex:"":exp:2
|
||||
|
||||
Base test mbedtls_mpi_write_file #1
|
||||
9:int:10:char*:"56125680981752282334141896320372489490613963693556392520816017892111350604111697682705498319512049040516698827829292076808006940873974979584527073481012636016353913462376755556720019831187364993587901952757307830896531678727717924":int:16:char*:"/tmp/test_suite_mpi_write"
|
||||
9:int:10:char*:"56125680981752282334141896320372489490613963693556392520816017892111350604111697682705498319512049040516698827829292076808006940873974979584527073481012636016353913462376755556720019831187364993587901952757307830896531678727717924":int:16:char*:"o/tmp/test_suite_mpi_write"
|
||||
|
||||
Base test mbedtls_mpi_lsb #1
|
||||
12:int:10:char*:"56125680981752282334141896320372489490613963693556392520816017892111350604111697682705498319512049040516698827829292076808006940873974979584527073481012636016353913462376755556720019831187364993587901952757307830896531678727717924":int:2
|
||||
|
|
|
@ -1049,7 +1049,7 @@ def temp_cwd(name='tempcwd', quiet=False):
|
|||
only a warning is raised and the original CWD is used.
|
||||
|
||||
"""
|
||||
with temp_dir(path=name, quiet=quiet) as temp_path:
|
||||
with temp_dir(quiet=quiet) as temp_path:
|
||||
with change_cwd(temp_path, quiet=quiet) as cwd_dir:
|
||||
yield cwd_dir
|
||||
|
||||
|
|
5
third_party/python/Lib/test/test_tarfile.py
vendored
5
third_party/python/Lib/test/test_tarfile.py
vendored
|
@ -2607,8 +2607,9 @@ class NumericOwnerTest(unittest.TestCase):
|
|||
# because the uname and gname in the test file are 'root', and extract()
|
||||
# will look them up using pwd and grp to find their uid and gid, which we
|
||||
# test here to be 0.
|
||||
@unittest.skipUnless(root_is_uid_gid_0(),
|
||||
'uid=0,gid=0 must be named "root"')
|
||||
# [jart] tests shouldn't read /etc/passwd lool
|
||||
# @unittest.skipUnless(root_is_uid_gid_0(),
|
||||
# 'uid=0,gid=0 must be named "root"')
|
||||
@unittest.mock.patch('os.chown')
|
||||
@unittest.mock.patch('os.chmod')
|
||||
@unittest.mock.patch('os.geteuid')
|
||||
|
|
5
third_party/python/Modules/_elementtree.c
vendored
5
third_party/python/Modules/_elementtree.c
vendored
|
@ -17,12 +17,14 @@
|
|||
#include "third_party/python/Include/object.h"
|
||||
#include "third_party/python/Include/objimpl.h"
|
||||
#include "third_party/python/Include/pycapsule.h"
|
||||
#include "third_party/python/Include/pyexpat.h"
|
||||
#include "third_party/python/Include/pyhash.h"
|
||||
#include "third_party/python/Include/pystate.h"
|
||||
#include "third_party/python/Include/sliceobject.h"
|
||||
#include "third_party/python/Include/structmember.h"
|
||||
#include "third_party/python/Include/warnings.h"
|
||||
#include "third_party/python/Include/yoink.h"
|
||||
#include "third_party/python/Modules/expat/expat.h"
|
||||
/* clang-format off */
|
||||
|
||||
PYTHON_PROVIDE("_elementtree");
|
||||
|
@ -2772,9 +2774,6 @@ _elementtree_TreeBuilder_start_impl(TreeBuilderObject *self, PyObject *tag,
|
|||
/* ==================================================================== */
|
||||
/* the expat interface */
|
||||
|
||||
#include "third_party/python/Modules/expat/expat.h"
|
||||
#include "third_party/python/Include/pyexpat.h"
|
||||
|
||||
/* The PyExpat_CAPI structure is an immutable dispatch table, so it can be
|
||||
* cached globally without being in per-module state.
|
||||
*/
|
||||
|
|
10
third_party/python/Objects/typeobject.c
vendored
10
third_party/python/Objects/typeobject.c
vendored
|
@ -33,6 +33,11 @@
|
|||
#include "third_party/python/Include/weakrefobject.h"
|
||||
/* clang-format off */
|
||||
|
||||
static const short slotoffsets[] = {
|
||||
-1, /* invalid slot */
|
||||
#include "third_party/python/Objects/typeslots.inc"
|
||||
};
|
||||
|
||||
/* Type object implementation */
|
||||
|
||||
/* Support type attribute cache */
|
||||
|
@ -2791,11 +2796,6 @@ error:
|
|||
return NULL;
|
||||
}
|
||||
|
||||
static const short slotoffsets[] = {
|
||||
-1, /* invalid slot */
|
||||
#include "typeslots.inc"
|
||||
};
|
||||
|
||||
PyObject *
|
||||
PyType_FromSpecWithBases(PyType_Spec *spec, PyObject *bases)
|
||||
{
|
||||
|
|
34
third_party/python/python.mk
vendored
34
third_party/python/python.mk
vendored
|
@ -4194,6 +4194,39 @@ $(THIRD_PARTY_PYTHON_PYTEST_A_DATA_OBJS): ZIPOBJ_FLAGS += -P.python -C3
|
|||
o/$(MODE)/third_party/python/Python/ceval.o: QUOTA = -C64 -M1024m -L300
|
||||
o/$(MODE)/third_party/python/Objects/unicodeobject.o: QUOTA += -C64 -M1024m -L300
|
||||
|
||||
o/$(MODE)/third_party/python/Objects/unicodeobject.o: \
|
||||
third_party/python/Objects/unicodeobject.c \
|
||||
third_party/python/Objects/stringlib/localeutil.inc \
|
||||
third_party/python/Objects/stringlib/unicode_format.inc \
|
||||
third_party/python/Objects/stringlib/asciilib.inc \
|
||||
third_party/python/Objects/stringlib/codecs.inc \
|
||||
third_party/python/Objects/stringlib/undef.inc \
|
||||
third_party/python/Objects/stringlib/ucs1lib.inc \
|
||||
third_party/python/Objects/stringlib/codecs.inc \
|
||||
third_party/python/Objects/stringlib/undef.inc \
|
||||
third_party/python/Objects/stringlib/ucs2lib.inc \
|
||||
third_party/python/Objects/stringlib/codecs.inc \
|
||||
third_party/python/Objects/stringlib/undef.inc \
|
||||
third_party/python/Objects/stringlib/ucs4lib.inc \
|
||||
third_party/python/Objects/stringlib/codecs.inc \
|
||||
third_party/python/Objects/stringlib/undef.inc
|
||||
|
||||
o/$(MODE)/third_party/python/Modules/_elementtree.o: \
|
||||
third_party/python/Modules/_elementtree.c \
|
||||
third_party/python/Modules/clinic/_elementtree.inc
|
||||
|
||||
o/$(MODE)/third_party/python/Modules/_io/bufferedio.o: \
|
||||
third_party/python/Modules/_io/bufferedio.c \
|
||||
third_party/python/Modules/_io/clinic/bufferedio.inc
|
||||
|
||||
o/$(MODE)/third_party/python/Modules/_io/textio.o: \
|
||||
third_party/python/Modules/_io/textio.c \
|
||||
third_party/python/Modules/_io/clinic/textio.inc
|
||||
|
||||
o/$(MODE)/third_party/python/Modules/_sre.o: \
|
||||
third_party/python/Modules/_sre.c \
|
||||
third_party/python/Modules/clinic/_sre.inc
|
||||
|
||||
o/$(MODE)/third_party/python/Parser/asdl_c.o: PYFLAGS += -m
|
||||
$(THIRD_PARTY_PYTHON_PYTEST_PYMAINS_OBJS): PYFLAGS += -t -P.python -C3
|
||||
$(THIRD_PARTY_PYTHON_PYTEST_TODOS:%.py=o/$(MODE)/%.o): PYFLAGS += -t -P.python -C3
|
||||
|
@ -4348,7 +4381,6 @@ o/$(MODE)/third_party/python/chibicc.inc: \
|
|||
libc/nexgen32e/kcpuids.h \
|
||||
libc/runtime/runtime.h \
|
||||
libc/runtime/symbolic.h \
|
||||
libc/runtime/valist.h \
|
||||
libc/stdio/stdio.h \
|
||||
libc/str/str.h \
|
||||
libc/unicode/unicode.h \
|
||||
|
|
1
third_party/sqlite3/alter.shell.c
vendored
Normal file
1
third_party/sqlite3/alter.shell.c
vendored
Normal file
|
@ -0,0 +1 @@
|
|||
#include "third_party/sqlite3/alter.c"
|
1
third_party/sqlite3/analyze.shell.c
vendored
Normal file
1
third_party/sqlite3/analyze.shell.c
vendored
Normal file
|
@ -0,0 +1 @@
|
|||
#include "third_party/sqlite3/analyze.c"
|
1
third_party/sqlite3/appendvfs.shell.c
vendored
Normal file
1
third_party/sqlite3/appendvfs.shell.c
vendored
Normal file
|
@ -0,0 +1 @@
|
|||
#include "third_party/sqlite3/appendvfs.c"
|
1
third_party/sqlite3/attach.shell.c
vendored
Normal file
1
third_party/sqlite3/attach.shell.c
vendored
Normal file
|
@ -0,0 +1 @@
|
|||
#include "third_party/sqlite3/attach.c"
|
1
third_party/sqlite3/auth.shell.c
vendored
Normal file
1
third_party/sqlite3/auth.shell.c
vendored
Normal file
|
@ -0,0 +1 @@
|
|||
#include "third_party/sqlite3/auth.c"
|
1
third_party/sqlite3/backup.shell.c
vendored
Normal file
1
third_party/sqlite3/backup.shell.c
vendored
Normal file
|
@ -0,0 +1 @@
|
|||
#include "third_party/sqlite3/backup.c"
|
1
third_party/sqlite3/bitvec.shell.c
vendored
Normal file
1
third_party/sqlite3/bitvec.shell.c
vendored
Normal file
|
@ -0,0 +1 @@
|
|||
#include "third_party/sqlite3/bitvec.c"
|
1
third_party/sqlite3/btmutex.shell.c
vendored
Normal file
1
third_party/sqlite3/btmutex.shell.c
vendored
Normal file
|
@ -0,0 +1 @@
|
|||
#include "third_party/sqlite3/btmutex.c"
|
1
third_party/sqlite3/btree.shell.c
vendored
Normal file
1
third_party/sqlite3/btree.shell.c
vendored
Normal file
|
@ -0,0 +1 @@
|
|||
#include "third_party/sqlite3/btree.c"
|
1
third_party/sqlite3/build.shell.c
vendored
Normal file
1
third_party/sqlite3/build.shell.c
vendored
Normal file
|
@ -0,0 +1 @@
|
|||
#include "third_party/sqlite3/build.c"
|
1
third_party/sqlite3/callback.shell.c
vendored
Normal file
1
third_party/sqlite3/callback.shell.c
vendored
Normal file
|
@ -0,0 +1 @@
|
|||
#include "third_party/sqlite3/callback.c"
|
1
third_party/sqlite3/complete.shell.c
vendored
Normal file
1
third_party/sqlite3/complete.shell.c
vendored
Normal file
|
@ -0,0 +1 @@
|
|||
#include "third_party/sqlite3/complete.c"
|
1
third_party/sqlite3/completion.shell.c
vendored
Normal file
1
third_party/sqlite3/completion.shell.c
vendored
Normal file
|
@ -0,0 +1 @@
|
|||
#include "third_party/sqlite3/completion.c"
|
1
third_party/sqlite3/ctime.shell.c
vendored
Normal file
1
third_party/sqlite3/ctime.shell.c
vendored
Normal file
|
@ -0,0 +1 @@
|
|||
#include "third_party/sqlite3/ctime.c"
|
1
third_party/sqlite3/date.shell.c
vendored
Normal file
1
third_party/sqlite3/date.shell.c
vendored
Normal file
|
@ -0,0 +1 @@
|
|||
#include "third_party/sqlite3/date.c"
|
1
third_party/sqlite3/dbdata.shell.c
vendored
Normal file
1
third_party/sqlite3/dbdata.shell.c
vendored
Normal file
|
@ -0,0 +1 @@
|
|||
#include "third_party/sqlite3/dbdata.c"
|
1
third_party/sqlite3/dbpage.shell.c
vendored
Normal file
1
third_party/sqlite3/dbpage.shell.c
vendored
Normal file
|
@ -0,0 +1 @@
|
|||
#include "third_party/sqlite3/dbpage.c"
|
1
third_party/sqlite3/dbstat.shell.c
vendored
Normal file
1
third_party/sqlite3/dbstat.shell.c
vendored
Normal file
|
@ -0,0 +1 @@
|
|||
#include "third_party/sqlite3/dbstat.c"
|
1
third_party/sqlite3/decimal.shell.c
vendored
Normal file
1
third_party/sqlite3/decimal.shell.c
vendored
Normal file
|
@ -0,0 +1 @@
|
|||
#include "third_party/sqlite3/decimal.c"
|
1
third_party/sqlite3/delete.shell.c
vendored
Normal file
1
third_party/sqlite3/delete.shell.c
vendored
Normal file
|
@ -0,0 +1 @@
|
|||
#include "third_party/sqlite3/delete.c"
|
120
third_party/sqlite3/dog.py
vendored
Normal file
120
third_party/sqlite3/dog.py
vendored
Normal file
|
@ -0,0 +1,120 @@
|
|||
sauce = '''
|
||||
alter
|
||||
analyze
|
||||
appendvfs
|
||||
attach
|
||||
auth
|
||||
backup
|
||||
bitvec
|
||||
btmutex
|
||||
btree
|
||||
build
|
||||
callback
|
||||
complete
|
||||
completion
|
||||
ctime
|
||||
date
|
||||
dbdata
|
||||
dbpage
|
||||
dbstat
|
||||
decimal
|
||||
delete
|
||||
expr
|
||||
fault
|
||||
fileio
|
||||
fkey
|
||||
fts3
|
||||
fts3_aux
|
||||
fts3_expr
|
||||
fts3_hash
|
||||
fts3_icu
|
||||
fts3_porter
|
||||
fts3_snippet
|
||||
fts3_tokenize_vtab
|
||||
fts3_tokenizer
|
||||
fts3_tokenizer1
|
||||
fts3_unicode
|
||||
fts3_unicode2
|
||||
fts3_write
|
||||
fts5
|
||||
func
|
||||
global
|
||||
hash
|
||||
icu
|
||||
ieee754
|
||||
insert
|
||||
json1
|
||||
legacy
|
||||
loadext
|
||||
main
|
||||
malloc
|
||||
mem0
|
||||
mem1
|
||||
mem2
|
||||
mem3
|
||||
mem5
|
||||
memdb
|
||||
memjournal
|
||||
memtrace
|
||||
mutex
|
||||
mutex_noop
|
||||
mutex_unix
|
||||
notify
|
||||
opcodes
|
||||
os
|
||||
os_unix
|
||||
os_win
|
||||
pager
|
||||
parse
|
||||
pcache
|
||||
pcache1
|
||||
pragma
|
||||
prepare
|
||||
printf
|
||||
random
|
||||
resolve
|
||||
rowset
|
||||
rtree
|
||||
select
|
||||
series
|
||||
shathree
|
||||
shell
|
||||
sqlar
|
||||
sqlite3expert
|
||||
sqlite3rbu
|
||||
sqlite3session
|
||||
status
|
||||
stmt
|
||||
table
|
||||
threads
|
||||
tokenize
|
||||
treeview
|
||||
trigger
|
||||
uint
|
||||
update
|
||||
upsert
|
||||
userauth
|
||||
utf
|
||||
util
|
||||
vacuum
|
||||
vdbe
|
||||
vdbeapi
|
||||
vdbeaux
|
||||
vdbeblob
|
||||
vdbemem
|
||||
vdbesort
|
||||
vdbetrace
|
||||
vdbevtab
|
||||
vtab
|
||||
wal
|
||||
walker
|
||||
where
|
||||
wherecode
|
||||
whereexpr
|
||||
window
|
||||
zipfile
|
||||
'''.split()
|
||||
|
||||
for s in sauce:
|
||||
with open('third_party/sqlite3/%s.shell.c' % (s), 'w') as f:
|
||||
f.write('#include "third_party/sqlite3/%s.c"\n' % (s))
|
1
third_party/sqlite3/expr.shell.c
vendored
Normal file
1
third_party/sqlite3/expr.shell.c
vendored
Normal file
|
@ -0,0 +1 @@
|
|||
#include "third_party/sqlite3/expr.c"
|
1
third_party/sqlite3/fault.shell.c
vendored
Normal file
1
third_party/sqlite3/fault.shell.c
vendored
Normal file
|
@ -0,0 +1 @@
|
|||
#include "third_party/sqlite3/fault.c"
|
30
third_party/sqlite3/fileio.c
vendored
30
third_party/sqlite3/fileio.c
vendored
|
@ -1,3 +1,18 @@
|
|||
#include "libc/assert.h"
|
||||
#include "libc/calls/calls.h"
|
||||
#include "libc/calls/struct/dirent.h"
|
||||
#include "libc/calls/struct/stat.h"
|
||||
#include "libc/calls/struct/stat.macros.h"
|
||||
#include "libc/calls/weirdtypes.h"
|
||||
#include "libc/errno.h"
|
||||
#include "libc/stdio/stdio.h"
|
||||
#include "libc/str/str.h"
|
||||
#include "libc/sysv/consts/at.h"
|
||||
#include "libc/sysv/consts/s.h"
|
||||
#include "libc/time/time.h"
|
||||
#include "third_party/sqlite3/sqlite3ext.h"
|
||||
// clang-format off
|
||||
|
||||
/*
|
||||
** 2014-06-13
|
||||
**
|
||||
|
@ -73,21 +88,6 @@
|
|||
** And the paths returned in the "name" column of the table are also
|
||||
** relative to directory $dir.
|
||||
*/
|
||||
#include "libc/assert.h"
|
||||
#include "libc/calls/calls.h"
|
||||
#include "libc/calls/struct/dirent.h"
|
||||
#include "libc/calls/struct/stat.h"
|
||||
#include "libc/calls/struct/stat.macros.h"
|
||||
#include "libc/calls/weirdtypes.h"
|
||||
#include "libc/errno.h"
|
||||
#include "libc/isystem/unistd.h"
|
||||
#include "libc/stdio/stdio.h"
|
||||
#include "libc/str/str.h"
|
||||
#include "libc/sysv/consts/at.h"
|
||||
#include "libc/sysv/consts/s.h"
|
||||
#include "libc/time/time.h"
|
||||
#include "third_party/sqlite3/sqlite3ext.h"
|
||||
// clang-format off
|
||||
|
||||
SQLITE_EXTENSION_INIT1
|
||||
|
||||
|
|
1
third_party/sqlite3/fileio.shell.c
vendored
Normal file
1
third_party/sqlite3/fileio.shell.c
vendored
Normal file
|
@ -0,0 +1 @@
|
|||
#include "third_party/sqlite3/fileio.c"
|
1
third_party/sqlite3/fkey.shell.c
vendored
Normal file
1
third_party/sqlite3/fkey.shell.c
vendored
Normal file
|
@ -0,0 +1 @@
|
|||
#include "third_party/sqlite3/fkey.c"
|
1
third_party/sqlite3/fts3.shell.c
vendored
Normal file
1
third_party/sqlite3/fts3.shell.c
vendored
Normal file
|
@ -0,0 +1 @@
|
|||
#include "third_party/sqlite3/fts3.c"
|
1
third_party/sqlite3/fts3_aux.shell.c
vendored
Normal file
1
third_party/sqlite3/fts3_aux.shell.c
vendored
Normal file
|
@ -0,0 +1 @@
|
|||
#include "third_party/sqlite3/fts3_aux.c"
|
1
third_party/sqlite3/fts3_expr.shell.c
vendored
Normal file
1
third_party/sqlite3/fts3_expr.shell.c
vendored
Normal file
|
@ -0,0 +1 @@
|
|||
#include "third_party/sqlite3/fts3_expr.c"
|
1
third_party/sqlite3/fts3_hash.shell.c
vendored
Normal file
1
third_party/sqlite3/fts3_hash.shell.c
vendored
Normal file
|
@ -0,0 +1 @@
|
|||
#include "third_party/sqlite3/fts3_hash.c"
|
1
third_party/sqlite3/fts3_icu.shell.c
vendored
Normal file
1
third_party/sqlite3/fts3_icu.shell.c
vendored
Normal file
|
@ -0,0 +1 @@
|
|||
#include "third_party/sqlite3/fts3_icu.c"
|
1
third_party/sqlite3/fts3_porter.shell.c
vendored
Normal file
1
third_party/sqlite3/fts3_porter.shell.c
vendored
Normal file
|
@ -0,0 +1 @@
|
|||
#include "third_party/sqlite3/fts3_porter.c"
|
1
third_party/sqlite3/fts3_snippet.shell.c
vendored
Normal file
1
third_party/sqlite3/fts3_snippet.shell.c
vendored
Normal file
|
@ -0,0 +1 @@
|
|||
#include "third_party/sqlite3/fts3_snippet.c"
|
1
third_party/sqlite3/fts3_tokenize_vtab.shell.c
vendored
Normal file
1
third_party/sqlite3/fts3_tokenize_vtab.shell.c
vendored
Normal file
|
@ -0,0 +1 @@
|
|||
#include "third_party/sqlite3/fts3_tokenize_vtab.c"
|
1
third_party/sqlite3/fts3_tokenizer.shell.c
vendored
Normal file
1
third_party/sqlite3/fts3_tokenizer.shell.c
vendored
Normal file
|
@ -0,0 +1 @@
|
|||
#include "third_party/sqlite3/fts3_tokenizer.c"
|
1
third_party/sqlite3/fts3_tokenizer1.shell.c
vendored
Normal file
1
third_party/sqlite3/fts3_tokenizer1.shell.c
vendored
Normal file
|
@ -0,0 +1 @@
|
|||
#include "third_party/sqlite3/fts3_tokenizer1.c"
|
1
third_party/sqlite3/fts3_unicode.shell.c
vendored
Normal file
1
third_party/sqlite3/fts3_unicode.shell.c
vendored
Normal file
|
@ -0,0 +1 @@
|
|||
#include "third_party/sqlite3/fts3_unicode.c"
|
1
third_party/sqlite3/fts3_unicode2.shell.c
vendored
Normal file
1
third_party/sqlite3/fts3_unicode2.shell.c
vendored
Normal file
|
@ -0,0 +1 @@
|
|||
#include "third_party/sqlite3/fts3_unicode2.c"
|
1
third_party/sqlite3/fts3_write.shell.c
vendored
Normal file
1
third_party/sqlite3/fts3_write.shell.c
vendored
Normal file
|
@ -0,0 +1 @@
|
|||
#include "third_party/sqlite3/fts3_write.c"
|
21
third_party/sqlite3/fts5.c
vendored
21
third_party/sqlite3/fts5.c
vendored
|
@ -1,3 +1,10 @@
|
|||
#include "libc/assert.h"
|
||||
#include "libc/assert.h"
|
||||
#include "libc/math.h"
|
||||
#include "libc/stdio/stdio.h"
|
||||
#include "libc/str/str.h"
|
||||
#include "third_party/sqlite3/sqlite3.h"
|
||||
#include "third_party/sqlite3/sqlite3ext.h"
|
||||
|
||||
/* clang-format off */
|
||||
|
||||
|
@ -34,8 +41,6 @@
|
|||
#ifndef _FTS5_H
|
||||
#define _FTS5_H
|
||||
|
||||
#include "third_party/sqlite3/sqlite3.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
@ -604,12 +609,8 @@ struct fts5_api {
|
|||
#ifndef _FTS5INT_H
|
||||
#define _FTS5INT_H
|
||||
|
||||
/* #include "third_party/sqlite3/fts5.h" */
|
||||
#include "third_party/sqlite3/sqlite3ext.h"
|
||||
SQLITE_EXTENSION_INIT1
|
||||
|
||||
#include "libc/assert.h"
|
||||
#include "libc/str/str.h"
|
||||
|
||||
#ifndef SQLITE_AMALGAMATION
|
||||
|
||||
|
@ -1478,9 +1479,6 @@ static void sqlite3Fts5UnicodeAscii(u8*, u8*);
|
|||
/************ Begin %include sections from the grammar ************************/
|
||||
#line 47 "fts5parse.y"
|
||||
|
||||
/* #include "third_party/sqlite3/fts5Int.h" */
|
||||
/* #include "third_party/sqlite3/fts5parse.h" */
|
||||
|
||||
/*
|
||||
** Disable all error recovery processing in the parser push-down
|
||||
** automaton.
|
||||
|
@ -1807,8 +1805,6 @@ struct fts5yyParser {
|
|||
typedef struct fts5yyParser fts5yyParser;
|
||||
|
||||
#ifndef NDEBUG
|
||||
#include "libc/assert.h"
|
||||
#include "libc/stdio/stdio.h"
|
||||
static FILE *fts5yyTraceFILE = 0;
|
||||
static char *fts5yyTracePrompt = 0;
|
||||
#endif /* NDEBUG */
|
||||
|
@ -3013,9 +3009,6 @@ static int sqlite3Fts5ParserFallback(int iToken){
|
|||
******************************************************************************
|
||||
*/
|
||||
|
||||
/* #include "third_party/sqlite3/fts5Int.h" */
|
||||
#include "libc/math.h" /* amalgamator: keep */
|
||||
|
||||
/*
|
||||
** Object used to iterate through all "coalesced phrase instances" in
|
||||
** a single column of the current row. If the phrase instances in the
|
||||
|
|
1
third_party/sqlite3/fts5.shell.c
vendored
Normal file
1
third_party/sqlite3/fts5.shell.c
vendored
Normal file
|
@ -0,0 +1 @@
|
|||
#include "third_party/sqlite3/fts5.c"
|
1
third_party/sqlite3/func.shell.c
vendored
Normal file
1
third_party/sqlite3/func.shell.c
vendored
Normal file
|
@ -0,0 +1 @@
|
|||
#include "third_party/sqlite3/func.c"
|
1
third_party/sqlite3/global.shell.c
vendored
Normal file
1
third_party/sqlite3/global.shell.c
vendored
Normal file
|
@ -0,0 +1 @@
|
|||
#include "third_party/sqlite3/global.c"
|
1
third_party/sqlite3/hash.shell.c
vendored
Normal file
1
third_party/sqlite3/hash.shell.c
vendored
Normal file
|
@ -0,0 +1 @@
|
|||
#include "third_party/sqlite3/hash.c"
|
1
third_party/sqlite3/icu.shell.c
vendored
Normal file
1
third_party/sqlite3/icu.shell.c
vendored
Normal file
|
@ -0,0 +1 @@
|
|||
#include "third_party/sqlite3/icu.c"
|
1
third_party/sqlite3/ieee754.shell.c
vendored
Normal file
1
third_party/sqlite3/ieee754.shell.c
vendored
Normal file
|
@ -0,0 +1 @@
|
|||
#include "third_party/sqlite3/ieee754.c"
|
1
third_party/sqlite3/insert.shell.c
vendored
Normal file
1
third_party/sqlite3/insert.shell.c
vendored
Normal file
|
@ -0,0 +1 @@
|
|||
#include "third_party/sqlite3/insert.c"
|
1
third_party/sqlite3/json1.shell.c
vendored
Normal file
1
third_party/sqlite3/json1.shell.c
vendored
Normal file
|
@ -0,0 +1 @@
|
|||
#include "third_party/sqlite3/json1.c"
|
1
third_party/sqlite3/legacy.shell.c
vendored
Normal file
1
third_party/sqlite3/legacy.shell.c
vendored
Normal file
|
@ -0,0 +1 @@
|
|||
#include "third_party/sqlite3/legacy.c"
|
1
third_party/sqlite3/loadext.shell.c
vendored
Normal file
1
third_party/sqlite3/loadext.shell.c
vendored
Normal file
|
@ -0,0 +1 @@
|
|||
#include "third_party/sqlite3/loadext.c"
|
1
third_party/sqlite3/main.shell.c
vendored
Normal file
1
third_party/sqlite3/main.shell.c
vendored
Normal file
|
@ -0,0 +1 @@
|
|||
#include "third_party/sqlite3/main.c"
|
1
third_party/sqlite3/malloc.shell.c
vendored
Normal file
1
third_party/sqlite3/malloc.shell.c
vendored
Normal file
|
@ -0,0 +1 @@
|
|||
#include "third_party/sqlite3/malloc.c"
|
1
third_party/sqlite3/mem0.shell.c
vendored
Normal file
1
third_party/sqlite3/mem0.shell.c
vendored
Normal file
|
@ -0,0 +1 @@
|
|||
#include "third_party/sqlite3/mem0.c"
|
1
third_party/sqlite3/mem1.shell.c
vendored
Normal file
1
third_party/sqlite3/mem1.shell.c
vendored
Normal file
|
@ -0,0 +1 @@
|
|||
#include "third_party/sqlite3/mem1.c"
|
1
third_party/sqlite3/mem2.shell.c
vendored
Normal file
1
third_party/sqlite3/mem2.shell.c
vendored
Normal file
|
@ -0,0 +1 @@
|
|||
#include "third_party/sqlite3/mem2.c"
|
1
third_party/sqlite3/mem3.shell.c
vendored
Normal file
1
third_party/sqlite3/mem3.shell.c
vendored
Normal file
|
@ -0,0 +1 @@
|
|||
#include "third_party/sqlite3/mem3.c"
|
1
third_party/sqlite3/mem5.shell.c
vendored
Normal file
1
third_party/sqlite3/mem5.shell.c
vendored
Normal file
|
@ -0,0 +1 @@
|
|||
#include "third_party/sqlite3/mem5.c"
|
1
third_party/sqlite3/memdb.shell.c
vendored
Normal file
1
third_party/sqlite3/memdb.shell.c
vendored
Normal file
|
@ -0,0 +1 @@
|
|||
#include "third_party/sqlite3/memdb.c"
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue