mirror of
https://github.com/deepseek-ai/deepseek-harness
synced 2026-08-15 21:04:50 +00:00
fix(landlock-run): enforce probe CLI contract
This commit is contained in:
@@ -155,6 +155,9 @@ static int parse(int argc, char **argv, struct cli *cli) {
|
||||
while (index < argc) {
|
||||
const char *arg = argv[index];
|
||||
if (strcmp(arg, "--probe") == 0) {
|
||||
if (argc != 2) {
|
||||
return fail_usage("--probe takes no other arguments", NULL);
|
||||
}
|
||||
cli->probe = 1;
|
||||
index += 1;
|
||||
} else if (strcmp(arg, "--ro") == 0 || strcmp(arg, "--rw") == 0) {
|
||||
@@ -174,11 +177,7 @@ static int parse(int argc, char **argv, struct cli *cli) {
|
||||
return fail_usage("unknown argument: ", arg);
|
||||
}
|
||||
}
|
||||
if (cli->probe) {
|
||||
if (cli->ro_count > 0 || cli->rw_count > 0 || (cli->command != NULL && cli->command[0] != NULL)) {
|
||||
return fail_usage("--probe takes no other arguments", NULL);
|
||||
}
|
||||
} else if (cli->command == NULL || cli->command[0] == NULL) {
|
||||
if (!cli->probe && (cli->command == NULL || cli->command[0] == NULL)) {
|
||||
return fail_usage("missing `-- <argv>...` command", NULL);
|
||||
}
|
||||
return 0;
|
||||
|
||||
@@ -53,9 +53,15 @@ const run = (args, options = {}) => spawnSync(launcher, args, { encoding: 'utf8'
|
||||
assert.equal(danglingPath.status, LAUNCHER_FAILURE_EXIT);
|
||||
assert.match(danglingPath.stderr, /--ro requires a path/);
|
||||
|
||||
const probeWithExtras = run(['--probe', '--ro', '/']);
|
||||
assert.equal(probeWithExtras.status, LAUNCHER_FAILURE_EXIT);
|
||||
assert.match(probeWithExtras.stderr, /--probe takes no other arguments/);
|
||||
for (const args of [
|
||||
['--probe', '--ro', '/'],
|
||||
['--probe', '--'],
|
||||
['--probe', '--probe'],
|
||||
]) {
|
||||
const probeWithExtras = run(args);
|
||||
assert.equal(probeWithExtras.status, LAUNCHER_FAILURE_EXIT);
|
||||
assert.match(probeWithExtras.stderr, /--probe takes no other arguments/);
|
||||
}
|
||||
}
|
||||
|
||||
// --- probe: the functional availability signal ---
|
||||
|
||||
Reference in New Issue
Block a user