Fix stable sing-box variant detection
This commit is contained in:
@@ -292,6 +292,17 @@ function sing_box_supports_tailscale(version, version_output) {
|
||||
return output_has_build_tag(sing_box_version_output(), "with_tailscale");
|
||||
}
|
||||
|
||||
function module_command(args) {
|
||||
let command_args = [ "ucode", "-L", LIB_DIR ];
|
||||
for (let arg in args)
|
||||
push(command_args, arg);
|
||||
return command_from_args(command_args);
|
||||
}
|
||||
|
||||
function module_success(args) {
|
||||
return command_status(module_command(args)) == 0;
|
||||
}
|
||||
|
||||
function sing_box_package_installed(name) {
|
||||
return module_success([ LIB_DIR + "/core/packages.uc", "installed", as_string(name) ]);
|
||||
}
|
||||
@@ -332,17 +343,6 @@ function log_message(message, level) {
|
||||
command_success_from_args([ "logger", "-t", "forkop", "[" + level + "] " + as_string(message) ]);
|
||||
}
|
||||
|
||||
function module_command(args) {
|
||||
let command_args = [ "ucode", "-L", LIB_DIR ];
|
||||
for (let arg in args)
|
||||
push(command_args, arg);
|
||||
return command_from_args(command_args);
|
||||
}
|
||||
|
||||
function module_success(args) {
|
||||
return command_status(module_command(args)) == 0;
|
||||
}
|
||||
|
||||
function module_env_capture(env, args) {
|
||||
let output_path = temp_path();
|
||||
if (output_path == "")
|
||||
|
||||
@@ -76,6 +76,24 @@ END {
|
||||
fail "reload-state cleanup must not delete subscription section-cache"
|
||||
fi
|
||||
|
||||
mkdir -p "$WORK_DIR/bin"
|
||||
cat >"$WORK_DIR/bin/sing-box" <<'EOF_SING_BOX'
|
||||
#!/bin/sh
|
||||
echo 'sing-box version 1.12.25'
|
||||
EOF_SING_BOX
|
||||
chmod +x "$WORK_DIR/bin/sing-box"
|
||||
stable_variant="$({
|
||||
PATH="$WORK_DIR/bin:$PATH" \
|
||||
FORKOP_LIB="$FORKOP_LIB" \
|
||||
SB_VARIANT_STATE_FILE="$WORK_DIR/sing-box-variant" \
|
||||
ucode -L "$FORKOP_LIB" "$SINGBOX_RUNTIME_UC" variant
|
||||
} 2>"$WORK_DIR/stable-variant.stderr")" ||
|
||||
fail "singbox/runtime.uc must detect a stable binary without a ucode call-order failure"
|
||||
[ "$stable_variant" = "stable" ] ||
|
||||
fail "singbox/runtime.uc should classify a regular sing-box binary as stable"
|
||||
[ ! -s "$WORK_DIR/stable-variant.stderr" ] ||
|
||||
fail "stable sing-box variant detection must not emit ucode runtime errors"
|
||||
|
||||
mkdir -p "$WORK_DIR/etc" "$WORK_DIR/tmp"
|
||||
printf 'old config\n' >"$WORK_DIR/etc/config.json"
|
||||
printf 'new config\n' >"$WORK_DIR/tmp/config.json"
|
||||
|
||||
Reference in New Issue
Block a user