Package: mmdebstrap
Version: 0.7.5-2.2
Severity: minor

mmdebstrap's approx_disk_usage calls File::Find find(), which
for some reason cares about the permissions of $PWD.
This is the case even when writing the .ext2 somewhere else.

    bash5$ mkdir /tmp/a
    bash5$ cd /tmp/a
    bash5$ mmdebstrap sid /tmp/b.ext2 --quiet
    copying from tar archive -
    copying from tar archive -
    bash5$ ls -lh /tmp/b.ext2
    -rw-r--r-- 1 twb twb 306M 2022-02-16 16:11 /tmp/b.ext2

    bash5$ chmod 0700 .
    bash5$ pwd
    /tmp/a
    bash5$ mmdebstrap sid /tmp/b.ext2 --quiet
    copying from tar archive -
    Can't cd to /tmp/a: Permission denied
    Use of uninitialized value $numblocks in chomp at /usr/bin/mmdebstrap line 
5607.
    Use of uninitialized value $numblocks in numeric le (<=) at 
/usr/bin/mmdebstrap line 5636.
    Use of uninitialized value $numblocks in concatenation (.) or string at 
/usr/bin/mmdebstrap line 5637.
    bash5$ ls -lh /tmp/b.ext2
    -rw-r--r-- 1 twb twb 0 2022-02-16 16:12 /tmp/b.ext2

It looks like File::Find has a "no_chdir" argument.
Maybe you just need to pass that?

    
https://sources.debian.org/src/perl/5.34.0-3/ext/File-Find/lib/File/Find.pm/#L282
    
https://sources.debian.org/src/perl/5.34.0-3/ext/File-Find/lib/File/Find.pm/#L273

I guess this is happening because approx_disk_usage runs inside an unshare(2)'d 
context.
So the other option might be to shuffle things around so it runs with full 
privileged.
But that is probably deeply painful and messy.

I would be happy with just having an earlier error message (i.e. before apt), 
like

    if (!$options->{dryrun} && $format eq 'ext2')
        if( <$PWD is not at least 0555> )
          die "ext2 output needs world-read/execute permissions on $PWD";


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

Kernel: Linux 5.14.0-0.bpo.2-amd64 (SMP w/8 CPU threads)
Kernel taint flags: TAINT_PROPRIETARY_MODULE, TAINT_OOT_MODULE, 
TAINT_UNSIGNED_MODULE
Locale: LANG=en_AU.UTF-8, LC_CTYPE=en_AU.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 mmdebstrap depends on:
ii  apt      2.2.4
ii  perl     5.32.1-4+deb11u2
ii  python3  3.9.2-3

Versions of packages mmdebstrap recommends:
ii  arch-test            0.17-1
ii  fakechroot           2.19-3.3
ii  fakeroot             1.25.3-1.1
ii  gpg                  2.2.27-2
ii  libdistro-info-perl  1.0
ii  mount                2.36.1-8+deb11u1
ii  uidmap               1:4.8.1-1

Versions of packages mmdebstrap suggests:
ii  apt [apt-transport-https]  2.2.4
pn  apt-transport-tor          <none>
pn  apt-utils                  <none>
ii  binfmt-support             2.2.1-1
ii  ca-certificates            20210119
ii  debootstrap                1.0.123
ii  distro-info-data           0.51+deb11u1
ii  dpkg-dev                   1.20.9
ii  perl-doc                   5.32.1-4+deb11u2
pn  proot                      <none>
ii  qemu-user                  1:5.2+dfsg-11+deb11u1
ii  qemu-user-static           1:5.2+dfsg-11+deb11u1
ii  squashfs-tools-ng          1.0.4-1

-- no debconf information

Reply via email to