Skip to content

fix: improve error message for locking failures - #447

Merged
amoeba merged 1 commit into
mainfrom
fix/windows-lock-better-error
Jul 27, 2026
Merged

fix: improve error message for locking failures#447
amoeba merged 1 commit into
mainfrom
fix/windows-lock-better-error

Conversation

@amoeba

@amoeba amoeba commented Jul 27, 2026

Copy link
Copy Markdown
Member

Certain dbc subcommands use filesystem locks to avoid problems related to running multiple copies of dbc at the same time. The locking mechanism currently doesn't distinguish between a real locking failure and not being able to create the lock file in the first place. This can happen if the user tries to run a command like dbc install --level system foo without admin privs.

This PR adds a specialized error ErrLockContended for lock contention that our fslock implementation can use as a sentinel error and wraps existing calls in a helper function acquireLock that is responsible for handling errors from fslock and printing something more useful to the user than what's currently printed. Additionally, the new, more helpful error also suggests trying the command again with the appropriate mechanism for the user's operating system.

Closes #446

@amoeba
amoeba requested a review from zeroshade July 27, 2026 18:08

@zeroshade zeroshade left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

lgtm

zeroshade

This comment was marked as duplicate.

@amoeba
amoeba merged commit df4d444 into main Jul 27, 2026
17 checks passed
@amoeba
amoeba deleted the fix/windows-lock-better-error branch July 27, 2026 18:20
@amoeba

amoeba commented Jul 27, 2026

Copy link
Copy Markdown
Member Author

Thanks!

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.

errors about lockfiles in dbc install/uninstall when not running with sudo/admin

2 participants