Package: lzma
Version: 25.00+dfsg-1
Control: found -1 24.08+dfsg-2
Control: affects -1 depthcharge-tools
X-Debbugs-CC: [email protected]

Hi,

The lzma executable from the lzma package (vs. xz-utils) returns zero
exit status when decompressing some files not compressed by lzma, even
when such decompression results in no output. The specific case I'm
interested in is:

  $ lzma -dc "/boot/vmlinuz-$(uname -r)"; echo $?
  0

  $ lzma -t "/boot/vmlinuz-$(uname -r)" && echo "yes"
  yes

It looks like it's about zeros:

  $ head -c18 "/boot/vmlinuz-$(uname -r)" | xxd
  00000000: 4d5a 0000 0000 0000 0000 0000 0000 0000  MZ..............
  00000010: 0000                                     ..

  # fails with -c17
  $ head -c18 "/boot/vmlinuz-$(uname -r)" | lzma -d; echo $?
  0

  $ head -c18 "/dev/zero" | lzma -d; echo $?
  0

I'm not sure if this is actually a valid lzma file, but xz and zstd
(with their lzma support) seem to reject it as I expected lzma should:

  $ xz --format=lzma -dc "/boot/vmlinuz-$(uname -r)"; echo $?
  xz: /boot/vmlinuz-7.1.8+deb14.1-amd64: File format not recognized
  1

  # --format=* doesn't seem to take effect here, but still
  $ zstd --format=lzma -dc "/boot/vmlinuz-$(uname -r)"; echo $?
  zstd: /boot/vmlinuz-7.1.8+deb14.1-amd64: unsupported format
  1

I was using the exit status with many decompressors to get the actual
kernel file from a potentially unknown-compressed file so I can do
bootloader stuff in depthcharge-tools, I'll have to actually check the
decompressed size for robustness...


-- System Information:
Debian Release: forky/sid
  APT prefers buildd-unstable
  APT policy: (500, 'buildd-unstable'), (500, 'unstable'), (1, 'experimental')
Architecture: amd64 (x86_64)
Foreign Architectures: arm64, armhf, i386

Kernel: Linux 7.1.8+deb14.1-amd64 (SMP w/8 CPU threads; PREEMPT)
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 lzma depends on:
ii  libc6       2.43-3
ii  libgcc-s1   16.2.0-1
ii  libstdc++6  16.2.0-1

lzma recommends no packages.

lzma suggests no packages.

-- no debconf information

Reply via email to