[pkg-bacula-devel] Bug#1108272: Bug#1108272: bacula-director-pgsql: update_postgresql_tables script fails due to bad shell quoting
Sven Hartge
sven at svenhartge.de
Mon Jun 30 17:24:38 BST 2025
On 30.06.25 15:35, Carsten Leonhardt wrote:
> I've implemented it and it seems much more elegant - just a call to sed
> instead of a patch that needs manual attention when things change. When
> I have time I'll do a binary comparison of the resulting packages.
(Removing the Bug from the Reply.)
I build both branches and diffoscoped the debs. Resulting report is
attached.
In the mysql script the only change is in both
./usr/share/dbconfig-common/data/bacula-director-mysql/install/mysql and
./usr/share/bacula-director/make_mysql_tables
│ │ │ │ - `MinValue` INTEGER DEFAULT 0,
│ │ │ │ - `MaxValue` INTEGER DEFAULT 0,
│ │ │ │ + \`MinValue\` INTEGER DEFAULT 0,
│ │ │ │ + \`MaxValue\` INTEGER DEFAULT 0,
And for Postgres this looks like this
in./usr/share/bacula-director/update_postgresql_tables,
/usr/share/bacula-director/make_postgresql_tables AND
./usr/share/dbconfig-common/data/bacula-director-pgsql/install/pgsql
│ │ │ │ -do $$
│ │ │ │ +do \$\$
│ │ │ │ declare
│ │ │ │ selected_ext pg_extension%rowtype;
│ │ │ │ begin
│ │ │ │
│ │ │ │ select 1 from pg_extension
│ │ │ │ into selected_ext
│ │ │ │ where extname = 'pg_trgm';
│ │ │ │
│ │ │ │ if not found then
│ │ │ │ CREATE EXTENSION pg_trgm;
│ │ │ │ end if;
│ │ │ │ -end $$;
│ │ │ │ +end \$\$;
For Postgres is does not affect the special upgrade-dbadmin/ script,
because that was a manual addition.
So it for MySQL and Postgres affects the dbconfig snippets and the
manual upgrade scripts.
I wonder of the change to the dbconfig ones will break them.
S°
-------------- next part --------------
--- master/
+++ unescape/
│ --- master/bacula-director-mysql_15.0.3-3_all.deb
├── +++ unescape/bacula-director-mysql_15.0.3-3_all.deb
│ ├── file list
│ │ @@ -1,3 +1,3 @@
│ │ -rw-r--r-- 0 0 0 4 2025-04-24 15:00:09.000000 debian-binary
│ │ -rw-r--r-- 0 0 0 2312 2025-04-24 15:00:09.000000 control.tar.xz
│ │ --rw-r--r-- 0 0 0 154800 2025-04-24 15:00:09.000000 data.tar.xz
│ │ +-rw-r--r-- 0 0 0 154804 2025-04-24 15:00:09.000000 data.tar.xz
│ ├── control.tar.xz
│ │ ├── control.tar
│ │ │ ├── ./md5sums
│ │ │ │ ├── ./md5sums
│ │ │ │ │┄ Files differ
│ ├── data.tar.xz
│ │ ├── data.tar
│ │ │ ├── file list
│ │ │ │ @@ -2,21 +2,21 @@
│ │ │ │ drwxr-xr-x 0 root (0) root (0) 0 2025-04-24 15:00:09.000000 ./usr/
│ │ │ │ drwxr-xr-x 0 root (0) root (0) 0 2025-04-24 15:00:09.000000 ./usr/share/
│ │ │ │ drwxr-xr-x 0 root (0) root (0) 0 2025-04-24 15:00:09.000000 ./usr/share/bacula-director/
│ │ │ │ -rwxr-xr-x 0 root (0) root (0) 413 2025-04-24 15:00:09.000000 ./usr/share/bacula-director/create_mysql_database
│ │ │ │ -rwxr-xr-x 0 root (0) root (0) 403 2025-04-24 15:00:09.000000 ./usr/share/bacula-director/drop_mysql_database
│ │ │ │ -rwxr-xr-x 0 root (0) root (0) 1702 2025-04-24 15:00:09.000000 ./usr/share/bacula-director/drop_mysql_tables
│ │ │ │ -rwxr-xr-x 0 root (0) root (0) 1106 2025-04-24 15:00:09.000000 ./usr/share/bacula-director/grant_mysql_privileges
│ │ │ │ --rwxr-xr-x 0 root (0) root (0) 22346 2025-04-24 15:00:09.000000 ./usr/share/bacula-director/make_mysql_tables
│ │ │ │ +-rwxr-xr-x 0 root (0) root (0) 22350 2025-04-24 15:00:09.000000 ./usr/share/bacula-director/make_mysql_tables
│ │ │ │ -rwxr-xr-x 0 root (0) root (0) 23839 2025-04-24 15:00:09.000000 ./usr/share/bacula-director/update_mysql_tables
│ │ │ │ drwxr-xr-x 0 root (0) root (0) 0 2025-04-24 15:00:09.000000 ./usr/share/dbconfig-common/
│ │ │ │ drwxr-xr-x 0 root (0) root (0) 0 2025-04-24 15:00:09.000000 ./usr/share/dbconfig-common/data/
│ │ │ │ drwxr-xr-x 0 root (0) root (0) 0 2025-04-24 15:00:09.000000 ./usr/share/dbconfig-common/data/bacula-director-mysql/
│ │ │ │ drwxr-xr-x 0 root (0) root (0) 0 2025-04-24 15:00:09.000000 ./usr/share/dbconfig-common/data/bacula-director-mysql/install/
│ │ │ │ --rw-r--r-- 0 root (0) root (0) 21595 2025-04-24 15:00:09.000000 ./usr/share/dbconfig-common/data/bacula-director-mysql/install/mysql
│ │ │ │ +-rw-r--r-- 0 root (0) root (0) 21599 2025-04-24 15:00:09.000000 ./usr/share/dbconfig-common/data/bacula-director-mysql/install/mysql
│ │ │ │ drwxr-xr-x 0 root (0) root (0) 0 2025-04-24 15:00:09.000000 ./usr/share/dbconfig-common/data/bacula-director-mysql/upgrade/
│ │ │ │ drwxr-xr-x 0 root (0) root (0) 0 2025-04-24 15:00:09.000000 ./usr/share/dbconfig-common/data/bacula-director-mysql/upgrade/mysql/
│ │ │ │ -rw-r--r-- 0 root (0) root (0) 4119 2025-04-24 15:00:09.000000 ./usr/share/dbconfig-common/data/bacula-director-mysql/upgrade/mysql/11.0.0
│ │ │ │ -rw-r--r-- 0 root (0) root (0) 1374 2025-04-24 15:00:09.000000 ./usr/share/dbconfig-common/data/bacula-director-mysql/upgrade/mysql/13.0.0
│ │ │ │ -rw-r--r-- 0 root (0) root (0) 7186 2025-04-24 15:00:09.000000 ./usr/share/dbconfig-common/data/bacula-director-mysql/upgrade/mysql/15.0.0
│ │ │ │ -rw-r--r-- 0 root (0) root (0) 1600 2025-04-24 15:00:09.000000 ./usr/share/dbconfig-common/data/bacula-director-mysql/upgrade/mysql/3.0.0
│ │ │ │ -rw-r--r-- 0 root (0) root (0) 1454 2025-04-24 15:00:09.000000 ./usr/share/dbconfig-common/data/bacula-director-mysql/upgrade/mysql/5.0.0
│ │ │ ├── ./usr/share/bacula-director/make_mysql_tables
│ │ │ │ @@ -573,16 +573,16 @@
│ │ │ │ PRIMARY KEY (UnsavedId)
│ │ │ │ );
│ │ │ │
│ │ │ │
│ │ │ │
│ │ │ │ CREATE TABLE Counters (
│ │ │ │ Counter TINYBLOB NOT NULL,
│ │ │ │ - `MinValue` INTEGER DEFAULT 0,
│ │ │ │ - `MaxValue` INTEGER DEFAULT 0,
│ │ │ │ + \`MinValue\` INTEGER DEFAULT 0,
│ │ │ │ + \`MaxValue\` INTEGER DEFAULT 0,
│ │ │ │ CurrentValue INTEGER DEFAULT 0,
│ │ │ │ WrapCounter TINYBLOB NOT NULL,
│ │ │ │ PRIMARY KEY (Counter(128))
│ │ │ │ );
│ │ │ │
│ │ │ │ CREATE TABLE CDImages (
│ │ │ │ MediaId INTEGER UNSIGNED NOT NULL,
│ │ │ ├── ./usr/share/dbconfig-common/data/bacula-director-mysql/install/mysql
│ │ │ │ @@ -546,16 +546,16 @@
│ │ │ │ PRIMARY KEY (UnsavedId)
│ │ │ │ );
│ │ │ │
│ │ │ │
│ │ │ │
│ │ │ │ CREATE TABLE Counters (
│ │ │ │ Counter TINYBLOB NOT NULL,
│ │ │ │ - `MinValue` INTEGER DEFAULT 0,
│ │ │ │ - `MaxValue` INTEGER DEFAULT 0,
│ │ │ │ + \`MinValue\` INTEGER DEFAULT 0,
│ │ │ │ + \`MaxValue\` INTEGER DEFAULT 0,
│ │ │ │ CurrentValue INTEGER DEFAULT 0,
│ │ │ │ WrapCounter TINYBLOB NOT NULL,
│ │ │ │ PRIMARY KEY (Counter(128))
│ │ │ │ );
│ │ │ │
│ │ │ │ CREATE TABLE CDImages (
│ │ │ │ MediaId INTEGER UNSIGNED NOT NULL,
│ --- master/bacula-director-pgsql_15.0.3-3_all.deb
├── +++ unescape/bacula-director-pgsql_15.0.3-3_all.deb
│ ├── file list
│ │ @@ -1,3 +1,3 @@
│ │ -rw-r--r-- 0 0 0 4 2025-04-24 15:00:09.000000 debian-binary
│ │ -rw-r--r-- 0 0 0 2372 2025-04-24 15:00:09.000000 control.tar.xz
│ │ --rw-r--r-- 0 0 0 156280 2025-04-24 15:00:09.000000 data.tar.xz
│ │ +-rw-r--r-- 0 0 0 156316 2025-04-24 15:00:09.000000 data.tar.xz
│ ├── control.tar.xz
│ │ ├── control.tar
│ │ │ ├── ./md5sums
│ │ │ │ ├── ./md5sums
│ │ │ │ │┄ Files differ
│ ├── data.tar.xz
│ │ ├── data.tar
│ │ │ ├── file list
│ │ │ │ @@ -2,21 +2,21 @@
│ │ │ │ drwxr-xr-x 0 root (0) root (0) 0 2025-04-24 15:00:09.000000 ./usr/
│ │ │ │ drwxr-xr-x 0 root (0) root (0) 0 2025-04-24 15:00:09.000000 ./usr/share/
│ │ │ │ drwxr-xr-x 0 root (0) root (0) 0 2025-04-24 15:00:09.000000 ./usr/share/bacula-director/
│ │ │ │ -rwxr-xr-x 0 root (0) root (0) 1634 2025-04-24 15:00:09.000000 ./usr/share/bacula-director/create_postgresql_database
│ │ │ │ -rwxr-xr-x 0 root (0) root (0) 341 2025-04-24 15:00:09.000000 ./usr/share/bacula-director/drop_postgresql_database
│ │ │ │ -rwxr-xr-x 0 root (0) root (0) 1637 2025-04-24 15:00:09.000000 ./usr/share/bacula-director/drop_postgresql_tables
│ │ │ │ -rwxr-xr-x 0 root (0) root (0) 3500 2025-04-24 15:00:09.000000 ./usr/share/bacula-director/grant_postgresql_privileges
│ │ │ │ --rwxr-xr-x 0 root (0) root (0) 23145 2025-04-24 15:00:09.000000 ./usr/share/bacula-director/make_postgresql_tables
│ │ │ │ --rwxr-xr-x 0 root (0) root (0) 24767 2025-04-24 15:00:09.000000 ./usr/share/bacula-director/update_postgresql_tables
│ │ │ │ +-rwxr-xr-x 0 root (0) root (0) 23149 2025-04-24 15:00:09.000000 ./usr/share/bacula-director/make_postgresql_tables
│ │ │ │ +-rwxr-xr-x 0 root (0) root (0) 24771 2025-04-24 15:00:09.000000 ./usr/share/bacula-director/update_postgresql_tables
│ │ │ │ drwxr-xr-x 0 root (0) root (0) 0 2025-04-24 15:00:09.000000 ./usr/share/dbconfig-common/
│ │ │ │ drwxr-xr-x 0 root (0) root (0) 0 2025-04-24 15:00:09.000000 ./usr/share/dbconfig-common/data/
│ │ │ │ drwxr-xr-x 0 root (0) root (0) 0 2025-04-24 15:00:09.000000 ./usr/share/dbconfig-common/data/bacula-director-pgsql/
│ │ │ │ drwxr-xr-x 0 root (0) root (0) 0 2025-04-24 15:00:09.000000 ./usr/share/dbconfig-common/data/bacula-director-pgsql/install/
│ │ │ │ --rw-r--r-- 0 root (0) root (0) 22587 2025-04-24 15:00:09.000000 ./usr/share/dbconfig-common/data/bacula-director-pgsql/install/pgsql
│ │ │ │ +-rw-r--r-- 0 root (0) root (0) 22591 2025-04-24 15:00:09.000000 ./usr/share/dbconfig-common/data/bacula-director-pgsql/install/pgsql
│ │ │ │ drwxr-xr-x 0 root (0) root (0) 0 2025-04-24 15:00:09.000000 ./usr/share/dbconfig-common/data/bacula-director-pgsql/install-dbadmin/
│ │ │ │ -rw-r--r-- 0 root (0) root (0) 57 2025-04-24 15:00:09.000000 ./usr/share/dbconfig-common/data/bacula-director-pgsql/install-dbadmin/pgsql
│ │ │ │ drwxr-xr-x 0 root (0) root (0) 0 2025-04-24 15:00:09.000000 ./usr/share/dbconfig-common/data/bacula-director-pgsql/upgrade/
│ │ │ │ drwxr-xr-x 0 root (0) root (0) 0 2025-04-24 15:00:09.000000 ./usr/share/dbconfig-common/data/bacula-director-pgsql/upgrade/pgsql/
│ │ │ │ -rw-r--r-- 0 root (0) root (0) 2351 2025-04-24 15:00:09.000000 ./usr/share/dbconfig-common/data/bacula-director-pgsql/upgrade/pgsql/11.0.0
│ │ │ │ -rw-r--r-- 0 root (0) root (0) 1355 2025-04-24 15:00:09.000000 ./usr/share/dbconfig-common/data/bacula-director-pgsql/upgrade/pgsql/11.0.0~1017
│ │ │ │ -rw-r--r-- 0 root (0) root (0) 925 2025-04-24 15:00:09.000000 ./usr/share/dbconfig-common/data/bacula-director-pgsql/upgrade/pgsql/13.0.0
│ │ │ ├── ./usr/share/bacula-director/make_postgresql_tables
│ │ │ │ @@ -70,27 +70,27 @@
│ │ │ │ Plugin text,
│ │ │ │ FileIndex int,
│ │ │ │ JobId int
│ │ │ │ );
│ │ │ │
│ │ │ │ -- Need to add postgresql-contrib to the dependency list
│ │ │ │
│ │ │ │ -do $$
│ │ │ │ +do \$\$
│ │ │ │ declare
│ │ │ │ selected_ext pg_extension%rowtype;
│ │ │ │ begin
│ │ │ │
│ │ │ │ select 1 from pg_extension
│ │ │ │ into selected_ext
│ │ │ │ where extname = 'pg_trgm';
│ │ │ │
│ │ │ │ if not found then
│ │ │ │ CREATE EXTENSION pg_trgm;
│ │ │ │ end if;
│ │ │ │ -end $$;
│ │ │ │ +end \$\$;
│ │ │ │
│ │ │ │ CREATE INDEX meta_emailowner on MetaEmail (EmailTenant, EmailOwner);
│ │ │ │ CREATE INDEX meta_emailtime on MetaEmail (EmailTime);
│ │ │ │ CREATE INDEX meta_emailid on MetaEmail (EmailId);
│ │ │ │ CREATE INDEX meta_emailtags on MetaEmail (EmailTags);
│ │ │ │ CREATE INDEX meta_emailfoldername on MetaEmail (EmailFolderName);
│ │ │ │ -- CREATE INDEX meta_emailsender on MetaEmail (EmailSender);
│ │ │ ├── ./usr/share/bacula-director/update_postgresql_tables
│ │ │ │ @@ -638,27 +638,27 @@
│ │ │ │ Plugin text,
│ │ │ │ FileIndex int,
│ │ │ │ JobId int
│ │ │ │ );
│ │ │ │
│ │ │ │ -- Need to add postgresql-contrib to the dependency list
│ │ │ │
│ │ │ │ -do $$
│ │ │ │ +do \$\$
│ │ │ │ declare
│ │ │ │ selected_ext pg_extension%rowtype;
│ │ │ │ begin
│ │ │ │
│ │ │ │ select 1 from pg_extension
│ │ │ │ into selected_ext
│ │ │ │ where extname = 'pg_trgm';
│ │ │ │
│ │ │ │ if not found then
│ │ │ │ CREATE EXTENSION pg_trgm;
│ │ │ │ end if;
│ │ │ │ -end $$;
│ │ │ │ +end \$\$;
│ │ │ │
│ │ │ │ CREATE INDEX meta_emailowner on MetaEmail (EmailTenant, EmailOwner);
│ │ │ │ CREATE INDEX meta_emailtime on MetaEmail (EmailTime);
│ │ │ │ CREATE INDEX meta_emailtags on MetaEmail (EmailTags);
│ │ │ │ CREATE INDEX meta_emailfoldername on MetaEmail (EmailFolderName);
│ │ │ │ -- CREATE INDEX meta_emailsender on MetaEmail (EmailSender);
│ │ │ │ CREATE INDEX meta_emailconversationid on MetaEmail (EmailConversationId);
│ │ │ ├── ./usr/share/dbconfig-common/data/bacula-director-pgsql/install/pgsql
│ │ │ │ @@ -54,27 +54,27 @@
│ │ │ │ Plugin text,
│ │ │ │ FileIndex int,
│ │ │ │ JobId int
│ │ │ │ );
│ │ │ │
│ │ │ │ -- Need to add postgresql-contrib to the dependency list
│ │ │ │
│ │ │ │ -do $$
│ │ │ │ +do \$\$
│ │ │ │ declare
│ │ │ │ selected_ext pg_extension%rowtype;
│ │ │ │ begin
│ │ │ │
│ │ │ │ select 1 from pg_extension
│ │ │ │ into selected_ext
│ │ │ │ where extname = 'pg_trgm';
│ │ │ │
│ │ │ │ if not found then
│ │ │ │ CREATE EXTENSION pg_trgm;
│ │ │ │ end if;
│ │ │ │ -end $$;
│ │ │ │ +end \$\$;
│ │ │ │
│ │ │ │ CREATE INDEX meta_emailowner on MetaEmail (EmailTenant, EmailOwner);
│ │ │ │ CREATE INDEX meta_emailtime on MetaEmail (EmailTime);
│ │ │ │ CREATE INDEX meta_emailid on MetaEmail (EmailId);
│ │ │ │ CREATE INDEX meta_emailtags on MetaEmail (EmailTags);
│ │ │ │ CREATE INDEX meta_emailfoldername on MetaEmail (EmailFolderName);
│ │ │ │ -- CREATE INDEX meta_emailsender on MetaEmail (EmailSender);
More information about the pkg-bacula-devel
mailing list