[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Parsing of dpkg status file considered harmful



Guillem Jover writes ("Parsing of dpkg status file considered harmful"):
> Please stop parsing dpkg status file from maintainer scripts. No
> package should assume its location or format (except for now for
> package managment frontends and the like, until there's a proper
> library they can use). This might make it really difficult in case
> we have to change the db layout or whatever in the future.

Guillem is absolutely right.  _At the moment it does not work!_

If a dpkg run is interrupted, or when dpkg is running,
/var/lib/dpkg/status is not a complete and accurate record.  Don't
touch it.

> If you need to retrieve the conffile info, which is why most of those
> packages are poking at the status file, please use something like:
>   $ dpkg-query -W -f='${Conffiles}' docbook-xml
> which is also cleaner. If there happens to be any reentrancy problem
> in dpkg-query, that will be considered a bug and fixed, so this should
> be considered the standard api for maintainer scripts.

Quite so.

(Note that I'm adamantly opposed to the IMO crazy plans to replace the
on-disk status database format.  IMO the parsing needs to be sped up
and the Descriptions moved into a separate file.  But this is a
discussion for a different list.)

Ian.



Reply to: