From db77fd5a0c193a25b56d808d1f3d8ee1cc50968b Mon Sep 17 00:00:00 2001 From: slowpeek Date: Tue, 9 Jul 2024 15:58:39 +0300 Subject: [PATCH] Ticket #4559: extfs: u7z: bug with nested dirs in mkdir action. The -w option sets the working directory for the temporary archive 7-zip builds when modifying an existing one. The option cant be used to set the base path inside an archive when adding something into it. When adding something to a 7z archive by its absolute path, 7zip only uses the last part of the path by default. E.g. `7z a 1.7z /tmp/a/b/date.txt` would add date.txt to the root dir inside the archive. If we wanted the file to be under `a/b/` inside the archive as well, it should be `7z a 1.7z /tmp/a`. Closes MidnightCommander/mc#202. Signed-off-by: Andrew Borodin --- src/vfs/extfs/helpers/u7z | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/vfs/extfs/helpers/u7z b/src/vfs/extfs/helpers/u7z index 91301c3d9..d59d92f3e 100755 --- a/src/vfs/extfs/helpers/u7z +++ b/src/vfs/extfs/helpers/u7z @@ -86,7 +86,7 @@ mcu7zip_mkdir () { dir=`mktemp -d "${MC_TMPDIR:-/tmp}/mctmpdir-u7z.XXXXXX"` || exit 1 mkdir -p "$dir"/"$2" - $P7ZIP a -w"$dir" "$1" "$dir"/"$2" >/dev/null 2>&1 + $P7ZIP a "$1" "$dir/${2%%/*}" >/dev/null 2>&1 rm -rf "$dir" }