[MDEV-25930] RPM Posttrans syntax error Created: 2021-06-15  Updated: 2021-09-22  Resolved: 2021-06-16

Status: Closed
Project: MariaDB Server
Component/s: Packaging, Upgrades
Affects Version/s: 10.4.19, 10.5.10
Fix Version/s: 10.2.40, 10.3.31, 10.4.21, 10.5.12, 10.6.3

Type: Bug Priority: Blocker
Reporter: Hartmut Holzgraefe Assignee: Alexey Bychko (Inactive)
Resolution: Fixed Votes: 1
Labels: None


 Description   

MariaDB-Server POSTTRANS script in 10.5.10 RPMs (both CentOS/RHEL and SLES) causes a shell error on upgrade from earlier versions. This does not prevent the package update from completing, but due to the failed check the intended systemctl restart of the service is not happening ...

E.g. on CentOS/8 with yum, when using "yum update" to upgrade from 10.5.9 to 10.5.10, this is reported as:

[...]
  Cleanup          : galera-4-26.4.7-1.el8.x86_64                                                                                          10/10 
  Running scriptlet: MariaDB-server-10.5.10-1.el8.x86_64                                                                                   10/10 
/var/tmp/rpm-tmp.Tk0Qos: line 6: [: is-active: binary operator expected
 
  Running scriptlet: galera-4-26.4.7-1.el8.x86_64                                                                                          10/10 
[...]

[...]
(4/4) Installing: MariaDB-server-10.5.10-1.x86_64 ................................................[done]
Executing %posttrans script 'MariaDB-server-10.5.10-1.x86_64.rpm' -----------------------------------[\]
Output of MariaDB-server-10.5.10-1.x86_64.rpm %posttrans script:
    /var/adm/update-scripts/posttransLZaa4D/MariaDB-server-10.5.10-1.x86_64.rpmxiouMA: line 7: [: is-active: binary operator expected
 
Executing %posttrans scripts .....................................................................[done]
[...]

Suggested fix:

--- old/POSTTRANS	2021-06-15 15:35:02.209791910 +0200
+++ new/POSTTRANS	2021-06-15 15:35:42.137511570 +0200
@@ -3,7 +3,7 @@
   # only restart the server if it was already running
   if [ -x /usr/bin/systemctl ] ; then
     /usr/bin/systemctl daemon-reload > /dev/null 2>&1
-    if [ /usr/bin/systemctl is-active mysql ]; then
+    if /usr/bin/systemctl is-active mysql ; then
       /usr/bin/systemctl restart mysql > /dev/null 2>&1
     else
       /usr/bin/systemctl try-restart mariadb.service > /dev/null 2>&1



 Comments   
Comment by Hartmut Holzgraefe [ 2021-06-15 ]

10.4.19 is also affected, and probably latest 10.3 and 10.2 releases, too

Comment by Sergei Golubchik [ 2021-06-15 ]

Ouch. It's https://github.com/MariaDB/server/commit/9ecf9a644c57be61a8f1399ce677d72f5865a770
but only in 10.5.

Comment by Alexey Bychko (Inactive) [ 2021-06-16 ]

pushed to bb-10.2-MDEV-25930 and 10.[x]e-abychko

Comment by Alexey Bychko (Inactive) [ 2021-06-16 ]

done

Generated at Thu Feb 08 09:41:29 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.