Skip to content

fix(sources): refuse a Windows junction as the Ubuntu source output - #578

Merged
Pedro Henrique Penna (ppenna) merged 1 commit into
microsoft:devfrom
jay23606:fix/ubuntu-source-junction
Oct 20, 2026
Merged

Pedro Henrique Penna (ppenna) merged 1 commit into
microsoft:devfrom
jay23606:fix/ubuntu-source-junction

Conversation

@jay23606

Copy link
Copy Markdown
Contributor

Fixes #374

Summary

  • collect_ubuntu_sources checked the output with Path.is_symlink(), which misses Windows junctions. A junction to another directory was followed: the reset removed the target's packages/ and wrote new output there.
  • Both collectors now use common.is_link_or_junction (reparse-aware), and _reset_source_output refuses a linked output before it deletes anything.

Test

  • New Windows test makes a real junction to a directory holding packages/keep.txt. It fails on dev (validation accepts the junction) and passes here, and the target file survives.
  • test_nvx_tools: 533 pass, 54 skipped as before. ruff and pyright strict on Linux and Windows are clean.

🤖 Generated with Claude Code

Copilot AI balanced review requested due to automatic review settings October 15, 2026 21:02

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

The focused fix reuses established detection logic and adds targeted regression coverage, with no unresolved findings.

0 open findings

What changed in this PR

Fixes #374 by rejecting Windows junctions before Ubuntu source collection can delete files in their targets.

Changes:

  • Shares existing link and junction detection between both collectors.
  • Guards Ubuntu output validation and reset operations.
  • Adds a Windows regression test checking rejection and target-file preservation.
File Description
scripts/​test_nvx_tools.py Adds a real Windows junction regression test.
scripts/​nvx_tools/​common.py Extracts shared link and junction detection.
scripts/​nvx_tools/​collect_ubuntu_sources.py Rejects junctions during validation and reset.
scripts/​nvx_tools/​collect_alpine_sources.py Reuses the shared detection helper.

🧠 Review effort: Balanced


💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Copilot AI balanced review requested due to automatic review settings October 15, 2026 21:50
@jay23606
Jay (jay23606) force-pushed the fix/ubuntu-source-junction branch from 6d9dbc1 to 5c99622 Compare October 15, 2026 21:50

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

The focused fix reuses established junction detection, adds targeted regression coverage, and has no unresolved findings.

0 open findings

🧠 Review effort: Balanced

Copilot AI balanced review requested due to automatic review settings October 16, 2026 17:38

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

The focused fix addresses destructive junction traversal, preserves Alpine behavior, and includes targeted regression coverage.

0 open findings

🧠 Review effort: Balanced

@jay23606
Jay (jay23606) force-pushed the fix/ubuntu-source-junction branch from 1a65510 to e9beca0 Compare October 19, 2026 04:44
Copilot AI balanced review requested due to automatic review settings October 19, 2026 04:44

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

The focused guards address the reported data-loss path with no identified blocking issues; Windows tests were reviewed but not executed.

No open issues 🎉

Review effort: Balanced

Copilot AI balanced review requested due to automatic review settings October 19, 2026 11:02
@jay23606
Jay (jay23606) force-pushed the fix/ubuntu-source-junction branch from e9beca0 to 3f230fb Compare October 19, 2026 11:02

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

The focused guards address the reported data-loss path without identified regressions; native Windows tests were not rerun during review.

No open issues 🎉

Review effort: Balanced

@jay23606
Jay (jay23606) force-pushed the fix/ubuntu-source-junction branch from 3f230fb to a4fd636 Compare October 19, 2026 12:56
Copilot AI balanced review requested due to automatic review settings October 19, 2026 12:56

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

The focused change reuses established junction detection, addresses the reported deletion path, and has no identified blocking issues.

No open issues 🎉

Review effort: Balanced

@jay23606
Jay (jay23606) force-pushed the fix/ubuntu-source-junction branch from a4fd636 to dd3b1d2 Compare October 19, 2026 13:11
Copilot AI balanced review requested due to automatic review settings October 19, 2026 13:11

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

The focused guards address the reported data-loss path, preserve Alpine behavior, and include targeted regression coverage.

No open issues 🎉

Review effort: Balanced

@jay23606
Jay (jay23606) force-pushed the fix/ubuntu-source-junction branch from dd3b1d2 to ebd7c6b Compare October 19, 2026 13:31
Copilot AI balanced review requested due to automatic review settings October 19, 2026 13:31

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

The focused fix closes the reported deletion path, preserves Alpine behavior, and includes targeted regression coverage.

No open issues 🎉

Review effort: Balanced

@jay23606
Jay (jay23606) force-pushed the fix/ubuntu-source-junction branch from fbe4260 to 4058c2b Compare October 19, 2026 17:47
Copilot AI balanced review requested due to automatic review settings October 19, 2026 17:47

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

The focused fix reuses established detection logic and adds targeted regression coverage, with no blocking issues identified.

No open issues 🎉

Review effort: Balanced

@jay23606
Jay (jay23606) force-pushed the fix/ubuntu-source-junction branch from 4058c2b to 3b62baf Compare October 19, 2026 17:51
Copilot AI balanced review requested due to automatic review settings October 19, 2026 17:51

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

The focused fix addresses the reported deletion path with regression coverage and no identified blockers; Windows tests were not independently run.

No open issues 🎉

Review effort: Balanced

@jay23606
Jay (jay23606) force-pushed the fix/ubuntu-source-junction branch from 3b62baf to a21c1ac Compare October 20, 2026 02:49
Copilot AI balanced review requested due to automatic review settings October 20, 2026 02:49

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@jay23606
Jay (jay23606) force-pushed the fix/ubuntu-source-junction branch from a21c1ac to f2ff251 Compare October 20, 2026 03:48
Copilot AI balanced review requested due to automatic review settings October 20, 2026 03:48

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@jay23606
Jay (jay23606) force-pushed the fix/ubuntu-source-junction branch from f2ff251 to 40eab7e Compare October 20, 2026 04:22
Copilot AI balanced review requested due to automatic review settings October 20, 2026 04:22

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

The Ubuntu collector's output guard used Path.is_symlink(), which misses
junctions. A junction to another directory was followed, so reset deleted the
target's packages/ and wrote new output there. Use the reparse-aware check,
now shared with the Alpine collector, on the output and its generated paths,
and refuse a linked output in the reset as well. Add a Windows regression test.

Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com>
Signed-off-by: jay23606 <4602056+jay23606@users.noreply.github.com>
@jay23606
Jay (jay23606) force-pushed the fix/ubuntu-source-junction branch from 40eab7e to afbad81 Compare October 20, 2026 11:59
Copilot AI balanced review requested due to automatic review settings October 20, 2026 11:59

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@ppenna
Pedro Henrique Penna (ppenna) merged commit 60ef317 into microsoft:dev Oct 20, 2026
29 checks passed
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.

Track release source collection bugs: Ubuntu output junction deletes target files

3 participants