FS#24036 - Pacman should not lock the database when doing downloads

Attached to Project: Pacman
Opened by Ng Oon-Ee (ngoonee) - Sunday, 01 May 2011, 23:26 GMT
Last edited by Dan McGee (toofishes) - Monday, 02 May 2011, 12:55 GMT
Task Type Feature Request
Category General
Status Closed
Assigned To No-one
Architecture All
Severity Low
Priority Normal
Reported Version 3.5.2
Due in Version Undecided
Due Date Undecided
Percent Complete 100%
Votes 0
Private No

Details

Summary and Info:
Currently, during a pacman -Syu, there are three 'steps':-
1. Updating of each repo database. (pacman -Sy)
2. Downloading of the packages to be updated. (pacman -Suw)
3. Performing the install. (pacman -Su)

Based on my understanding (may be flawed), /var/lib/pacman/db.lck only NEEDS TO be locked during 1. and 3. I'd like to suggest that the lock be released during 2. Here's my own use-case when doing system maintainance:-
A. Run pacman -Syu
B. While waiting for the downloads (quite a while since I'm on a slow connection) I may check for AUR updates.
C. If the updates are small, makepkg normally finishes before the download of step A completes. I'd like to simply be able to do the install at that point.

Since (presumably) step 3 above is the equivalent of pacman -Su, the database is re-checked before the final update is applied anyway, so this should not break anything.
This task depends upon

Closed by  Dan McGee (toofishes)
Monday, 02 May 2011, 12:55 GMT
Reason for closing:  Duplicate
Additional comments about closing:  FS#23501
Comment by Xavier (shining) - Monday, 02 May 2011, 07:18 GMT
Actually the problem is that -Su is not -Suw + -Su.

The latter does all the target computation twice from scratch. If the database changed in the mean time, the targets of the second -Su can be completely different than the ones from the first -Suw.
And doing the target computation twice also means you need to answer all the conclicts/replaces/ignore/... questions twice.
Not doing it (as -Su does) means you can break some dependencies with the package install/upgrade you do in the meantime.

However, -Suw does not need to lock the repo, just the download cache/directory.
Comment by Ng Oon-Ee (ngoonee) - Monday, 02 May 2011, 07:55 GMT
Yes, it makes sense that any changes during the download affect the result of -Su the second time round. In that case, the cycle would revert, another period of downloading followed by another -Su after that is completed.

My opinion is that if a user is explicitly doing something while a download is being done he should know what to expect. In any case, if the check is done again prior to actual updating, it will just raise an error message, not break anything.

The biggest issue then is that all the questions need to be answered twice. I can't remember how (or whether) Xyne handled this with bauerbill, since it did downloads on its own I believe he may have parsed to dependency list himself, then allowed -Su to parse it again prior to actual installation.

So my follow-up suggestions:-
1. Simply implement as suggested here. Disadvantage is double-asking of questions, for all use-cases.
2. Implement this as a configurable (from a switch or pacman.conf) option. Much more work, I believe, for not very much gain.
3. -Suw not to ask questions, this may mean wastage of bandwidth if a person later decides not to update.
4. 'Save' the answers from the first round. This is also more work, and most probably brittle.
5. As a compromise, if -Suw is implemented so as not to lock the repo (with no other change to current pacman) the behaviour I'm looking for is easily scriptable.
Comment by Xavier (shining) - Monday, 02 May 2011, 12:39 GMT
5 would be nice, and that is definitely covered by FS#23501
Comment by Ng Oon-Ee (ngoonee) - Monday, 02 May 2011, 12:53 GMT
Yes it is, I suppose this is just a dupe then. That bug seems quite complicated to implement though (in my layman's eyes).

Loading...