Skip to content
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

fix: Global flock file accessible by every user / Introducing FlockContext manager #1697

Merged
merged 14 commits into from May 18, 2024

Conversation

buhtz
Copy link
Member

@buhtz buhtz commented Apr 21, 2024

  • Introduce a context manager to handle (exclusive) file locks.
  • Move global flock file from /tmp to /run/lock to make it accessible for the root user. The background is that, because of a quit fresh Linux feature, the "root" user is not allowed to write into any file in /tmp no matter if file permissions would allow it.
  • There are much more other flock mechanics in BIT but I didn't touch them yet. Should be done in a separate PR.
  • The method Snapshots.backup() is the only one using the global flock. The method smells like hell. There are ~170 lines between the lock and its release. And I decided not to touch this in this PR. So I just indented that lines to use them inside the new context manager.

It is an idea.

Might...
Close #1676
Close #1122

EDIT: One of the two reporters tested and confirmed the PR.

common/flock.py Show resolved Hide resolved
common/flock.py Outdated Show resolved Hide resolved
@buhtz buhtz added the PR: Waiting for review PR won't be merged until review and approval from a member of the maintenance team. label Apr 23, 2024
@aryoda
Copy link
Contributor

aryoda commented Apr 26, 2024

SDPX looks quite promising to me to support machine-readable licenses too

@buhtz buhtz mentioned this pull request May 5, 2024
@buhtz
Copy link
Member Author

buhtz commented May 12, 2024

Hope it is OK to now treat is as reviewed?

I will also close the two related issues with merging this.

@buhtz buhtz added PR: Merge after creative-break Merge after creative-break (min. 1 week) and removed PR: Waiting for review PR won't be merged until review and approval from a member of the maintenance team. labels May 12, 2024
@buhtz buhtz merged commit 7517521 into bit-team:dev May 18, 2024
1 check passed
@buhtz buhtz deleted the fix/1676flockcontextmanager branch May 18, 2024 19:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
PR: Merge after creative-break Merge after creative-break (min. 1 week)
Projects
None yet
2 participants