Bug #107918 apt-key should not be used in scripts (mysql-apt-config)
Submitted: 20 Jul 7:00 Modified: 20 Jul 11:06
Reporter: Evgeniy Patlan (OCA) Email Updates:
Status: Verified Impact on me:
None 
Category:MySQL Package Repos Severity:S4 (Feature request)
Version:0.8.22-1 OS:Debian
Assigned to: CPU Architecture:Any
Tags: packaging error

[20 Jul 7:00] Evgeniy Patlan
Description:
Hi.
While installing mysql-apt-config_0.8.22-1_all.deb on any debian based system I got the following warning message:
---------
Unpacking mysql-apt-config (0.8.22-1) ...
Setting up mysql-apt-config (0.8.22-1) ...
Warning: apt-key should not be used in scripts (called from postinst maintainerscript of the package mysql-apt-config)
OK
---------

How to repeat:
wget https://dev.mysql.com/get/mysql-apt-config_0.8.22-1_all.deb
sudo apt install ./mysql-apt-config_0.8.22-1_all.deb

Suggested fix:
--- postinst    2022-07-20 06:59:22.370696826 +0000
+++ postinst    2022-07-20 06:59:05.950696826 +0000
@@ -152,7 +152,7 @@
 
        GPG_FILE=`mktemp`
        create_temp_mysql_gpg_file $GPG_FILE
-       apt-key add $GPG_FILE
+       apt-key add $GPG_FILE > /dev/null 2>&1
        remove_temp_mysql_gpg_file $GPG_FILE
 
        save_settings
[20 Jul 11:06] MySQL Verification Team
Hi,

I do not like "hiding" the problems so your suggested "fix" is not something I would encourage. There should be a proper way of doing this from the script.

Anyhow, this is not a bug, everything works as intended. I will log this as Feature Request to implement that script "properly" if possible.

Thanks
[21 Jul 7:26] Ceri Williams
> Anyhow, this is not a bug, everything works as intended. I will log this as Feature Request to implement that script "properly" if possible.

It is using deprecated commands, seems like a bug not a feature request :)

The following shows you what should be done:
https://wiki.debian.org/DebianRepository/UseThirdParty#OpenPGP_Key_distribution
[21 Jul 7:28] Ceri Williams
Just to clarify with a snippet from the doc link:

The key MUST NOT be placed in /etc/apt/trusted.gpg.d or loaded by apt-key add.