Package: pbuilder
Version: 0.231
Severity: wishlist
Control: tags patch

Dear Maintainer,

There are eight hookscripts in the examples/ directory
that use ${APTGETOPT[@]} in their code. APTGETOPT is a
bash array and while it works fine inside pbuilder code
where all library modules are sourced, it is not get
exported to hookscripts, because they are executed as
a separate process and the array is not exported to
their environment.

I have tested this using explicit export APTGETOPT clause
in my pbuilderrc and hookscripts that print the environment
and, unless my configuration is fundamentally broken, it
is not get exported.

I file this as a bug, because including a large number
of scripts using this feature in the examples/ directory
implies the expectation that it actually works.

The attached patch exports the APTGETOPT array as a plain
environment variable in a way that scripts that use the
${APTGETOPT[@]} form in their code will run successfully
without modification. The second patch (...manpages) updates
the relevant hookscripts section of the pbuilder manpage.

Cheers,
Georgios

-- System Information:
Distributor ID: Devuan
Description:    Devuan GNU/Linux 6 (excalibur/ceres)
Release:        6
Codename:       excalibur ceres
Architecture: x86_64

Kernel: Linux 6.7.9-amd64 (SMP w/8 CPU threads; PREEMPT)
Locale: LANG=el_GR.UTF-8, LC_CTYPE=el_GR.UTF-8 (charmap=UTF-8), LANGUAGE
not set
Shell: /bin/sh linked to /usr/bin/dash
Init: sysvinit (via /sbin/init)
LSM: AppArmor: enabled

Versions of packages pbuilder depends on:
ii  debconf [debconf-2.0]  1.5.86
ii  debootstrap            1.0.134devuan2
ii  dpkg-dev               1.22.6

Versions of packages pbuilder recommends:
ii  devscripts  2.23.7
ii  eatmydata   131-1
ii  fakeroot    1.34-1
ii  iproute2    6.8.0-1
ii  net-tools   2.10-0.1devuan1
ii  sudo        1.9.15p5-3+b1

Versions of packages pbuilder suggests:
pn  cowdancer   <none>
ii  gdebi-core  0.9.5.7+nmu7

-- debconf information:
  pbuilder/mirrorsite: http://deb.devuan.org/merged
  pbuilder/rewrite: false
  pbuilder/nomirror:

-- debsums errors found:
debsums: changed file /usr/lib/pbuilder/pbuilder-modules (from pbuilder
package)

NOTE: I have patched pbuilder-modules with both the
patch I have proposed in bug #789401 and the patch
in this bug report, hence the failed debsums test.
diff --git a/pbuilder-modules b/pbuilder-modules
index 5695d0f2..d4df7ae6 100644
--- a/pbuilder-modules
+++ b/pbuilder-modules
@@ -1159,6 +1159,7 @@ function executehooks () {
                    DISTRIBUTION="$DISTRIBUTION" \
                    BUILD_ARCH="$ARCHITECTURE" \
                    HOST_ARCH="$HOST_ARCH" \
+                   APTGETOPT="$(echo ${APTGETOPT[@]})" \
                        $CHROOTEXEC "/$hooks/$(basename "$fn")"
                    log.i "user script $fn finished"
                else
diff --git a/pbuilder.8 b/pbuilder.8
index e59e207e..69fa56e8 100644
--- a/pbuilder.8
+++ b/pbuilder.8
@@ -432,6 +432,11 @@ contains the build architecture, the architecture the package is building on.
 .I HOST_ARCH
 contains the host architecture, the architecture the package is building for.
 .RE
+.RS 8
+.I APTGETOPT
+contains additional options to pass to apt-get. Since \fBAPTGETOPT()\fR is a
+bash array, the variable contains all its values concatenated with spaces.
+.RE
 \" End of hookdir description
 
 .TP

Reply via email to