Skip to content

Fix mysql grant for database names containing hyphens

dbconfig-mysql failed when creating the user for a database which has a hyphen character (-) in its name.

I stumbled upon this error when trying a package of mine with Ubuntu Focal. Looking at the versions in Debian, this bug is currently also present in bullseye and sid.

If there is a particular reason for the now reintroduced backticks around the database name when issuing GRANT ALL ON `<db_name>`.* … to not be present, I have completely missed it. The original commit's author, @rafaeldtinoco, might be able to shed some light on this.

You may also be interested in including a hyphen-related test to this package. I was unsure whether you would prefer a separate test for this or if I should just change the test database's name from testdbname to testdb-name, maybe also changing the user in a similar way to catch corresponding errors.


internal/mysql

Commit 0f07c3d6, merged in salsa with !3 (merged), introduced a regression handling database names containing hyphens, which made dbconfig-common fail in postinst when creating a database user for a database containing a hyphen.

Escape the database name again to reestablish old behaviour.

Edited by Simon Hollenbach

Merge request reports

Loading