Subject: lz4: redirecting stdout to /dev/null changes program behaviour

From: Witold Baryluk <[email-masked]>
Date: Mon, 01 Nov 2021 00:04:05 +0000

Package: lz4
Version: 1.9.3-2
Severity: important
X-Debbugs-Cc: [email-masked]

Running

lz4 --quiet --keep input.file.txt

will produce input.file.txt.lz4

lz4 --quiet --keep input.file.txt >/dev/null

will instead print this on stderr:

Warning : using stdout as default output. Do not rely on this behavior: use explicit `-c` instead ! 

and produces no compressed file.

This is behaviour different than all compression tools (gzip, bzip2,
lzma, xz, brotli, arj, 7z, zip, cab, snappy, zstd, ...).

Stdout should only be used when `-c` is expliclty passed, or the input is
the stdout (i.e. foo | lz4 | ...).

Regards,
Witold

-- System Information:
Debian Release: bookworm/sid
  APT prefers testing
  APT policy: (500, 'testing')
Architecture: amd64 (x86_64)
Foreign Architectures: i386

Kernel: Linux 5.15.0-rc7 (SMP w/32 CPU threads; PREEMPT)
Kernel taint flags: TAINT_UNSIGNED_MODULE
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8), LANGUAGE not set
Shell: /bin/sh linked to /usr/bin/dash
Init: systemd (via /run/systemd/system)

Versions of packages lz4 depends on:
ii  libc6     2.32-4
ii  liblz4-1  1.9.3-2

lz4 recommends no packages.

lz4 suggests no packages.

-- no debconf information