Skip to content

zstdless vs less inconsistencies #2880

@JustAnotherArchivist

Description

@JustAnotherArchivist

Describe the bug
zstdless handles all options with zstdcat, not allowing anything to be passed to less.

To Reproduce
Steps to reproduce the behavior:

  1. echo foo | zstd -o foo.zst
  2. zstdless +/foo foo.zst (to search directly for foo) → zstd: can't stat +/foo: No such file or directory -- ignored (on stderr, only visible after less is closed)
  3. zstdless -N foo.zstIncorrect parameters
  4. cat foo.zst | zstdless +/foo (imagine the cat were actually a curl or similar) → as 2.

Expected behavior
I'd expect the same behaviour as zless, which does pass such options on to less. However, zstd options may be needed for decompressing the zstd file in the first place, e.g. -D to specify a dictionary, and some of these collide with ones from less, e.g. -M. gzip's zless does not have this problem because it doesn't have any relevant options.

Not sure whether there is a good solution to this problem. I'm also not sure whether it'd be more common to pass zstd options or less options to zstdless; otherwise, the user could be instructed to use an explicit zstdcat | less for the less common one. Backward compatibility may be another concern since everything is passed to zstdcat currently. If this behaviour is the desired one, that should at least be documented clearly on the man page though.

Additional context
Similar to the zstdgrep inconsistencies at #2064

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions