Hi,

Quoting Julien Puydt (2024-12-05 17:17:14)
> I updated my chroot two hours ago ; then I couldn't use it anymore, so I
> tried to update it again :
> 
> $ sbuild-update --chroot-mode=unshare --update --dist-upgrade --
> autoremove -d unstable
> Use of uninitialized value $dist in pattern match (m//) at
> /usr/share/perl5/Sbuild/ChrootUnshare.pm line 168.
> Use of uninitialized value $dist in pattern match (m//) at
> /usr/share/perl5/Sbuild/ChrootUnshare.pm line 168.
> Use of uninitialized value $dist in concatenation (.) or string at
> /usr/share/perl5/Sbuild/ChrootUnshare.pm line 188.
> I: Unpacking /home/jpuydt/.cache/sbuild/unstable-amd64.tar.zst to
> /tmp/tmp.sbuild.PlufuvF3vB...
> zstd: /*stdin*\: unsupported format 
> tar: Child returned status 1
> tar: Error is not recoverable: exiting now
> bad exit status (2): /usr/libexec/sbuild-usernsexec u:0:100000:65536
>  g:0:100000:65536
>  -- tar --exclude=./dev/urandom --exclude=./dev/random --
> exclude=./dev/full --exclude=./dev/null --exclude=./dev/console --
> exclude=./dev/zero --exclude=./dev/tty --exclude=./dev/ptmx --directory
> /tmp/tmp.sbuild.PlufuvF3vB --extract --zstd
> Error setting up unstable chroot
> Chroot setup failed at /usr/bin/sbuild-update line 145.
> 
> From the error message, I would say something isn't a valid zstd file
> but:
> $ file /home/jpuydt/.cache/sbuild/unstable-amd64.tar.zst
> /home/jpuydt/.cache/sbuild/unstable-amd64.tar.zst: Zstandard compressed
> data (v0.8+), Dictionary ID: None
> 
> 
> So I'm a bit at loss as to why things are broken.

my hunch is this part of the zstd manual page:

>   ○   -f, --force: disable input and output checks. Allows overwriting
>       existing files, input from console, output to stdout,  operating
>       on  links, block devices, etc. During decompression and when the
>       output destination is stdout, pass-through unrecognized  formats
>       as-is.

Sbuild does not pass the --force parameter when it passes data to extract to
the zstd utility.

In your /usr/share/perl5/Sbuild/ChrootUnshare.pm, can you try applying this
patch:

--- a/usr/share/perl5/Sbuild/ChrootUnshare.pm
+++ b/usr/share/perl5/Sbuild/ChrootUnshare.pm
@@ -517,7 +517,7 @@ sub begin_session {
             } elsif ("\xFD7zXZ" eq substr $chunk, 0, 5) {
                 @decompress = ('xz', '--decompress', '--stdout');
             } elsif ("\x28\xB5\x2F\xFD" eq substr $chunk, 0, 4) {
-                @decompress = ('zstd', '--decompress', '--stdout');
+                @decompress = ('zstd', '--decompress', '--stdout', '--force');
             } elsif ("\x04\x22\x4d\x18" eq substr $chunk, 0, 4) {
                 # tar does not seem to support lz4 magic, but we do
                 @decompress = ('lz4', '--decompress', '--stdout');


Should that be the problem, we could add the --force flag and call it a day.
But as its name implies, the --force flag is doing more things than just allow
reading data from standard input (see above). Why does zstd need --force for
such a task while all other compressors do not? Sounds like a bug?

Thanks!

cheers, josch

Attachment: signature.asc
Description: signature

Reply via email to