diff --git a/src/lib/arith.ml b/src/lib/arith.ml index 6e6d06b..7942f14 100644 --- a/src/lib/arith.ml +++ b/src/lib/arith.ml @@ -25,10 +25,16 @@ type expr = module Make (S : Types.State) = struct let eval initial_state expr = + let exception Abort of int in let lookup state s = + let s = + match String.get s 0 with + | '$' -> String.sub s 1 (String.length s - 1) + | (exception _) | _ -> s + in match S.lookup state ~param:s with | Some n when Option.is_some (int_of_string_opt n) -> int_of_string n - | _ -> 0 + | _ -> raise (Abort 0) in let update state s i = match S.update state ~param:s (string_of_int i) with @@ -54,5 +60,5 @@ module Make (S : Types.State) = struct let state, v1 = calc state e1 in if Int.equal v1 Int.zero then calc state e3 else calc state e2 in - calc initial_state expr + try calc initial_state expr with Abort n -> (initial_state, n) end diff --git a/src/lib/eval.ml b/src/lib/eval.ml index 2b7b4b6..c71299e 100644 --- a/src/lib/eval.ml +++ b/src/lib/eval.ml @@ -145,7 +145,7 @@ module Make (S : Types.State) (E : Types.Exec) = struct let expr = word_cst_to_string word in let aexpr = Arith_parser.main Arith_lexer.read (Lexing.from_string expr) in let state, i = A.eval ctx.state aexpr in - ({ ctx with state }, Ast.Fragment.make (string_of_int i)) + ({ ctx with state }, i) (* The minimal amount of context needed between pipeline stages. *) type pipeline_ctx = { @@ -1081,7 +1081,7 @@ module Make (S : Types.State) (E : Types.Exec) = struct (Exit.zero ctx, [ [ Fragment.make ~join:`Yes s ] ]) | Ast.WordArithmeticExpression cst -> arithmetic_expansion ctx cst |> fun (ctx, v) -> - (Exit.zero ctx, [ [ v ] ]) + (Exit.zero ctx, [ [ Fragment.make @@ string_of_int v ] ]) | Ast.WordName s -> (Exit.zero ctx, [ [ Fragment.make s ] ]) | Ast.WordLiteral s -> let v = Fragment.make s in diff --git a/src/lib/posix/exec.ml b/src/lib/posix/exec.ml index c5f1ef2..445fe92 100644 --- a/src/lib/posix/exec.ml +++ b/src/lib/posix/exec.ml @@ -100,7 +100,6 @@ module Process = struct Fiber.fork_daemon ~sw (fun () -> Merry.Import.Trace.name "reap-daemon"; Option.iter Eio.Promise.await delay_reap; - Merry.Debug.Log.info (fun f -> f "Delay reap past: %i" t.pid); reap t set_exit_status; Switch.remove_hook hook; `Stop_daemon)) diff --git a/test/docker/Dockerfile.debootstrap b/test/docker/Dockerfile.debootstrap index 11d1534..6670d43 100644 --- a/test/docker/Dockerfile.debootstrap +++ b/test/docker/Dockerfile.debootstrap @@ -1,4 +1,4 @@ -FROM ocaml/opam:debian-13-ocaml-5.3@sha256:3f0e61f92c78a39cd5161d75975809d44fc12fa7e6ae0fbced236aa1a2ae45e9 AS builder +FROM ocaml/opam:debian-13-ocaml-5.4@sha256:a43344fd8178438c12ce3c78124f966ac44fb015c7cc4ba685f980f9a0460091 AS builder WORKDIR /home/opam/src