[pacman-dev] [PATCH] Standardize output when db.lck is present

Dan McGee dpmcgee at gmail.com
Mon Aug 29 00:48:09 EDT 2011


On Sat, Aug 27, 2011 at 10:14 PM,  <pangyanhan at gmail.com> wrote:
> From: Pang Yan Han <pangyanhan at gmail.com>
>
> When db.lck file is present, pacman -Syy and other Sync operations involving
> transactions show:
>
> :: 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. Standardize the output to that of pacman -U
> when db.lck is present.

I don't like the implementation of this, similar to Nagy's concerns.
I'm fine with output that looks like this, however:

> :: 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
>  if you're sure a package manager is not already
>  running, you can remove /var/lib/pacman/db.lck

Does that seem OK? So I would add this check the error and "if you're
sure" display code only to the !success block. I'd also be fine with
displaying the "failed to init transaction" message in there too (see
below).

I would also prefer not to duplicate code and long messages; if we can
extract this into a trans_error() util method of some sort that would
be great. The entire `ret == -1` block in trans_init can probably be
extracted.

-Dan


More information about the pacman-dev mailing list