Improve advice for sync ops when db.lck is present
commit2c5f000d5b2fd5db3b70670b835e6b932c0d10e3
authorPang Yan Han <pangyanhan@gmail.com>
Mon, 29 Aug 2011 16:58:48 +0000 (30 00:58 +0800)
committerDan McGee <dan@archlinux.org>
Tue, 30 Aug 2011 01:17:08 +0000 (29 20:17 -0500)
tree4bd8f0e39cd351a007d9cb46723b69f3b7561697
parent234b6ffc2c39268d1efdc414e02bc4b352e5d931
Improve advice for sync ops when db.lck is present

When the database is locked, sync operations involving transactions, such as
pacman -Syy, show the following:

:: Synchronizing package databases...
error: failed to update core (unable to lock database)
error: failed to update extra (unable to lock database)
error: failed to update community (unable to lock database)
error: failed to update multilib (unable to lock database)
error: failed to synchronize any databases

Whereas pacman -U <pkg> shows:

error: failed to init transaction (unable to lock database)
  if you're sure a package manager is not already
  running, you can remove /var/lib/pacman/db.lck

Which is much more meaningful, since the presence of db.lck may indicate an
erroneous lockfile instead of an ongoing transaction.

Improve the error messages for sync operations by advising the user to remove
db.lck if he is sure that no package manager is running.

Signed-off-by: Pang Yan Han <pangyanhan@gmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
src/pacman/sync.c
src/pacman/util.c
src/pacman/util.h