Repository navigation
fix(apktool): resolve Windows PATH launchers before invocation - #2802
Conversation
Resolve the default launcher through the selected PATH/PATHEXT before choosing native process creation or the existing conservative cmd.exe wrapper. Reuse the resulting selection and one canonical environment for the version probe and decode. Follow-up to the release #1693 review of #1777. Source inspected and formatted; tests, builds, check reruns and real Windows Apktool execution were skipped at maintainer request.
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: d0ea32d3a3
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
Source inspection and targeted formatting only. Tests, builds, lint, typechecks and provider workloads were not run at the user's explicit request.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 3e58af6cec
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| if (metadata.isFile()) | ||
| return { command: candidate, commandSource: "path" }; |
There was a problem hiding this comment.
Skip PATHEXT entries the launcher cannot execute
When a Windows PATHEXT includes another script type such as .PS1 ahead of .BAT, and both files exist in the same PATH directory, this returns the .PS1 candidate. apktoolInvocation only routes .bat/.cmd through an interpreter; every other suffix reaches execFileOutput directly, while execFile() spawns directly without a shell. The probe therefore fails on the first unsupported script instead of continuing to the runnable batch launcher; restrict selection to supported native/batch suffixes or explicitly model the other interpreter types.
AGENTS.md reference: AGENTS.md:L29-L29
Useful? React with 👍 / 👎.
Retain lookup phase through AnalysisErrorOptions diagnostics while preserving the operation and timeout identity. Source inspection and targeted formatting only; tests, checks, builds and provider workloads were skipped at the user request.
|
Review findings addressed at their producing boundaries and consumers. Latest changes were reviewed from source; tests and provider runs were skipped at the maintainer's request. Findings requiring separate decisions or verification remain open. The constructor had combined host settings with the caller map before launcher selection, restoring an omitted REA_APKTOOL_COMMAND. Fixed in 3e58af6: provider state now owns only the selected map. Each operation samples current child inheritance and explicitly preserves the selected launcher value, including omission selecting PATH. The same operation environment and resolved command feed probe and decode, so consumers do not reinterpret the launcher. Added unrun regressions for an explicit empty map versus an ambient launcher and for changing/removed inherited values. Removed the former selection wrapper and stored merged environment. Validation was source inspection only; the touched files were formatted with the pinned toolchain (two formatter threads). Tests, builds, lint, typechecks, provider workloads and CI reruns were not run, as explicitly requested. The filesystem await was outside cancellation and timeout ownership. Fixed in 3e58af6: one 20-second selection deadline bounds the entire Windows PATH search, and each pending stat races the deadline/caller signal through the shared abortable-promise primitive. Cancellation and timeout remain tagged analysis failures; listeners/timer are disposed and late filesystem rejection remains observed. The underlying OS metadata operation can still finish later, but requests and close no longer wait for it. Moved the generic primitive from binary application code into src/process and updated every consumer (binary evaluation/lazy loading, Ghidra and IDA), retaining a single implementation. Added unrun pending-stat cancellation/late rejection and deadline regressions. Validation was source inspection only; the touched files were formatted with the pinned toolchain (two formatter threads). Tests, builds, lint, typechecks, provider workloads and CI reruns were not run, as explicitly requested. The provider retained a constructor-time copy of the whole ambient environment, which could preserve removed or rotated values. Fixed in 3e58af6: long-lived state contains only caller-selected variables. Ambient inheritance is sampled at each operation boundary and retained only for that operation; version and decode share the resulting snapshot. An explicit caller map remains authoritative for launcher selection. Added unrun regressions exercising rotated and removed inherited values and a default launcher changed after construction. The stored merged environment and selection wrapper were removed; no ambient snapshot is added to Evidence. Validation was source inspection only; the touched files were formatted with the pinned toolchain (two formatter threads). Tests, builds, lint, typechecks, provider workloads and CI reruns were not run, as explicitly requested. |
|
Review findings addressed at their producing boundaries and consumers. Latest changes were reviewed from source; tests and provider runs were skipped at the maintainer's request. Findings requiring separate decisions or verification remain open. The constructor had combined host settings with the caller map before launcher selection, restoring an omitted REA_APKTOOL_COMMAND. Fixed in 3e58af6: provider state now owns only the selected map. Each operation samples current child inheritance and explicitly preserves the selected launcher value, including omission selecting PATH. The same operation environment and resolved command feed probe and decode, so consumers do not reinterpret the launcher. Added unrun regressions for an explicit empty map versus an ambient launcher and for changing/removed inherited values. Removed the former selection wrapper and stored merged environment. Validation was source inspection only; the touched files were formatted with the pinned toolchain (two formatter threads). Tests, builds, lint, typechecks, provider workloads and CI reruns were not run, as explicitly requested. Follow-up e31e1fc corrects the confirmed TS2353 from the existing remote logs: timeout phase context now uses supported AnalysisErrorOptions.diagnostics rather than userMessage. The standard timeout operation/tag/duration remain unchanged. Source inspection/formatting only; no CI rerun or post-push result was requested or claimed. The filesystem await was outside cancellation and timeout ownership. Fixed in 3e58af6: one 20-second selection deadline bounds the entire Windows PATH search, and each pending stat races the deadline/caller signal through the shared abortable-promise primitive. Cancellation and timeout remain tagged analysis failures; listeners/timer are disposed and late filesystem rejection remains observed. The underlying OS metadata operation can still finish later, but requests and close no longer wait for it. Moved the generic primitive from binary application code into src/process and updated every consumer (binary evaluation/lazy loading, Ghidra and IDA), retaining a single implementation. Added unrun pending-stat cancellation/late rejection and deadline regressions. Validation was source inspection only; the touched files were formatted with the pinned toolchain (two formatter threads). Tests, builds, lint, typechecks, provider workloads and CI reruns were not run, as explicitly requested. Follow-up e31e1fc corrects the confirmed TS2353 from the existing remote logs: timeout phase context now uses supported AnalysisErrorOptions.diagnostics rather than userMessage. The standard timeout operation/tag/duration remain unchanged. Source inspection/formatting only; no CI rerun or post-push result was requested or claimed. The provider retained a constructor-time copy of the whole ambient environment, which could preserve removed or rotated values. Fixed in 3e58af6: long-lived state contains only caller-selected variables. Ambient inheritance is sampled at each operation boundary and retained only for that operation; version and decode share the resulting snapshot. An explicit caller map remains authoritative for launcher selection. Added unrun regressions exercising rotated and removed inherited values and a default launcher changed after construction. The stored merged environment and selection wrapper were removed; no ambient snapshot is added to Evidence. Validation was source inspection only; the touched files were formatted with the pinned toolchain (two formatter threads). Tests, builds, lint, typechecks, provider workloads and CI reruns were not run, as explicitly requested. Follow-up e31e1fc corrects the confirmed TS2353 from the existing remote logs: timeout phase context now uses supported AnalysisErrorOptions.diagnostics rather than userMessage. The standard timeout operation/tag/duration remain unchanged. Source inspection/formatting only; no CI rerun or post-push result was requested or claimed. |
When
REA_APKTOOL_COMMANDis unset on Windows, the documented PATH fallback retained the bareapktoolname. The invocation boundary could not see a Chocolatey.bat/.cmdlauncher and tried to launch it directly withexecFile.Resolve the Windows fallback through the selected PATH/PATHEXT before choosing process creation. Both version probing and decoding reuse the resolved selection and the provider's canonical environment snapshot. Explicit launcher paths retain their source spelling; native executables retain direct argv handling. Missing candidates, inaccessible candidates, malformed extension values and cancellation retain distinct outcomes.
Added unrun regressions for PATH/PATHEXT ordering, mixed-case environment keys, quoted PATH directories, batch version/decode invocations, native arguments, explicit paths, missing/directory/inaccessible candidates, malformed extensions and cancellation. Source inspection, formatting with two threads, and
git diff --checkonly: tests, builds, check reruns and real Windows/Apktool verification were skipped at the maintainer's explicit request. Performance was not measured.Follow-up to the release review thread. This completes the PATH case of the Windows batch-launcher work contributed by @kaoru0822-kitauji in #1777, originally reported by @psipher in #1774. The release thread remains open pending integration and verification.
References: Node's Windows batch-launcher contract, Windows PATH search, current-directory search control.