Package: debootstrap
Version: 1.0.128+nmu2
Severity: normal

Calling debootstrap from a Makefile as part of building a bootable image
for USB Armory devices I find wget-log* files created in the $PWD which
in this case is a git repository. debootstrap is operating on a rootfs
directory in another path outside the repository.

After adding 'set -x' to
/usr/share/debootstrap/functions::wgetprogress() it revealed:

    + [ !  ]
    + NVSWITCH=-nv
    + local ret=0
    + [  ]
    + wget -nv -O 
/srv/NAS/Sunny/SourceCode/builds/usbarmory/mark-one/imx53/rootfs/var/lib/apt/lists/partial/deb.debian.org_debian_dists_bookworm_InRelease
 http://deb.debian.org/debian/dists/bookworm/InRelease

    Redirecting output to 'wget-log.4'.
    + ret=0
    + set +x

Showing that 'wget -nv' is always forced.

    usbarmory-debian-base_image$ ls -latr wget*
    -rw-r--r-- 1 root root 241 2023-08-28 10:57 wget-log
    -rw-r--r-- 1 root root 351 2023-08-28 10:57 wget-log.1
    -rw-r--r-- 1 root root 241 2023-08-28 11:15 wget-log.2
    -rw-r--r-- 1 root root 351 2023-08-28 11:15 wget-log.3
    -rw-r--r-- 1 root root 241 2023-08-28 13:13 wget-log.4
    -rw-r--r-- 1 root root 351 2023-08-28 13:14 wget-log.5

The code looks to have been changed at some point because currently it
has a forced:

      [ ! "$VERBOSE" ] && NVSWITCH="-nv"

but later uses a shell conditional with:

    wget ${NVSWITCH:+"$NVSWITCH"} "$@"

that makes it seem like at some point in the past NVSWITCH could be
overridden and only pass "-nv" if it were unset or null.

It would be preferable to have some control over this from the calling
command line (or via variable override). I've implemented it with a
one-line change that allows WGETOPTS to be set in the calling
environment and is used if set; then doing:

WGETOPTS="--quiet" debootstrap ...

stops the wget-log files being written.

-- System Information:
Debian Release: 12.1
  APT prefers stable-updates
  APT policy: (500, 'stable-updates'), (500, 'stable-security'), (500, 
'stable-debug'), (500, 'proposed-updates-debug'), (500, 'stable')
Architecture: amd64 (x86_64)
Foreign Architectures: i386

Kernel: Linux 6.5.0+debian+tj (SMP w/16 CPU threads; PREEMPT)
Kernel taint flags: TAINT_OOT_MODULE, TAINT_UNSIGNED_MODULE
Locale: LANG=en_GB.UTF-8, LC_CTYPE=en_GB.UTF-8 (charmap=UTF-8), 
LANGUAGE=en_GB:en
Shell: /bin/sh linked to /usr/bin/dash
Init: systemd (via /run/systemd/system)
LSM: AppArmor: enabled

Versions of packages debootstrap depends on:
ii  wget  1.21.3-1+b2

Versions of packages debootstrap recommends:
ii  arch-test               0.20-1
ii  debian-archive-keyring  2023.3
ii  gnupg                   2.2.40-1.1

Versions of packages debootstrap suggests:
ii  binutils                2.40-2
pn  squid-deb-proxy-client  <none>
pn  ubuntu-archive-keyring  <none>
ii  xz-utils                5.4.1-0.2
ii  zstd                    1.5.4+dfsg2-5
--- a/functions 2022-10-18 23:48:32.000000000 +0100
+++ b/functions 2023-08-28 15:22:43.525204579 +0100
@@ -94,7 +94,7 @@
                ret=$({ { wget $@ 2>&1 >/dev/null || echo $? >&2; } | 
"$PKGDETAILS" "WGET%" "$PROGRESS_NOW" "$PROGRESS_NEXT" "$PROGRESS_END" >&3; } 
2>&1)
                : ${ret:=0}
        else
-               wget ${NVSWITCH:+"$NVSWITCH"} "$@"
+               wget ${WGETOPTS:-"${NVSWITCH}"} "$@"
                ret=$?
        fi
        return $ret

Reply via email to