aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorLasse Collin <lasse.collin@tukaani.org>2024-02-13 14:32:47 +0200
committerLasse Collin <lasse.collin@tukaani.org>2024-02-14 18:31:16 +0200
commit8af7db854f903068d72a9a0d21103cb0c5027fa8 (patch)
tree1b40b467a45070b525943030d6346da37a8b85e1 /src
parentliblzma: Add comments. (diff)
downloadxz-8af7db854f903068d72a9a0d21103cb0c5027fa8.tar.xz
xz: Mention lzmainfo if trying to use 'lzma --list'.
This kind of fixes the problem reported here: https://bugs.launchpad.net/ubuntu/+source/xz-utils/+bug/1291020
Diffstat (limited to 'src')
-rw-r--r--src/xz/list.c16
1 files changed, 14 insertions, 2 deletions
diff --git a/src/xz/list.c b/src/xz/list.c
index 6c1167ba..ca9cf03e 100644
--- a/src/xz/list.c
+++ b/src/xz/list.c
@@ -1275,10 +1275,22 @@ list_totals(void)
extern void
list_file(const char *filename)
{
- if (opt_format != FORMAT_XZ && opt_format != FORMAT_AUTO)
- message_fatal(_("--list works only on .xz files "
+ if (opt_format != FORMAT_XZ && opt_format != FORMAT_AUTO) {
+ // The 'lzmainfo' message is printed only when --format=lzma
+ // is used (it is implied if using "lzma" as the command
+ // name). Thus instead of using message_fatal(), print
+ // the messages separately and then call tuklib_exit()
+ // like message_fatal() does.
+ message(V_ERROR, _("--list works only on .xz files "
"(--format=xz or --format=auto)"));
+ if (opt_format == FORMAT_LZMA)
+ message(V_ERROR,
+ _("Try 'lzmainfo' with .lzma files."));
+
+ tuklib_exit(E_ERROR, E_ERROR, false);
+ }
+
message_filename(filename);
if (filename == stdin_filename) {