Skip to content

Fix/export make path injection#618

Merged
shiliu-yang merged 3 commits into
masterfrom
fix/export-make-path-injection
Jun 18, 2026
Merged

Fix/export make path injection#618
shiliu-yang merged 3 commits into
masterfrom
fix/export-make-path-injection

Conversation

@shiliu-yang

Copy link
Copy Markdown
Contributor

PR 描述/PR description

[在此详细描述 PR 的内容]/[Describe the PR content in detail here]

代码质量/Code Quality:

在本次拉取请求中,我已考虑以下事项 As part of this pull request, I've considered the following:

  • 确保代码注释和文档清晰,并使用英文注释以保证代码可读性。Ensure that the code comments and documentation are clear, and use English for comments to ensure code readability.
  • 确保文件头遵循文件头格式。Ensure that the file header follows the File Header Format.
  • 确保函数头遵循 Doxygen 格式。Ensure that function headers follow the Doxygen format as specified in Comments.
  • 已查阅 编码风格指南,并核查代码风格合规性,包括缩进、空格、命名规范及其他风格要求。 Reviewed the Coding Style Guide and verified code style compliance, including indentation, spacing, naming conventions, and other style guidelines.
  • 已使用代码格式化工具确保符合 TuyaOpen 编码规范。Have used the code-formatting source code formatting tool to ensure compliance with TuyaOpen coding standards.

On first install the make directory doesn't exist when the early
Add-TuyaPathEntryIfMissing check runs, so make is never added to PATH.
tos.py prepare then downloads make but a Python subprocess cannot modify
its parent PowerShell's PATH. Re-check after prepare so make is
available for subsequent build commands.
- Move PATH injection into Invoke-TuyaExportFinalize (right after prepare)
  instead of at call sites — covers first-install, re-source, and any
  future callers; also survives prepare throwing a terminating error at
  the call-site level (findings #3, #5/altitude)
- Check make.exe -PathType Leaf instead of the containing directory, so
  a partial/failed download that created the dir but not the binary does
  not inject a broken path (findings #1, #2)
- Remove the pre-prepare and post-finalize PATH checks from the main
  try-block; Invoke-TuyaExportFinalize now owns this concern
- Fix Add-TuyaPathEntryIfMissing to use [System.IO.Path]::PathSeparator
  instead of hardcoded ';', avoiding broken deduplication on PowerShell
  Core / Linux (finding #7)
- export.bat: guard PATH add on make.exe existence instead of directory,
  consistent with the ps1 fix (finding #4)
- cli_prepare.py: call prepend_windows_make_to_path() in both success
  paths of ensure_windows_make so the function is no longer dead code
  and make is in PATH for any Python subprocesses tos.py spawns
  (finding #6)
@shiliu-yang

Copy link
Copy Markdown
Contributor Author

Code review

No issues found. Checked for bugs and CLAUDE.md compliance.

🤖 Generated with Claude Code

- If this code review was useful, please react with 👍. Otherwise, react with 👎.

…insensitive handling

- export.ps1: __tuyaTeardown now splits/joins PATH using
  [System.IO.Path]::PathSeparator, matching Add-TuyaPathEntryIfMissing
  so the add/remove sides stay consistent.
- cli_prepare.py: prepend_windows_make_to_path compares entries with
  os.path.normcase to avoid duplicate PATH entries on case-insensitive
  filesystems, aligning with PowerShell's -ieq.
@shiliu-yang shiliu-yang merged commit 75934a2 into master Jun 18, 2026
2 checks passed
@shiliu-yang shiliu-yang deleted the fix/export-make-path-injection branch June 18, 2026 01:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants