Skip to content

Fix issue 60: confusing error messages in rename/createLink/createSymbolicLink #122

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 7 commits into from
Feb 24, 2021

Conversation

luispedro
Copy link
Contributor

This fixes #60. It builds on #65 (I cherry-picked the commit), while addressing the issues raised there.

@luispedro luispedro changed the title Fix issue 60 Fix issue 60: confusing error messages in rename/createLink/createSymbolicLink Nov 11, 2018
Copy link
Contributor

@hs-viktor hs-viktor left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please also rebase on master, so we run this through the most recent CI incarnation.

POSIX's ENOENT error doesn't specify if the problem was with source or
destination path. Throw error mentioning both paths instead of only
first one.

Fixes haskell#60
@luispedro luispedro force-pushed the fix_issue60 branch 2 times, most recently from 3d7f8a9 to 6e02c14 Compare February 20, 2021 02:51
@luispedro
Copy link
Contributor Author

Previous issues have been address and the branch has been rebased against main. CI looks good too.

Per the comments on PR haskell#65, it should be unambiguous.
@luispedro
Copy link
Contributor Author

I'm so sorry, I really thought I had addressed that. Fixed now (and I will add a test)

Very basic, but tests that the created link is a hard link and points to
the original file
@luispedro
Copy link
Contributor Author

Added a test, which would have caught the previously mistake of creating symlinks when normal links were desired

@luispedro luispedro requested a review from hs-viktor February 22, 2021 07:57
Copy link
Contributor

@hs-viktor hs-viktor left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually, I just noticed that similar changes also need to happen in System/Posix/Files/ByteString.hsc. Please make these consistent. There the filenames will be ByteStrings (RawFilePath), and throw errors via System.Posix.ByteString.FilePath.

@hs-viktor
Copy link
Contributor

Actually, I just noticed that similar changes also need to happen in System/Posix/Files/ByteString.hsc. Please make these consistent. There the filenames will be ByteStrings (RawFilePath), and throw errors via System.Posix.ByteString.FilePath.

The new function for two paths should probably be added to that module and its non-bytestring twin.

Just in case we ever move a String type that is not a [Char], but
something more like UTF-8 text. The more polymorphic <> should work even
if String is no longer a list.

Also, add a signature to throwErrnoTwoPathsIfMinus1_

Co-authored-by: Viktor Dukhovni <[email protected]>
@luispedro
Copy link
Contributor Author

Updated the code to use <> & have a signature.

The ByteString module stuff might have to wait until the evening as it seems a bit more involved..

Same as done for FilePath versions in 484566b
@luispedro
Copy link
Contributor Author

ByteString module updated as well (including tests)

@luispedro luispedro requested a review from hs-viktor February 23, 2021 06:01
Copy link
Contributor

@hs-viktor hs-viktor left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Very nice. Thanks.

@hs-viktor hs-viktor requested a review from Bodigrim February 23, 2021 06:26
@hs-viktor hs-viktor merged commit 49cb62d into haskell:master Feb 24, 2021
hs-viktor pushed a commit that referenced this pull request Feb 24, 2021
@luispedro luispedro deleted the fix_issue60 branch February 25, 2021 02:42
@Bodigrim Bodigrim added this to the 2.8.0.0 milestone Apr 20, 2022
hasufell pushed a commit to hasufell/unix that referenced this pull request Jul 19, 2022
@hasufell hasufell mentioned this pull request Jul 19, 2022
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.

Misleading error messages in rename
5 participants