Repository navigation
Include lock file path in locking error messages - #57
Merged
Merged
Conversation
Errors raised when opening or locking a lock file fails now name the file, so users can find and remove stale lock files. Closes r-lib#30.
- Use "Can't", backticks around file paths, and trailing full stops. - The 'already has a shared/exclusive lock' errors now name the file. - Fix utf8.c to the new filelock__error() signature; it would not have compiled on Windows otherwise. - Strip the trailing CRLF of Windows system error messages. Ref r-lib#30.
lock() reports the path as file.path(normalizePath(dirname), basename), which mixes path separators on Windows, so scrub that exact string. Ref r-lib#30.
Member
|
Thanks! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
When locking fails, the error message does not say which lock file could not be opened or locked. This makes stale lock files (e.g. left behind by an interrupted
pak::pkg_install(), see r-lib/pak#263) hard for users to find and remove.Changes
All locking error messages now include the lock file path, in backticks, and follow the tidyverse error style ("Can't", trailing full stop), within the constraints of raising errors from C without a cli dependency:
Can't open lock file `<path>`: Permission denied.(and similarly for lock failures).filelock__error()now formatsCan't open lock file `<path>`: Access is denied (Windows error 5)., putting the problem statement before the error code and stripping the trailing CRLF of the system message.File `<path>` already has a shared/exclusive lock.errors now name the file.utf8.ccaller offilelock__error()for the new signature.Note: I could only compile and test the Unix implementation locally (macOS); the Windows code paths should be verified by CI.
Closes #30.