From 8af7db854f903068d72a9a0d21103cb0c5027fa8 Mon Sep 17 00:00:00 2001 From: Lasse Collin Date: Tue, 13 Feb 2024 14:32:47 +0200 Subject: 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 --- src/xz/list.c | 16 ++++++++++++++-- 1 file 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) { -- cgit v1.2.3