Commit 999d23f
committed
src: fix cpSyncCopyDir to dereference symlinks when dereference option is set
When fs.cpSync() is called with {dereference: true}, symlinks in the source
directory should be followed and their targets copied to the destination
instead of creating new symlinks. This behavior was correctly implemented in
the JavaScript version of cpSync, but was lost when the inner copyDir loop
was migrated to C++ in CpSyncCopyDir().
The dereference parameter was captured but only used for error-condition
checks, not to decide whether to create a symlink or copy the actual content.
Fix by checking dereference before creating symlinks: when true, copy the
actual file (using copy_file) or recurse into the actual directory
(using copy_dir_contents) that the symlink points to.
Fixes: #591681 parent 61102cd commit 999d23f
1 file changed
+32
-5
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3595 | 3595 | | |
3596 | 3596 | | |
3597 | 3597 | | |
3598 | | - | |
| 3598 | + | |
| 3599 | + | |
| 3600 | + | |
| 3601 | + | |
| 3602 | + | |
| 3603 | + | |
| 3604 | + | |
| 3605 | + | |
| 3606 | + | |
| 3607 | + | |
| 3608 | + | |
| 3609 | + | |
| 3610 | + | |
| 3611 | + | |
| 3612 | + | |
| 3613 | + | |
| 3614 | + | |
| 3615 | + | |
| 3616 | + | |
| 3617 | + | |
| 3618 | + | |
| 3619 | + | |
| 3620 | + | |
| 3621 | + | |
3599 | 3622 | | |
3600 | 3623 | | |
| 3624 | + | |
| 3625 | + | |
| 3626 | + | |
| 3627 | + | |
3601 | 3628 | | |
3602 | 3629 | | |
3603 | 3630 | | |
3604 | | - | |
3605 | | - | |
3606 | | - | |
3607 | | - | |
| 3631 | + | |
| 3632 | + | |
| 3633 | + | |
| 3634 | + | |
3608 | 3635 | | |
3609 | 3636 | | |
3610 | 3637 | | |
| |||
0 commit comments