From 255f8684a1bc33f7a8f540287a45558c6dfe588a Mon Sep 17 00:00:00 2001 From: Benjamin Lupton Date: Fri, 1 Sep 2023 14:53:28 +0800 Subject: [PATCH] unziptar: more better debugging when extraction fails --- commands/unziptar | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/commands/unziptar b/commands/unziptar index f3bcbdae4..0b796b92b 100755 --- a/commands/unziptar +++ b/commands/unziptar @@ -199,6 +199,12 @@ function unziptar() ( echo-error 'No extracted files matched the filter:' echo-style --bold='Archive:' ' ' "$(file "$archive")" echo-style --bold='Filter:' ' ' "$filter" + echo-style --bold='File:' ' ' "$file" + echo-style --bold='-- expanded paths --' + expand-path "$archive_directory/$filter" + echo-style --bold='-- filtered paths --' + echo-verbose "${filtered_paths[@]}" + echo-style --bold='-- ls --' ls -la "$archive_directory" } >/dev/stderr return 1 @@ -221,12 +227,16 @@ function unziptar() ( # was only one intended? if test -n "$file"; then { - echo-error ' was not possible, multiple files would have been relocated:' + echo-error 'Too many extracted files matched the filter:' + echo-style --bold='Archive:' ' ' "$(file "$archive")" + echo-style --bold='Filter:' ' ' "$filter" + echo-style --bold='File:' ' ' "$file" + echo-style --bold='-- expanded paths --' + expand-path "$archive_directory/$filter" + echo-style --bold='-- filtered paths --' echo-verbose "${filtered_paths[@]}" - print_line "directory=[$directory]" - print_line "file=[$file]" - print_line "filepath=[$filepath]" - print_line "archive=[$archive]" + echo-style --bold='-- ls --' + ls -la "$archive_directory" } >/dev/stderr return 1 fi