cp --no-dereference --preserve=links copies directory symlinks as file symlinks
Nobody has claimed this yet.
Assessment
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Newbie friendliness
- 58/100
- Issue type
- Bug
- Clarity
- Mostly clear
- Activity status
- Quiet
- Tech stack
- rust
- Domain
- cli, operating-systems
Research direction
Reproduce the Windows commands in the issue and start at the cp implementation, focusing on how directory symlinks are classified and recreated with --no-dereference. Done means copying the sample preserves aaa2 as a directory symlink that supports listing and chdir, while regular file symlink behavior remains unchanged.
Written by the indexing model from the issue text.
Description
cp -a implies --no-dereference --preserve=links
When as an elevated user I archive-copy a directory containing directory symlinks I expect them to be preserved as true directory symlinks but regular file symlinks are created instead in the destination and they're dysfunctional: you cannot list files inside or chdir into them.
>cmd.exe
>"C:\Program Files\coreutils\bin\cp.exe" --version
cp (uutils coreutils) 0.8.0
>mkdir src\aaa1\sub
>mklink /D src\aaa2 aaa1
symbolic link created for src\aaa2 <<===>> aaa1
>dir src
Directory of L:\BASINPAD\bench\src
09/06/2026 09:32 <DIR> .
09/06/2026 09:32 <DIR> ..
09/06/2026 09:32 <DIR> aaa1
09/06/2026 09:32 <SYMLINKD> aaa2 [aaa1]
0 File(s) 0 bytes
4 Dir(s) 11,395,715,072 bytes free
>"C:\Program Files\coreutils\bin\cp.exe" -av src dst
'src' -> 'dst\'
'src\aaa1' -> 'dst\aaa1'
'src\aaa1\sub' -> 'dst\aaa1\sub'
'src\aaa2' -> 'dst\aaa2'
>dir dst
Directory of L:\BASINPAD\bench\dst
09/06/2026 09:32 <DIR> .
09/06/2026 09:32 <DIR> ..
09/06/2026 09:32 <DIR> aaa1
09/06/2026 09:32 <SYMLINK> aaa2 [aaa1]
1 File(s) 0 bytes
3 Dir(s) 11,395,715,072 bytes free
>dir src\aaa2\
Directory of L:\BASINPAD\bench\src\aaa2
09/06/2026 09:32 <DIR> .
09/06/2026 09:32 <DIR> ..
09/06/2026 09:32 <DIR> sub
0 File(s) 0 bytes
3 Dir(s) 11,395,715,072 bytes free
>dir dst\aaa2\
Directory of L:\BASINPAD\bench\dst\aaa2
File Not Found
- Dominant language
- Rust
- Stars
- 5.2k
- Forks
- 107
- Avg merge
- 2d 19h
- Merged PRs (30d)
- 4
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from microsoft/coreutils
-
Difficulty 2/5 1-3 hours Newbie friendliness 65/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
-
sleep has 9MB Open
Difficulty 5/5 Over a week Newbie friendliness 35/100
-
grep not work Open
Difficulty 3/5 1-2 days Newbie friendliness 55/100
-
Difficulty 3/5 1-2 days Newbie friendliness 52/100
All issues in microsoft/coreutils
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
ontola/atomic-server#1625 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
VirusTotal/yara-x#777 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
stratum-mining/stratum#2404 ·
-
bug ci good first issue
Difficulty 2/5 1-3 hours Newbie friendliness 88/100