Bug#865637: pdebuild: please allow to clean the environment

2019-09-09 Thread Philipp Hahn
Package: pbuilder
Version: 0.230.4
Followup-For: Bug #865637

Dear Maintainer,

I'm using
pdebuild --use-pdebuild-internal
which today failed for CUPS: It evaulates $USER for its test case, which
is still set to 'root' despite using 'su pbuser'. 'cupsd' then failes to
start as it refuses to run as user 'root':

$ ps axfuww
> pbuser9225 |   \_ /bin/bash /usr/bin/pdebuild --use-pdebuild-internal 
> --buildresult /var/build/temp/tmp.BwTBJbBy00/result --debbuildopts -F -sa -- 
> --basetgz /var/buildsystem2/pbuilder/errata4.4-1.tgz --buildplace 
> /var/build/temp/tmp.BwTBJbBy00/pbuilder/ --architecture i386
> pbuser9247 |   \_ /bin/bash /usr/bin/pdebuild --use-pdebuild-internal 
> --buildresult /var/build/temp/tmp.BwTBJbBy00/result --debbuildopts -F -sa -- 
> --basetgz /var/buildsystem2/pbuilder/errata4.4-1.tgz --buildplace 
> /var/build/temp/tmp.BwTBJbBy00/pbuilder/ --architecture i386
> pbuser9249 |   |   \_ tee 
> ../cups_2.2.1-8+deb9u4A~4.4.1.201909091134_i386.build
> root  9252 |   \_ sudo pbuilder --execute --bindmounts 
> /var/build/temp/tmp.BwTBJbBy00 --basetgz 
> /var/buildsystem2/pbuilder/errata4.4-1.tgz --buildplace 
> /var/build/temp/tmp.BwTBJbBy00/pbuilder/ --architecture i386 -- 
> /usr/lib/pbuilder/pdebuild-internal /var/build/temp/tmp.BwTBJbBy00/cups-2.2.1 
> --debbuildopts  --debbuildopts  -F -sa --uid 2113 --gid 5001 
> --pbuildersatisfydepends /usr/lib/pbuilder/pbuilder-satisfydepends
> root  9254 |   \_ /bin/bash /usr/sbin/pbuilder --execute 
> --bindmounts /var/build/temp/tmp.BwTBJbBy00 --basetgz 
> /var/buildsystem2/pbuilder/errata4.4-1.tgz --buildplace 
> /var/build/temp/tmp.BwTBJbBy00/pbuilder/ --architecture i386 -- 
> /usr/lib/pbuilder/pdebuild-internal /var/build/temp/tmp.BwTBJbBy00/cups-2.2.1 
> --debbuildopts  --debbuildopts  -F -sa --uid 2113 --gid 5001 
> --pbuildersatisfydepends /usr/lib/pbuilder/pbuilder-satisfydepends
> root  9323 |   \_ /bin/bash /runscript 
> /var/build/temp/tmp.BwTBJbBy00/cups-2.2.1 --debbuildopts  --debbuildopts  -F 
> -sa --uid 2113 --gid 5001 --pbuildersatisfydepends 
> /usr/lib/pbuilder/pbuilder-satisfydepends
> root 12141 |   \_ su -p pbuser
> pbuser   12142 |   \_ bash
> pbuser   12143 |   \_ /usr/bin/perl 
> /usr/bin/dpkg-buildpackage -rfakeroot -us -uc -F -sa
> pbuser   12567 |   \_ /usr/bin/make -f 
> debian/rules build
> pbuser   12624 |   \_ /usr/bin/perl 
> /usr/bin/dh build --with systemd
> pbuser   22812 |   \_ /usr/bin/make -f 
> debian/rules override_dh_auto_test
> pbuser   22830 |   \_ /bin/sh -c 
> CUPS_TESTBASE=/tmp/cups.IIYDf2 make check
> pbuser   22831 |   \_ make check
> pbuser   23659 |   \_ /bin/sh 
> -c cd test; ./run-stp-tests.sh 1 0 n n
> pbuser   23660 |   \_ 
> /bin/sh ./run-stp-tests.sh 1 0 n n
> pbuser5840 |   \_ 
> sleep 10
> pbuser9219 \_ tee -i -a 
> /var/buildsystem2/logs/errata4.4-1/cups_2.2.1-8+deb9u4A~4.4.1.201909091134.log

$ xargs -0 -n1 -a /proc/12142/environ echo | grep -e USER -e LOGNAME -e HOME -e 
PATH
> USERNAME=root
> USER=root
> HOME=/var/build/temp/tmp.BwTBJbBy00
> SUDO_USER=build
> LOGNAME=root
> PATH=/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games

/usr/lib/pbuilder/pdebuild-internal:
> 130 CMD="env PATH=$PATH dpkg-buildpackage -rfakeroot -us -uc $DEBBUILDOPTS"
> 135 su -p pbuser;·

It was changed by git:4d6220c0d2e3abdcf247838168591e9d5e4a078b
> author dancer  Mon Jun 5 11:39:03 2006 +
>
> su -p for pdebuild-internal, to allow options passing through environment.

pbuilder should really provide a clean environment or at least provide
sane defaults for the environment variables listed in :
- HOME (done)
- PATH (done)
- USER (missing)
- LOGNAME (missing)
- SHELL (missing)
and also
- XDG_CONFIG_HOME
- TMPDIR (breaks every 'mktemp' when combined with 'pam_tmpdir.so')
- ...

See attached patch.

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

Kernel: Linux 4.19.0-5-amd64 (SMP w/4 CPU cores)
Kernel taint flags: TAINT_WARN
Locale: LANG=de_DE.UTF-8, LC_CTYPE=de_DE.UTF-8 (charmap=UTF-8), 
LANGUAGE=de:en_US (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
Init: systemd (via /run/systemd/system)
LSM: AppArmor: enabled

Versions of packages pbuilder depends on:
ii  debconf [debconf-2.0]  1.5.71
ii  debootstrap1.0.114
ii  dpkg-dev   1.19.7

Versions of packages pbuilder recommends:
ii  devscripts  2.19.5+deb10u1
ii  eatmydata   105-7
ii  fakeroot1.23-1
ii  iproute24.20.0-2
ii  sudo1.8.27-1

Bug#865637: pdebuild: please allow to clean the environment

2017-06-23 Thread Guido Günther
Package: pbuilder
Version: 0.228.7
Severity: wishlist

Hi,
it would be nice if pbuilder would allow to clean the environment to
avoid things like


https://anonscm.debian.org/cgit/pkg-mozilla/icedove.git/commit/?id=4e87d6b4670f1f2d1e88ff7cf6f76e83b5db0b7c

from happening. In this case "gbp buildpackage" sets DIST which gets
passed on to git-pbuilder which gets passed on to pbuilder and ends
up in the build environment of the package. I've added a fix for this
to git-pbulder


https://git.sigxcpu.org/cgit/git-buildpackage/commit/?id=021fe9dfb39815827e14199ff480d8c00096df55


but it would be nice if pbuilder would allow to clean the environment
completely before invoking commands in the chroot. This is somewhat
realted to

https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=623322

Cheers,
 -- Guido


-- System Information:
Debian Release: 9.0
  APT prefers testing
  APT policy: (990, 'testing'), (500, 'unstable-debug'), (500, 
'testing-debug'), (500, 'oldoldstable'), (500, 'unstable'), (500, 'stable'), 
(1, 'experimental')
Architecture: amd64 (x86_64)
Foreign Architectures: i386

Kernel: Linux 4.9.0-3-amd64 (SMP w/4 CPU cores)
Locale: LANG=de_DE.UTF-8, LC_CTYPE=de_DE.UTF-8 (charmap=UTF-8), 
LANGUAGE=en_US:en (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
Init: systemd (via /run/systemd/system)

Versions of packages pbuilder depends on:
ii  debconf [debconf-2.0]  1.5.61
ii  debootstrap1.0.89
ii  dpkg-dev   1.18.24
ii  wget   1.18-5

Versions of packages pbuilder recommends:
ii  devscripts  2.17.6
ii  eatmydata   105-5
ii  fakeroot1.21-3.1
ii  iproute24.9.0-1
ii  net-tools   1.60+git20161116.90da8a0-1
ii  sudo1.8.19p1-2.1

Versions of packages pbuilder suggests:
ii  cowdancer   0.85
pn  gdebi-core  

-- debconf information excluded