mirror of
https://github.com/norandom/OpenUltraSAST.git
synced 2026-12-04 02:38:18 +00:00
fix(push): the background child is started with -P, as the wrapper is (item 5b)
The maintainer's answer of 2026-11-27 to question 3 of the ninth session's menu, "Add -P there too", as offered: one line, a test first, a reviewer. src/openultrasast/push/background.py starts the detached replay of `ousast pre-push --engine background` with the interpreter, -m and openultrasast.cli, from the pushed repository. With -m alone the working directory is first on the interpreter's path, so a file of the pushed repository could stand in for a module the CLI imports. The wrapper's native path had the same fault and was fixed with -P in a6e8e26; the reviewer of that commit found this one and it was left alone. The child is now started with -P, which keeps that directory off the path. The flag needs Python 3.11, the project's floor (pyproject.toml). Measured by the new test, with a real child process: tests/test_push_background.py puts a json.py that exits into the pushed repository and starts the child. On a git archive of HEAD the child's log is "SHADOW-EXECUTED" and its artifact is never written (s10_c3_red2.out). With the change the artifact is written and the log does not hold that line, on this host's default PATH, where Joern is not found (the child ends in about 1 s), and with Joern 4.0.625 and its JavaScript frontend on PATH, where the child uses its whole deadline (s10_c3_green2.out, s10_c3_green3.out). The five push test files give 106 passed. ruff, mypy, the three gates and compileall pass, and the gates print what they printed before (s10_c3b_exits.txt). `git diff --check` exits 0. No whole-suite run: that is step 9. An independent reviewer blocked the first round on the test: its wait equalled the child's deadline, so it was red on a host where the engine can build a JavaScript graph (1 failed, 4 passed). The child's deadline is now 5 s. The second round approved the final diff. Found and not fixed, for the maintainer: - The container path has the fault too, by one probe. docker-compose.yml:37 sets the working directory to /work, and the wrapper's own comment (ops/shell/ousast.sh:13-16 and :34-35) says the container runs in the caller's directory. On the local openultrasast:dev image 3f959b31f2f2, network none, a tree that holds such a json.py mounted at /work: the image's own entrypoint (Dockerfile:46, python -m openultrasast.cli) prints SHADOW-EXECUTED for --help and exits 1; the same tree with -P prints the usage (s10_c3_container_probe.out). The wrapper and compose were not run, and the published image was not probed. - ops/ax/smoke-run.sh:9 and :12, ops/ax/up.sh:14 and ops/ax/probe-placement.sh:16 run this checkout's code with -m and without -P, in the caller's directory (by reading): the CLI at smoke-run.sh:12, openultrasast.plane.profile at the other three. - src/openultrasast/plane/runner.py:678 starts a task's module with -m from the task's first workspace (by reading). Whether a file of that workspace can stand in for a module the task imports was not measured. - The two launches in src/openultrasast/search/demo.py use -I, which keeps the directory off the path.
This commit is contained in:
@@ -67,8 +67,11 @@ def start(
|
||||
return {"status": "busy", "head": str(running.get("head", "")), "directory": str(directory)}
|
||||
target = directory / f"{head}.json"
|
||||
log = directory / f"{head}.log"
|
||||
# -P keeps the repository off the interpreter's path: -m alone puts the working directory first, so
|
||||
# a file of the pushed repository could stand in for a module the CLI imports.
|
||||
command = [
|
||||
sys.executable,
|
||||
"-P",
|
||||
"-m",
|
||||
"openultrasast.cli",
|
||||
"pre-push",
|
||||
|
||||
Reference in New Issue
Block a user