TIP: Click on subject to list as thread! ANSI
echo: mystic
to: g00r00
from: Bjrn Wiberg
date: 2021-08-06 00:54:00
subject: Re: Unpack Cmd `%2` and p

Hello again, g00r00!

On 05 Aug 2021, Bj”rn Wiberg said the following...
 BW> Tested viewing, (D)ownloading file from inside archive (including some
 BW> "tricks"
 BW> there which appear to be handled correctly now) and also downloading a 

The only "bad" thing I noticed is that the automatic "basenaming" (stripping path info from the entered filename) of "%2" for the Unpack Cmd can make it hard to perform archive member (file) selection for certain archivers.

For instance, tar requires the "correct" (full) path of a file within an archive to be entered when selecting files for extraction.

For example:

$ tar tf ../test2.tar
atest2.txt
test1.txt
subdir/
subdir/btest2.txt
subdir/test2.txt

$ tar -xvf /tmp/test2.tar -C /tmp/bw2/ --xform='s,.*/,,' --overwrite -- "test2.txt"
tar: test2.txt: Not found in archive
tar: Exiting with failure status due to previous errors

$ tar -xvf /tmp/test2.tar -C /tmp/bw2/ --xform='s,.*/,,' --overwrite -- "subdir/test2.txt"
subdir/test2.txt

One can enable wildcards, but it will be a "sloppy" match, selecting more than desired:

$ tar -xvf /tmp/test2.tar -C /tmp/bw2/ --xform='s,.*/,,' --overwrite --wildcards -- "*test2.txt"
atest2.txt
subdir/btest2.txt
subdir/test2.txt

This will potentially leave a bunch of similarly named files from within the archive left over in the temp* directory, as only the file name entered will be deleted by Mystic...

The --xform=... option does wonders, however, when it comes to junking paths for the extracted files (if one managed to extract any files). The result of the wildcard extraction above is:

$ ls -1
atest2.txt
btest2.txt
test2.txt

The tar example with the sloppy match (so far) in Mystic is:

    Extension ³ TAR
           OS ³ Linux
  Description ³ GNU tar
     Pack Cmd ³ { cd "$(dirname "%2")" && tar -c -f "%1" -- $(basename "%2"); }
   Unpack Cmd ³ tar -x -f "%1" -C "%3" --xform='s,.*/,,' --overwrite --wildcards -- "*%2"
     View Cmd ³ { tar -t -f "%1" -v --full-time -- >> "%3%2"; }

Best regards
Bj”rn

--- Mystic BBS v1.12 A47 2021/08/05 (Linux/64)
                                                          
* Origin: Star Collision BBS, Uppsala, Sweden (2:201/137)

SOURCE: echomail via QWK@pharcyde.org

Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.