[debian-mysql] Bug#853008: Bug#853008: Bug#853008: mysql-server-5.7: purge could delete mariadb-server files with inadequate warning

Julian Gilbey jdg at debian.org
Mon Jan 30 19:36:51 UTC 2017


On Mon, Jan 30, 2017 at 06:38:16PM +0000, Robie Basak wrote:
> > So how about this, just a sketch at the moment rather than a full
> > patch?
> 
> Your sketch seems good to me, assuming that "dpkg-query --search" is
> permitted from maintainer scripts (I know there are some re-entrancy
> problems with some particular types of dpkg-related invocations?)

AFAIK it is safe to run dpkg-query, as it only queries the dpkg
database without performing any actions: it can be run as an
unprivileged user, for example.  (It is equivalent to "dpkg -S", btw.)
It is already used in numerous maintainer scripts, as a quick "grep
dpkg-query /var/lib/dpkg/info/*.p* shows.

With a little more checking, it turns out that the dpkg-query command
can be simplified, as it doesn't do a pattern search without an
explcit request, so the following should also work:

    daemonpackage=$(dpkg-query -S /usr/sbin/mysqld 2>/dev/null | cut -d: -f1)

The "|| true" is probably also unnecessary, as the pipeline will
succeed unless the "cut" command fails, which is highly unlikely.

> [...]
> 
> I wondered this too. But without thinking it through in more detail,
> it'd certainly be better than what we have now.

Fair enough.  If implementing it, it should probably be done together
with the patches I sent to the other bug report, and applied to both
the mysql-server and mariadb-server packages.

Best wishes,

   Julian



More information about the pkg-mysql-maint mailing list