Skip to content

fix: remap junction targets across short/long and verbatim paths - #5

Merged
rootkiller6788 merged 1 commit into
rootkiller6788:mainfrom
TianHengZhuang:fix/junction-remap-paths
Sep 12, 2026
Merged

rootkiller6788 merged 1 commit into
rootkiller6788:mainfrom
TianHengZhuang:fix/junction-remap-paths

Conversation

@TianHengZhuang

Copy link
Copy Markdown
Contributor

Why

After #4 merged, main CI Gate 1 (cargo test) failed:

dsh-adapter::runtimes::tests::copy_tree_recreates_junctions_without_following
junction must point into the copied tree (dst), got:
C:\Users\runneradmin\AppData\Local\Temp\...\junctions\src\store\pkg

restore_junctions / remap_target compared the raw read_link() target to the src path with Path::strip_prefix. On GitHub Actions windows runners those forms disagree (8.3 RUNNER~1 vs long runneradmin, and sometimes \\?\ verbatim prefixes), so remapping silently failed and junctions were recreated pointing at the source tree — breaking the self-containment contract the copy is supposed to provide.

What

  • normalize_path / strip_verbatim_prefix: canonicalize + drop \\?\ / UNC-verbatim
  • restore_junctions: walk and remap using normalized src / dst
  • remap_target: normalize the junction target before strip_prefix
  • Regression test asserts on normalized paths
  • Unit tests for strip_verbatim_prefix and remap_target

How tested

  • Logic is covered by the existing junction regression test (now path-form resilient) plus three new unit tests
  • Intended to turn Gate 1 green on the next push to main / PR

Refs the failing run: https://github.com/rootkiller6788/dsh-launcher/actions/runs/34673817501

…im paths

copy_tree copies with robocopy /XJ and then restore_junctions recreates
pnpm-style junctions so the runtime is self-contained. remap_target used
Path::strip_prefix on the raw read_link() result against the src we
walked. On GitHub Actions windows runners those two forms disagree —
temp is often an 8.3 short name (C:\Users\RUNNER~1\...) while read_link
returns the long name (C:\Users\runneradmin\...), and junctions can also
come back with a \\?\ verbatim prefix. strip_prefix then fails, the
junction is recreated pointing at the source tree, and the self-
containment contract silently breaks. That is what failed Gate 1 on
main: copy_tree_recreates_junctions_without_following.

Normalize src, dst, and each junction target through canonicalize +
verbatim-strip before comparing, and assert on normalized paths in the
regression test. Also pin three unit tests for strip_verbatim_prefix and
remap_target.
@rootkiller6788
rootkiller6788 merged commit fc522f9 into rootkiller6788:main Sep 12, 2026
1 check 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.

2 participants