Skip to content

lib: add file locking to downloads#675

Open
Duncaen wants to merge 2 commits intovoid-linux:masterfrom
Duncaen:part-locking
Open

lib: add file locking to downloads#675
Duncaen wants to merge 2 commits intovoid-linux:masterfrom
Duncaen:part-locking

Conversation

@Duncaen
Copy link
Member

@Duncaen Duncaen commented Feb 17, 2026

Usually the files in the cache directory are protected by the pkgdb write lock. But if xbps-install uses separate root directories but shared cache directories there needs to be extra locking to avoid file corruption.

lib/download.c Dismissed
free(tempfile);

if (lockfd != -1)
release_lock(lockfile, lockfd);

Check warning

Code scanning / CodeQL

Comparison result is always the same Warning

Comparison is always true because lockfd >= 0.
Copy link
Member Author

Choose a reason for hiding this comment

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

intended in case locking becomes optional, doesn't really make sense for every download.

Usually the files in the cache directory are protected by the pkgdb
write lock. But if xbps-install uses separate root directories but
shared cache directories there needs to be extra locking to avoid file
corruption.
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.

1 participant

Comments