lzip-bug
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Writing de/compressed data to a terminal policy


From: Ángel
Subject: Re: Writing de/compressed data to a terminal policy
Date: Mon, 10 Feb 2025 00:10:27 +0100

On 2025-02-02 at 23:06 +0100, wrotycz wrote:
> I also and discovered that although lzip does not allow to compress
> to terminal but it does allow to decompress into terminal. Which is
> inconsistent, and not good in general imo.

This makes sense and (because of that) is what other programs are
doing.

Say I do:

$ echo Hello world | lzip
lzip: I won't write compressed data to a terminal.

Why so? lzip output in this case is binary data, which is (99%) useless
output on a user terminal, ranging from bytes that won't be
representable (e.g. 01 0c 00…) to actually changing terminal settings
to the user and breaking their terminal.

Usage of a compressing lzip with the output being a terminal is
probably missing a -o <filename>  or > <filename>


Compare that to uncompressing a file directly on the terminal:
$ < hello.lz lzip -d
Hello world


There it can be useful to show the contents directly (assuming the
compressed contentsa were of textual nature)



The issue about nul being wrongly detected as a tty in Windows seems a
bug in whatever is providing the isatty() being used by your program
(this may vary depending on the CRT being used).





reply via email to

[Prev in Thread] Current Thread [Next in Thread]