Is it safe to delete the locks in `post_update`?

Is it safe to remove the database locks in the post_upgrade script?

rm $(pacman-conf DBPath)db.lck &> /dev/null

I can’t include links in my post but lines I’m looking at are in:

packages/core/manjaro-system/-/blob/master/manjaro-update-system.sh # L45

Hello and welcome,

What is your exact concern here ?
If the db is locked you can’t install a package.

his concern is how works manjaro-system " `manjaro-update-system.sh" script… as it’s run at install step, and use pacman, then need to delete the lock inside the script while the “update is not yet finished”

And what is the answer ? :slight_smile:

Exactly. I can’t include links easily for some reason, so here is a mangled version:

gitlabDOTmanjaroDOTorg/packages/core/manjaro-system/-/blob/master/manjaro-update-system.sh#L43

This to me doesn’t look very safe, can some explain why they think it might be?

Raised an issue here:

https://gitlab.manjaro.org/packages/core/manjaro-system/-/issues/5

Explain why is not safe. Is your claim.

Reversal of burden of proof. Why?

As far as all this goes, was mentioned also on gitlab that is not an issue. Doesn’t make it neither safe nor unsafe.
I’m not a sh expert, but before each pacman -S ... from it, for each if list there is the
rm $(pacman-conf DBPath)db.lck &> /dev/nul

Without it then the patch would fail with unable to lock database

Explain why is not safe. Is your claim.

My understanding of locks is generally something locks it, then that process unlocks it. So surely if the lock exists, then something else has locked it. You’re now manually removing the lock from another process. That’s why I’m asking if this is not safe to do? And is my understanding correct here?

As far as all this goes, was mentioned also on gitlab that is not an issue .

There was no explanation on the Gitlab issue. Generally when I’m unsure if something is correct or not, I’ll ask the community for an explanation of what it is doing and why this is fine to do. Even better, the maintainers offer guidance so the rest of us can learn.

Without it then the patch would fail with unable to lock database

So this is what I’m asking. If something else has locked it, why can we manually remove the lock?