Your message dated Sun, 17 Aug 2025 13:34:11 +0000
with message-id <[email protected]>
and subject line Bug#1108272: fixed in bacula 15.0.3-4
has caused the Debian Bug report #1108272,
regarding bacula-director-pgsql: update_postgresql_tables script fails due to 
bad shell quoting
to be marked as done.

This means that you claim that the problem has been dealt with.
If this is not the case it is now your responsibility to reopen the
Bug report if necessary, and/or fix the problem forthwith.

(NB: If you are a system administrator and have no idea what this
message is talking about, this may indicate a serious mail system
misconfiguration somewhere. Please contact [email protected]
immediately.)


-- 
1108272: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1108272
Debian Bug Tracking System
Contact [email protected] with problems
--- Begin Message ---
Package: bacula-director-pgsql
Version: 15.0.3-1~bpo12+1
Severity: important
X-Debbugs-Cc: [email protected]

Hi,

I installed the bacula director from backports, so that my laptop (which
runs unstable) can still be backed up to my server (which runs stable).

After the upgrade to bacula 15, I noticed that my director was no longer
running. Checking the logs, I found the following:

24-jun 18:00 bacula-dir JobId 0: Fatal error: Version error for database 
"bacula". Wanted 1026, got 1024
24-jun 18:00 bacula-dir JobId 0: Fatal error: Could not open Catalog 
"MyCatalog", database "bacula".
24-jun 18:00 bacula-dir JobId 0: Fatal error: Version error for database 
"bacula". Wanted 1026, got 1024
24-jun 18:00 bacula-dir ERROR TERMINATION

This surprised me, because obviously there's a script to handle this. So
I ran it manually, and received errors about SQL syntax where it said
"do <number>".

Checking the script, I quickly found the problem. Here's a patch that
solved it for me:

--- update_postgresql_tables.orig       2025-06-24 18:14:43.055571381 +0200
+++ update_postgresql_tables    2025-06-24 18:15:04.866426330 +0200
@@ -642,7 +642,7 @@
 
 -- Need to add postgresql-contrib to the dependency list
 
-do $$
+do \$\$
 declare
   selected_ext pg_extension%rowtype;
 begin  
@@ -654,7 +654,7 @@
   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);

the "$$" is meant to be passed to the postgresql server, but
unfortunately it's written unquoted in a here document, which is a
context where the shell does variable expansion.  The result is that the
$$ part gets replaced by the shell into its PID, resulting in a line "do
<PID>", which is not a valid way to quote PL/PGSQL code (the thing that
is being attempted here).

Adding backslashes to avoid that variable expansion resolved the issue
for me.

I don't know whether this problem exists in trixie or unstable too, but
thought I'd mention it.

-- System Information:
Debian Release: 12.11
  APT prefers stable-updates
  APT policy: (500, 'stable-updates'), (500, 'stable-security'), (500, 'stable')
Architecture: amd64 (x86_64)

Kernel: Linux 6.1.0-34-amd64 (SMP w/1 CPU thread; PREEMPT)
Locale: LANG=nl_BE.UTF-8, LC_CTYPE=nl_BE.UTF-8 (charmap=UTF-8), LANGUAGE not set
Shell: /bin/sh linked to /usr/bin/dash
Init: systemd (via /run/systemd/system)
LSM: AppArmor: enabled

Versions of packages bacula-director-pgsql depends on:
ii  bacula-common-pgsql                       15.0.3-1~bpo12+1
ii  dbconfig-pgsql                            2.0.24
ii  debconf [debconf-2.0]                     1.5.82
ii  postgresql-client                         15+248
ii  postgresql-client-13 [postgresql-client]  13.11-0+deb11u1
ii  postgresql-client-15 [postgresql-client]  15.13-0+deb12u1

Versions of packages bacula-director-pgsql recommends:
ii  postgresql  15+248

Versions of packages bacula-director-pgsql suggests:
pn  gawk  <none>

-- debconf information:
* bacula-director-pgsql/pgsql/app-pass: (password omitted)
  bacula-director-pgsql/pgsql/admin-pass: (password omitted)
* bacula-director-pgsql/app-password-confirm: (password omitted)
  bacula-director-pgsql/password-confirm: (password omitted)
  bacula-director-pgsql/pgsql/changeconf: false
  bacula-director-pgsql/db/dbname: bacula
  bacula-director-pgsql/pgsql/method: Unix socket
* bacula-director-pgsql/dbconfig-reinstall: false
  bacula-director-pgsql/pgsql/authmethod-user: ident
  bacula-director-pgsql/pgsql/admin-user: postgres
  bacula-director-pgsql/install-error: abort
  bacula-director-pgsql/pgsql/manualconf:
  bacula-director-pgsql/upgrade-error: abort
  bacula-director-pgsql/pgsql/no-empty-passwords:
  bacula-director-pgsql/passwords-do-not-match:
  bacula-director-pgsql/remove-error: abort
  bacula-director-pgsql/purge: false
  bacula-director-pgsql/pgsql/authmethod-admin: ident
  bacula-director-pgsql/internal/reconfiguring: false
  bacula-director-pgsql/upgrade-backup: false
* bacula-director-pgsql/dbconfig-upgrade: false
  bacula-director-pgsql/db/app-user: bacula@localhost
  bacula-director-pgsql/internal/skip-preseed: true
  bacula-director-pgsql/dbconfig-remove: true
  bacula-director-pgsql/remote/newhost:
  bacula-director-pgsql/remote/port:
  bacula-director-pgsql/missing-db-package-error: abort
  bacula-director-pgsql/database-type: pgsql
  bacula-director-pgsql/remote/host: localhost
* bacula-director-pgsql/dbconfig-install: true

--- End Message ---
--- Begin Message ---
Source: bacula
Source-Version: 15.0.3-4
Done: Carsten Leonhardt <[email protected]>

We believe that the bug you reported is fixed in the latest version of
bacula, which is due to be installed in the Debian FTP archive.

A summary of the changes between this version and the previous one is
attached.

Thank you for reporting the bug, which will now be closed.  If you
have further comments please address them to [email protected],
and the maintainer will reopen the bug report if appropriate.

Debian distribution maintenance software
pp.
Carsten Leonhardt <[email protected]> (supplier of updated bacula package)

(This message was generated automatically at their request; if you
believe that there is a problem with it please contact the archive
administrators by mailing [email protected])


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA512

Format: 1.8
Date: Wed, 13 Aug 2025 10:10:27 +0200
Source: bacula
Architecture: source
Version: 15.0.3-4
Distribution: unstable
Urgency: medium
Maintainer: Debian Bacula Team <[email protected]>
Changed-By: Carsten Leonhardt <[email protected]>
Closes: 1108272 1109499 1109565
Changes:
 bacula (15.0.3-4) unstable; urgency=medium
 .
   [ Sven Hartge ]
   * Add support for ZSTD compression.
   * Pull 8d9669fb2 from Upstream git to fix libzstd detection
   * Flip debconf question about DB upgrade space to default to true
     (Closes: #1109499)
 .
   [ Carsten Leonhardt ]
   * Rework handling of database upgrade scripts in regard to shell quoting
     (Closes: #1108272)
   * Show a message when the user decides to abort the upgrade (Closes: 
#1109565)
 .
   [ Jonas Jelten ]
   * use UTF8 encoding for new postgresql databases
Checksums-Sha1:
 5edef5188f61fb390a07e06a18f9b154c3020568 3732 bacula_15.0.3-4.dsc
 bff0c996e1035c31d590382b5b2afb2c1d99aaa6 102484 bacula_15.0.3-4.debian.tar.xz
Checksums-Sha256:
 e1b0cdc59fd6768cfc48696c6d5a565a2f9f4c28e3b76ec81b637a25ebbc1f85 3732 
bacula_15.0.3-4.dsc
 925a6c18821361ed0c989ccf28e4f02b40704351c1e9809d06b45c2368e06a6f 102484 
bacula_15.0.3-4.debian.tar.xz
Files:
 4ec4ee913f68bc52c4b72c7861089e98 3732 admin optional bacula_15.0.3-4.dsc
 10ddea852331ed2fe65514601d1a26a7 102484 admin optional 
bacula_15.0.3-4.debian.tar.xz

-----BEGIN PGP SIGNATURE-----

iQJDBAEBCgAtFiEETxO/995XSygF6EUmKrIctfbulV4FAmih13APHGxlb0BkZWJp
YW4ub3JnAAoJECqyHLX27pVekhsP/3KmhIpKXUrHku2yv/40a7Mei5fVJnU4E5Wn
9hqoCLi7YWHRwt97bZ8Qquh/QJm04L1rZfnBeCY4mSi6vLqeykLGP+zhv/IPTr5N
g8NJn4pVM6kruOhrKOSDx0DaLLf3/77sbkI2Tpe8VFulhVNK5v8/F1Hw2kMFumtv
gv+Liz7GVkYQgl6Rlkzn8uGiiES++RYYj/aaZPt1qbEjxAIbmhK4uW7PMbb6cOmF
4DLClUJJcCtdg7NCOvHsWAcQZEXpln+3Kx/FDIBGpvRHETKOoiudpgohdrBYdQGy
sLKbClHIwjBq9s0xwjNr9nzRebEhMIH+/2Kgx1Py9sCi3dl2qiFT2e8Ozc5ttUGX
l3HdFi+hXB1B6fP18+4++lQcFCAxL1xDC4SlYmPIaB5DaKX3d78k8UB1+iqvlHaa
5j5amwlGPPtkH7zdVMhA+yokJP36yN7RQW6d1cSsDR+qchr5j415dbqb/TF7gGil
tgm6zbTilPUjR+8hSVZa+xNHX09sNlsXySklde9US8567zIzo5auAqRVSKWn6mTm
c10WlRnlnLjsbaZMb8aXq8HkwKWIExY8sweWMhjwAx0rNNUZm0dLV7WgFXHrhpM1
6wulJ1CJoi3USojbWh3ozgekqvoOIvkEY5z3knC14DfgSPqLsTNAMomi8VvBnH0P
nfk35dGk
=qSl1
-----END PGP SIGNATURE-----

Attachment: pgpQXJHFvVNtH.pgp
Description: PGP signature


--- End Message ---

Reply via email to