Andrew Gregory <andrew.gregory.8@gmail.com> on Tue, 2017/06/06 17:56:
On 06/06/17 at 11:26pm, Christian Hesse wrote:
From: Christian Hesse <mail@eworm.de>
We used to check for file existens, but that suffers from stale lock files caused by unexpected events like crash, shutdown, etc.
Instead use flock() to lock the file. It does not matter whether or not the file exists but whether an exclusive lock can be obtained.
Also remove the hint about removing the file from pacman.
Signed-off-by: Christian Hesse <mail@eworm.de> --- lib/libalpm/handle.c | 17 +++++++++++++++-- src/pacman/util.c | 5 ----- 2 files changed, 15 insertions(+), 7 deletions(-)
Refusing to run when a lock file is leftover from a previous invocation is intentional. It serves as an indicator that the user needs to verify the integrity of their system. Also, see https://lists.archlinux.org/pipermail/pacman-dev/2013-August/017733.html for previous discussion regarding flock().
Thanks for the heads-up. I did not know this thread. Looks like I should invest more time searching for this kind of information before reinventing the wheel. Perhaps anybody should add a comment to lib/libalpm/handle.c why we are *not* adding flock(). ;) BTW, it is interesting what systems actually do run pacman... -- main(a){char*c=/* Schoene Gruesse */"B?IJj;MEH" "CX:;",b;for(a/* Best regards my address: */=0;b=c[a++];) putchar(b-1/(/* Chris cc -ox -xc - && ./x */b/42*2-3)*42);}