[PR #2802] [MERGED] fix(apktool): resolve Windows PATH launchers before invocation #5406

Closed
opened 2026-10-31 01:06:24 +00:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/morluto/rea/pull/2802
Author: @morluto
Created: 10/13/2026
Status: ✅ Merged
Merged: 10/13/2026
Merged by: @morluto

Base: main ← Head: codex/fix-apktool-windows-launcher-review


📝 Commits (3)

  • d0ea32d fix(apktool): resolve Windows PATH launchers before invocation
  • 3e58af6 fix(apktool): bound lookup and retain only selected environment
  • e31e1fc fix(apktool): use supported timeout diagnostics

📊 Changes

9 files changed (+486 additions, -55 deletions)

View changed files

📝 src/apktool/ApktoolConfiguration.test.ts (+271 -10)
📝 src/apktool/ApktoolConfiguration.ts (+118 -20)
📝 src/apktool/ApktoolProvider.ts (+40 -15)
📝 src/application/binary/AnalysisProviderEvaluation.ts (+1 -1)
📝 src/application/binary/LazyAnalysisProvider.ts (+1 -1)
📝 src/ghidra/GhidraProviderClient.ts (+1 -4)
📝 src/ida/IdaSessionClient.ts (+1 -4)
📝 src/process/AbortablePromise.ts (+0 -0)
➕ tests/process-global/apktoolEnvironment.test.ts (+53 -0)

📄 Description

When REA_APKTOOL_COMMAND is unset on Windows, the documented PATH fallback retained the bare apktool name. The invocation boundary could not see a Chocolatey .bat/.cmd launcher and tried to launch it directly with execFile.

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 --check only: 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.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/morluto/rea/pull/2802 **Author:** [@morluto](https://github.com/morluto) **Created:** 10/13/2026 **Status:** ✅ Merged **Merged:** 10/13/2026 **Merged by:** [@morluto](https://github.com/morluto) **Base:** `main` ← **Head:** `codex/fix-apktool-windows-launcher-review` --- ### 📝 Commits (3) - [`d0ea32d`](https://github.com/morluto/rea/commit/d0ea32d3a3bcd9d11c6edc19b014c786e85ed138) fix(apktool): resolve Windows PATH launchers before invocation - [`3e58af6`](https://github.com/morluto/rea/commit/3e58af6cecda04dcd6dbebfcc54facaa0f6d8a45) fix(apktool): bound lookup and retain only selected environment - [`e31e1fc`](https://github.com/morluto/rea/commit/e31e1fc3799729e4aee04dc0b09f6dd65e0de40b) fix(apktool): use supported timeout diagnostics ### 📊 Changes **9 files changed** (+486 additions, -55 deletions) <details> <summary>View changed files</summary> 📝 `src/apktool/ApktoolConfiguration.test.ts` (+271 -10) 📝 `src/apktool/ApktoolConfiguration.ts` (+118 -20) 📝 `src/apktool/ApktoolProvider.ts` (+40 -15) 📝 `src/application/binary/AnalysisProviderEvaluation.ts` (+1 -1) 📝 `src/application/binary/LazyAnalysisProvider.ts` (+1 -1) 📝 `src/ghidra/GhidraProviderClient.ts` (+1 -4) 📝 `src/ida/IdaSessionClient.ts` (+1 -4) 📝 `src/process/AbortablePromise.ts` (+0 -0) ➕ `tests/process-global/apktoolEnvironment.test.ts` (+53 -0) </details> ### 📄 Description When `REA_APKTOOL_COMMAND` is unset on Windows, the documented PATH fallback retained the bare `apktool` name. The invocation boundary could not see a Chocolatey `.bat`/`.cmd` launcher and tried to launch it directly with `execFile`. 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 --check` only: 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](https://github.com/morluto/rea/pull/1693#discussion_r4242074525). 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](https://nodejs.org/api/child_process.html#spawning-bat-and-cmd-files-on-windows), [Windows PATH search](https://learn.microsoft.com/windows-server/administration/windows-commands/path), [current-directory search control](https://learn.microsoft.com/en-us/windows/win32/api/processenv/nf-processenv-needcurrentdirectoryforexepathw). --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-10-31 01:06:24 +00:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
morluto/rea#5406
No description provided.