You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
cp -r dereferences symlinks/junctions it encounters during recursive traversal (copying the target's contents as a real directory) instead of copying them as links — and a cyclic link explodes ~31 levels deep until the path-length limit stops it. A dangling symlink in the tree makes the whole copy fail. GNU cp -r preserves symlinks as symlinks (verified on real GNU 9.4 via WSL; also reproduces under MSYS 8.32 with MSYS=winsymlinks).
Repro
mkdir -p wA/sub && echo f > wA/sub/f.txt
MSYS=winsymlinks:nativestrict ln -s sub wA/slink
MSYS=winsymlinks:nativestrict ln -s nonexistent wA/dangling
winuxcmd.exe cp -r wA B3
-> cp: error copying directory 'wA' rc=1
B3/slink is a REAL DIR containing f.txt (link dereferenced)
B3/dangling MISSING (copy of the dangling link failed -> whole tree errors)
GNU 9.4 (WSL): cp -r wA wB -> rc=0
wB/slink -> sub (link preserved)
wB/dangling -> nonexistent (dangling link preserved)
Cyclic link blowup
mkdir A && cmd /c "mklink /J A\back A" :: junction A\back -> A
echo x > A\file.txt
winuxcmd.exe cp -r A B2 -> rc=0, creates B2\back\back\back\... 31 levels deep
(65 objects; bounded only by MAX_PATH)
GNU: creates the link once, no recursion (5 objects total)
Note ls -R, du, rm -r, chmod -R correctly do NOT traverse these links — only cp -r does. rm -r on the result correctly removed the junction without touching the target.
Versions
WinuxCmd 1.0.6 (build-vs, WINUX_LANG=en)
GNU coreutils 9.4 (WSL, authoritative) / 8.32 (MSYS)
Activity
caomengxuan666 commentedon Sep 14, 2026
Fixed/verified in 38c8461 / fffd886 / da0e9e8 — GNU-compatible semantics verified against WSL coreutils 9.4; see issues/report-misc.md, report-dd.md, report-cp-mv-install.md.
fix(cp): recreate junctions/symlinks in -r instead of dereferencing