Bug 53398 - bacula13: `make_bacula_tables mysql` некорректно создаёт пользователя `bacula`
Summary: bacula13: `make_bacula_tables mysql` некорректно создаёт пользователя `bacula`
Status: CLOSED MOVED
Alias: None
Product: Branch p10
Classification: Unclassified
Component: bacula13 (show other bugs)
Version: не указана
Hardware: x86_64 Linux
: P5 normal
Assignee: Alexei Takaseev
QA Contact: qa-p10@altlinux.org
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2025-03-11 16:11 MSK by Artem Varaksa
Modified: 2025-03-11 17:13 MSK (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Artem Varaksa 2025-03-11 16:11:40 MSK
Шаги
====

# export BACULA=13 \
    && apt-get install -y mt-st mysql-server bacula$BACULA-{common,console,storage,client,director-{common,mysql}} \
    && sed -i "s/skip-networking/# skip-networking/" /etc/my.cnf.d/server.cnf \
    && systemctl enable --now mysqld
    && sleep 5 \
    && sed 's/^db_password=.*/db_password=sqlpass/' -i /usr/share/bacula/scripts/grant_mysql_privileges \
    && /usr/share/bacula/scripts/create_bacula_database mysql \
    && /usr/share/bacula/scripts/make_bacula_tables mysql \
    && /usr/share/bacula/scripts/grant_bacula_privileges mysql \
    && mysql -u root -e "SELECT User,Host FROM mysql.user; SET PASSWORD FOR 'bacula'@'localhost' = PASSWORD('sqlpass'); flush privileges;"

Фактический результат
=====================

Во время выполнения скрипта происходит ошибка:

# /usr/share/bacula/scripts/grant_bacula_privileges mysql

> Granting mysql privileges
> Created MySQL database user: bacula
> --------------
> grant process on *.* to %{db_user}@"%"
> --------------
>
> ERROR 1064 (42000) at line 3: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '%{db_user}@"%"' at line 1
>
> ...
>
> Privileges for user bacula granted on database bacula.

Пользователь `bacula` есть с хостом `%`, но не `localhost`:

# mysql -u root -e "SELECT User,Host FROM mysql.user; SET PASSWORD FOR 'bacula'@'localhost' = PASSWORD('sqlpass'); flush privileges;"

> +-------------+-------------------------------------------------+
> | User        | Host                                            |
> +-------------+-------------------------------------------------+
> | bacula      | %                                               |
> | root        | 127.0.0.1                                       |
> | root        | ::1                                             |
> | mariadb.sys | localhost                                       |
> | root        | localhost                                       |
> | root        | server-10-4-x86-64-minimal-20250310.localdomain |
> +-------------+-------------------------------------------------+
> --------------
> SET PASSWORD FOR 'bacula'@'localhost' = PASSWORD('sqlpass')
> --------------
>
> ERROR 1133 (28000) at line 1: Can't find any matching row in the user table

Ожидаемый результат
===================

Как в bacula15, ошибок не должно быть, и пользователь есть и с хостом `localhost`:

> +-------------+-------------------------------------------------+
> | User        | Host                                            |
> +-------------+-------------------------------------------------+
> | bacula      | %                                               |
> | root        | 127.0.0.1                                       |
> | root        | ::1                                             |
> | bacula      | localhost                                       |
> | mariadb.sys | localhost                                       |
> | root        | localhost                                       |
> | root        | server-10-4-x86-64-minimal-20250310.localdomain |
> +-------------+-------------------------------------------------+

Воспроизводимость
=================

Воспроизводится на виртуальных машинах:

[p11] ALT Server 11.0 beta20250213 x86_64
bacula13-common-13.0.4-alt2.x86_64
mariadb-server-10.11.11-alt1.x86_64

[p10] ALT Server 10.4 x86_64
bacula13-common-13.0.4-alt2.x86_64
mariadb-server-10.6.21-alt1.x86_64

Не воспроизводится с bacula15.
Comment 1 Alexei Takaseev 2025-03-11 17:13:33 MSK
Пакет bacula13 в бранче p11 заменяется на bacula15, для p10 исправления ушли - #377665