haskell / haskell/unix

Wrong order in error message for symlinks and hardlinks (again)

Open
#353 2 comments 0 reactions 0 assignees View on GitHub
type: bug
Dominant language
Haskell
Stars
124
Forks
99
PR merge metrics
No merged PRs in 30d

Description

PR #122 introduced swapped paths in error messages for `createLink` and `createSymbolink` link

The error message created by [this change](https://github.com/haskell/unix/pull/122/files#diff-e0789aac9eee87c133e527286ccf09ab2931bf91b90115278ba7543961105991L255) is wrong (and a regression vs my fix from https://github.com/haskell/unix/pull/84/files).

It was made incorrect by this "refactor" commit:

https://github.com/haskell/unix/commit/82fcb2bc71f7bde78b8536f5a1e12d50aac0a10a#diff-e0789aac9eee87c133e527286ccf09ab2931bf91b90115278ba7543961105991L233-L255

`throwErrnoTwoPathsIfMinus1_` uses the terminology `path1 to path2`.

That is correct for `rename` where `path1` is renamed by `name2` -- order (source, target).

But it is incorrect for hardlinks and symlinks, where the order is swapped (target, linkpath).

So the message says `mytarget to mylinkpath`, which is the wrong way around.

---

To make sure this doesn't happen again, I think we should also rename the function arguments from `createSymbolicLink name1 name2` to `createSymbolicLink target linkname`.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.