Repository navigation
cp: error on -s with relative source and destination outside cwd - #15300
henrimarconni wants to merge 9 commits into
Conversation
|
Thanks for the review :)
|
Now, the verify_relative_symlink_in_cwd function compares dir_name(dest) with "." by name first and then by device and inode. If the parent is not trivially ".", stat both "." and the parent and compare their FileInformation. If either stat fails, the destination is treated as outside the cwd.
|
Thanks for the review, all addressed:
|
Merging this PR will improve performance by 3.56%
|
| Mode | Benchmark | BASE |
HEAD |
Efficiency | |
|---|---|---|---|---|---|
| ⚡ |
Simulation | sort_reverse_utf8_locale |
82 ms | 79.2 ms | +3.56% |
Tip
Curious why performance improved? Comment @codspeedbot explain why performance improved on this PR, or directly use the CodSpeed MCP with your agent.
Comparing henrimarconni:main (350371a) with main (80fd308)2
Footnotes
-
70 benchmarks were skipped, so the baseline results were used instead. If they were deleted from the codebase, click here and archive them to remove them from the performance reports. ↩
-
No successful run was found on
main(9c28184) during the generation of this report, so 80fd308 was used instead as the comparison base. There might be some changes unrelated to this pull request in this report. ↩
Co-authored-by: Eduardo M. Rodrigues <16357187+eduardomourar@users.noreply.github.com>
Removes one of the inconsistencies listed in #15254
cp -s b.txt subcreatedsub/b.txt -> b.txt, a dangling self-referential symlink, and exited 0. GNU refuses with:and exits 1. A relative symlink target is resolved from the link's own directory, so it can't point back to
./b.txtfrom insidesub/.Changes
handle_copy_mode(CopyMode::SymLink), return an error when the source is not absolute and the destination's parent is not the current directory.cp-error-relative-symlink-not-in-cwdmessage toen-US.ftlandfr-FR.ftl.Behavior
Before:
exit: 0;
files: sub/b.txt l mode 777After:
exit: 1;

cp: sub/b.txt: can make relative symbolic links only in current directory