Your message dated Tue, 21 Sep 2021 17:04:02 +0000
with message-id <[email protected]>
and subject line Bug#985830: fixed in mmdebstrap 0.8.0-1
has caused the Debian Bug report #985830,
regarding mmdebstrap: optimize /dev/null output
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.)


-- 
985830: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=985830
Debian Bug Tracking System
Contact [email protected] with problems
--- Begin Message ---
Package: mmdebstrap
Version: 0.7.5-2
Severity: wishlist
File: /usr/bin/mmdebstrap
Tags: patch upstream

Hi josch,

I noticed that asking mmdebstrap to output to /dev/null can be a
reasonably common thing to do when the desired artifact resides inside
the chroot and is transferred via special hooks. Indeed, I think it is
so common that mmdebstrap should optimize this use case by skipping the
tar creation. To that end, I propose adding a new --format called
"null", which is automatically selected when the target is literally
"/dev/null". I'm attaching a patch with my implementation.

Helmut
--- a/mmdebstrap
+++ b/mmdebstrap
@@ -4384,7 +4384,8 @@
     if ($format eq 'dir') {
         $format = 'directory';
     }
-    my @valid_formats = ('auto', 'directory', 'tar', 'squashfs', 'ext2');
+    my @valid_formats = ('auto', 'directory', 'tar', 'squashfs', 'ext2',
+        'null');
     if (none { $_ eq $format } @valid_formats) {
         error "invalid format. Choose from " . (join ', ', @valid_formats);
     }
@@ -5086,7 +5087,9 @@
 
     # figure out the right format
     if ($format eq 'auto') {
-        if ($options->{target} ne '-' and -d $options->{target}) {
+        if ($options->{target} eq '/dev/null') {
+            $format = 'null';
+        } elsif ($options->{target} ne '-' and -d $options->{target}) {
             $format = 'directory';
         } elsif (
             defined $tar_compressor
@@ -5157,30 +5160,32 @@
         info "automatically chosen format: $format";
     }
 
-    if ($options->{target} eq '-' and $format ne 'tar') {
+    if ($options->{target} eq '-' and $format ne 'tar' and $format ne 'null') {
         error "the $format format is unable to write to standard output";
     }
 
-    if (any { $_ eq $format } ('tar', 'squashfs', 'ext2')) {
-        if (      any { $_ eq $options->{variant} } ('extract', 'custom')
-              and any { $_ eq $options->{mode} } ('fakechroot', 'proot')) {
-            info "creating a tarball or squashfs image or ext2 image in"
-              . " fakechroot mode or proot mode might fail in extract and"
-              . " custom variants because there might be no tar inside the"
-              . " chroot";
-        }
-        # try to fail early if target tarball or squashfs image cannot be
-        # opened for writing
-        if ($options->{target} ne '-') {
-            if ($options->{dryrun}) {
-                if (-e $options->{target}) {
-                    info "not overwriting $options->{target} because in"
-                      . " dry-run mode";
+    if (any { $_ eq $format } ('tar', 'squashfs', 'ext2', 'null')) {
+        if ($format ne 'null') {
+            if (      any { $_ eq $options->{variant} } ('extract', 'custom')
+                  and any { $_ eq $options->{mode} } ('fakechroot', 'proot')) {
+                info "creating a tarball or squashfs image or ext2 image in"
+                  . " fakechroot mode or proot mode might fail in extract and"
+                  . " custom variants because there might be no tar inside the"
+                  . " chroot";
+            }
+            # try to fail early if target tarball or squashfs image cannot be
+            # opened for writing
+            if ($options->{target} ne '-') {
+                if ($options->{dryrun}) {
+                    if (-e $options->{target}) {
+                        info "not overwriting $options->{target} because in"
+                          . " dry-run mode";
+                    }
+                } else {
+                    open my $fh, '>', $options->{target}
+                      or error "cannot open $options->{target} for writing: $!";
+                    close $fh;
                 }
-            } else {
-                open my $fh, '>', $options->{target}
-                  or error "cannot open $options->{target} for writing: $!";
-                close $fh;
             }
         }
         # since the output is a tarball, we create the rootfs in a temporary
@@ -5332,7 +5337,7 @@
               = sprintf("%06o\0", unpack("%16C*", $entry));
             $devtar .= $entry;
         }
-    } elsif ($format eq 'directory') {
+    } elsif (any { $_ eq $format } ('directory', 'null')) {
         # nothing to do
     } else {
         error "unknown format: $format";
@@ -5435,7 +5440,7 @@
                       or error "tar failed: $?";
 
                     info "done";
-                } elsif ($format eq 'directory') {
+                } elsif (any { $_ eq $format } ('directory', 'null')) {
                     # nothing to do
                 } else {
                     error "unknown format: $format";
@@ -5537,7 +5542,7 @@
                 }
 
                 info "done";
-            } elsif ($format eq 'directory') {
+            } elsif (any { $_ eq $format } ('directory', 'null')) {
                 # nothing to do
             } else {
                 error "unknown format: $format";
@@ -5608,7 +5613,7 @@
 
     if ($options->{dryrun}) {
         # nothing to do
-    } elsif ($format eq 'directory') {
+    } elsif (any { $_ eq $format } ('directory', 'null')) {
         # nothing to do
     } elsif (any { $_ eq $format } ('tar', 'squashfs', 'ext2')) {
         # we use eval() so that error() doesn't take this process down and
@@ -5706,7 +5711,7 @@
     # change signal handler message
     $waiting_for = "cleanup";
 
-    if ($format eq 'directory') {
+    if (any { $_ eq $format } ('directory', 'null')) {
         # nothing to do
     } elsif (any { $_ eq $format } ('tar', 'squashfs', 'ext2')) {
         if (!-e $options->{root}) {
@@ -5894,8 +5899,8 @@
 =item B<--format>=I<name>
 
 Choose the output format. Valid format I<name>s are B<auto>, B<directory>,
-B<tar>, B<squashfs>, and B<ext2>. The default format is B<auto>. See the
-section B<FORMATS> for more information.
+B<tar>, B<squashfs>, B<ext2> and B<null>. The default format is B<auto>. See
+the section B<FORMATS> for more information.
 
 =item B<--aptopt>=I<option>|I<file>
 
@@ -6331,7 +6336,8 @@
 
 When selecting this format (the default), the actual format will be inferred
 from the I<TARGET> positional argument. If I<TARGET> was not specified, then
-the B<tar> format will be chosen. If I<TARGET> is an existing directory, and
+the B<tar> format will be chosen. If I<TARGET> happens to be F</dev/null>, then
+the B<null> format will be chosen. If I<TARGET> is an existing directory, and
 does not equal to C<->, then the B<directory> format will be chosen. If
 I<TARGET> ends with C<.tar> or with one of the filename extensions listed in
 the section B<COMPRESSION>, or if I<TARGET> equals C<->, or if I<TARGET> is a
@@ -6387,6 +6393,14 @@
 extents,uninit_bg,dir_index,has_journal TARGET>. Since C<genext2fs> does not
 support extended attributes, the resulting image will not contain them.
 
+=item B<null>
+
+A temporary chroot directory will be created in C<$TMPDIR> or F</tmp> if
+C<$TMPDIR> is not set. After the bootstrap is complete, the temporary chroot
+will be deleted without being part of the output. This is most useful when the
+desired artifact is generated inside the chroot and it is transferred using
+special hooks such as B<sync-out>.
+
 =back
 
 =head1 HOOKS

--- End Message ---
--- Begin Message ---
Source: mmdebstrap
Source-Version: 0.8.0-1
Done: Johannes Schauer Marin Rodrigues <[email protected]>

We believe that the bug you reported is fixed in the latest version of
mmdebstrap, 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.
Johannes Schauer Marin Rodrigues <[email protected]> (supplier of updated 
mmdebstrap 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: Tue, 21 Sep 2021 18:44:07 +0200
Source: mmdebstrap
Architecture: source
Version: 0.8.0-1
Distribution: unstable
Urgency: medium
Maintainer: Johannes Schauer Marin Rodrigues <[email protected]>
Changed-By: Johannes Schauer Marin Rodrigues <[email protected]>
Closes: 914915 983293 983301 985830 988271 989302 989487
Changes:
 mmdebstrap (0.8.0-1) unstable; urgency=medium
 .
   * new upstream release
      - document how to setup merged /usr via symlinks (closes: #914915)
      - fix testsuite (closes: #983293)
      - fix chrootless mode (closes: #983301)
      - add mmtarfilter --pax-exclude (closes: #989487)
      - fix busybox-based chroot example (closes: #989302)
      - optimize /dev/null output (closes: #985830)
      - use all cores when compressing with zstd (closes: #988271)
      - move /usr/share/mmdebstrap/hooks/setup00-merged-usr.sh to
        /usr/share/mmdebstrap/hooks/merged-usr/setup00.sh
   * drop patches
   * debian/rules: install gpgvnoexpkeysig and ldconfig.fakechroot
   * debian/watch: fix for gitea
   * debian/control: document dependencies
Checksums-Sha1:
 110e4535ef54a9367a575135351c792668b51d9f 2313 mmdebstrap_0.8.0-1.dsc
 931c4fcb5d5068d36eed9b2d8eb6e305936e864d 111041 mmdebstrap_0.8.0.orig.tar.gz
 e6bd6bbb6f8e51ef6fd23532bfd6b522df5292df 10864 mmdebstrap_0.8.0-1.debian.tar.xz
Checksums-Sha256:
 b88983121e04d8d2340abe472b8d96c896c317c582c790e04af97716b588662b 2313 
mmdebstrap_0.8.0-1.dsc
 aec81418dda3e664bc381f7767c830c8dbcb64ffcdc179fcbee85ef68c739be4 111041 
mmdebstrap_0.8.0.orig.tar.gz
 9fe6564d47947f05014ef198bd830dd6dc6db1a9a670644bec244affa3931350 10864 
mmdebstrap_0.8.0-1.debian.tar.xz
Files:
 bafe7f1296cb2854c82f854cd0db1d9c 2313 admin optional mmdebstrap_0.8.0-1.dsc
 c9625231ed4c817796ebe03c5bfda292 111041 admin optional 
mmdebstrap_0.8.0.orig.tar.gz
 7ac948e704af6ef85989888775a572c9 10864 admin optional 
mmdebstrap_0.8.0-1.debian.tar.xz

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

iQIzBAEBCgAdFiEElFhU6KL81LF4wVq58sulx4+9g+EFAmFKDOkACgkQ8sulx4+9
g+Gmpg//cfot2vrsLMD8SLAUdTy+cdpciK4IBO1Iol438g22GEfxBxv3COGsqI3G
AWfydipT+o+u0MW8b6opleZa0hBwmYhqNu44Kkbs9sitPSMCnCu8LMj/dHA5wEva
YGQ/zAkbuO0QIIcVlRjUyimFu2RmcgTBChAzE+K1h1Zlqr9sBbekcyOic2hLVerv
dzw+jrCs2sF9dLMtO2xvojseSxqlHAfMitFlpUFvgH9x6EtcEXSCH/n0MsvPDUEu
QtfeeZKdDhIyC3ueIdmnwzYQ+805fohCKcAJ7wEqPQnshVxX0ady4I4mg1cS8feY
Z33+5qEAkp/gtbH4sSroUeoRmem+pITUjfcvHYfl4W4Lhzuio/1Dyr7LLztGv4Jo
nnupfT4zgbY9LD2ZMm0RVaKAX+OBk1Yqo+yI1lyb5ZXSxT/IeqzgT4yfmkc05pRB
wtvRNt+xdhv8U71B9ILO9NF1DiSysN1rQGKFsklEG72HCNY5F4TgTLkkxdBjILRx
96xSpwKP2GuFs88BThrA3yZ2E0Pw2w71s0mi1tHywMqke518bLZbIZDGopZ5ZXGJ
nb99OGfVWNttSfapF8VluwqU5UPythkhsAAa7JZe+zV8qMgthYgU7pQnlYZ2zY5/
aSyy0Lzlnu3L7v8u6hMw1TWJBJWAwmh4EhK6dbryywj5yznqM78=
=PJkP
-----END PGP SIGNATURE-----

--- End Message ---

Reply via email to