Skip to content

ln: canonicalize the parent directory of the destination, not the destination itself#2338

Merged
tertsdiepraam merged 8 commits intouutils:masterfrom
miDeb:ln/dst-symlink
Jun 12, 2021
Merged

ln: canonicalize the parent directory of the destination, not the destination itself#2338
tertsdiepraam merged 8 commits intouutils:masterfrom
miDeb:ln/dst-symlink

Conversation

@miDeb
Copy link
Copy Markdown
Contributor

@miDeb miDeb commented Jun 2, 2021

When determining the absolute path for the destination file, the destination file might already exist and be a symlink.

Submitting as a draft because there are test failures on windows and mac that I need to investigate. So far I wasn't able to reproduce the failing test on a windows VM, so if anybody can any help would be greatly appreciated.

Will close #2335

@miDeb miDeb changed the title Ln/dst symlink ln: don't follow symlinks for the dst path Jun 2, 2021
if `dst.exists()` and `settings.overwrite` is `OverwriteMode::Force`,
we already delete the file in the match above.
@miDeb miDeb force-pushed the ln/dst-symlink branch 2 times, most recently from 36ead0c to ca03c55 Compare June 3, 2021 15:11
@miDeb miDeb changed the title ln: don't follow symlinks for the dst path ln: canonicalize the parent directory of the destination, not the destination itself Jun 3, 2021
dst may or may not exist. In case it exists it might already be a symlink.
In neither case we should try to canonicalize dst, only its parent directory.

https://www.gnu.org/software/coreutils/manual/html_node/ln-invocation.html
> Relative symbolic links are generated based on their canonicalized
> **containing directory**, and canonicalized targets.
@miDeb miDeb force-pushed the ln/dst-symlink branch from ca03c55 to 6c46d09 Compare June 3, 2021 17:17
@miDeb miDeb marked this pull request as ready for review June 3, 2021 17:45
@tertsdiepraam tertsdiepraam merged commit 440eba6 into uutils:master Jun 12, 2021
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.

Converting absolute to relative symlink errors with No such file or directory

2 participants