Fix GitHub actions

Our build was flaking due to ETXTBSY errors running multiple redbean
instances in parallel. This is due to the StoreAsset() support which
seems to cause enough problems it's worth making a *breaking change*
turning it off by default for now. There's a new -* flag, to restore
redbean's old self-modifying behavior.
This commit is contained in:
Justine Tunney 2022-07-09 01:18:55 -07:00
parent 1c83670229
commit 182d7720cf
3 changed files with 39 additions and 7 deletions

View file

@ -13,6 +13,9 @@
-- TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
-- PERFORMANCE OF THIS SOFTWARE.
assert(string.match("127.123.231.1", "%d+.%d+.%d+.%d+"))
assert(re.search([[^\d{1,3}(\.\d{1,3}){3}$]], "127.123.231.1"))
m,a,b,c,d = assert(re.search([[^([0-9]{1,3})\.([0-9]{1,3})\.([0-9]{1,3})\.([0-9]{1,3})$]], "127.0.0.1"))
assert(m == "127.0.0.1")
assert(a == "127")
@ -38,3 +41,26 @@ assert(d == "1")
p,e = re.compile("[{")
assert(e:errno() == re.EBRACK)
assert(e:doc() == "Missing ']'")
----------------------------------------------------------------------------------------------------
-- BENCHMARKS
function ReCompileSearch()
assert(re.search([[^\d{1,3}(\.\d{1,3}){3}$]], "127.123.231.1"))
end
preg = assert(re.compile[[^\d{1,3}(\.\d{1,3}){3}$]])
function ReSearch()
assert(preg:search("127.123.231.1"))
end
function Match()
assert(string.match("127.123.231.1", "%d+.%d+.%d+.%d+"))
end
-- 6120 re.search()
-- 425 re.Regex:search()
-- 196 string.match()
print("--", Benchmark(ReCompileSearch), "re.search()")
print("--", Benchmark(ReSearch), "re.Regex:search()")
print("--", Benchmark(Match), "string.match()")

View file

@ -55,6 +55,7 @@ FLAGS
-f log worker function calls
-B only use stronger cryptography
-X disable ssl server and client support
-* permit self-modification of executable
-J disable non-ssl server and client support
-% hasten startup by not generating an rsa key
-s increase silence [repeatable]
@ -996,10 +997,11 @@ FUNCTIONS
then consider using ServeAsset which can serve directly off disk.
StoreAsset(path:str,data:str[,mode:int])
Stores asset to executable's ZIP central directory. This currently
happens in an append-only fashion and is still largely in the
proof-of-concept stages. Currently only supported on Linux, XNU,
and FreeBSD.
Stores asset to executable's ZIP central directory. This
currently happens in an append-only fashion and is still
largely in the proof-of-concept stages. Currently only
supported on Linux, XNU, and FreeBSD. In order to use this
feature, the -* flag must be passed.
Log(level:int,message:str)
Emits message string to log, if level is less than or equal to

View file

@ -186,8 +186,8 @@ STATIC_YOINK("ShowCrashReportsEarly");
// letters not used: EINOQYnoqwxy
// digits not used: 0123456789
// puncts not used: !"#$&'()*+,-./;<=>@[\]^_`{|}~
#define GETOPTS "%BJSVXZabdfghijkmsuvzA:C:D:F:G:H:K:L:M:P:R:T:U:W:c:e:l:p:r:t:"
// puncts not used: !"#$&'()+,-./;<=>@[\]^_`{|}~
#define GETOPTS "*%BJSVXZabdfghijkmsuvzA:C:D:F:G:H:K:L:M:P:R:T:U:W:c:e:l:p:r:t:"
static const uint8_t kGzipHeader[] = {
0x1F, // MAGNUM
@ -376,6 +376,7 @@ static bool checkedmethod;
static bool sslinitialized;
static bool sslfetchverify;
static bool hascontenttype;
static bool selfmodifiable;
static bool gotcachecontrol;
static bool interpretermode;
static bool sslclientverify;
@ -7224,6 +7225,7 @@ static void GetOpts(int argc, char *argv[]) {
CASE('u', uniprocess = true);
CASE('g', loglatency = true);
CASE('m', logmessages = true);
CASE('*', selfmodifiable = true);
CASE('l', ProgramAddr(optarg));
CASE('H', ProgramHeader(optarg));
CASE('L', ProgramLogPath(optarg));
@ -7290,10 +7292,12 @@ void RedBean(int argc, char *argv[]) {
CHECK_NE(-1, (zfd = open(zpath, O_RDONLY)));
CHECK_NE(-1, fstat(zfd, &zst));
OpenZip(true);
MakeExecutableModifiable();
SetDefaults();
LuaStart();
GetOpts(argc, argv);
if (selfmodifiable) {
MakeExecutableModifiable();
}
LuaInit();
oldloglevel = __log_level;
if (uniprocess) {