• ZIP archiver argument quoting?

    From Björn Wiberg@2:201/137 to g00r00 on Tue Aug 3 23:59:16 2021
    Hello g00r00!

    Another very small thing regarding the archivers --
    I noticed that the Pack and Unpack Cmds for ZIP look like:

    Pack Cmd ³ zip -qj9 %1 %2
    Unpack Cmd ³ unzip -oqqjC "%1" "%2" -d %3

    Shouldn't these % variables all be quoted? Like:

    Pack Cmd ³ zip -qj9 "%1" "%2"
    Unpack Cmd ³ unzip -oqqjC "%1" "%2" -d "%3"

    ...to be on the safe side? It seems to be that way for the other archivers.

    Just a thought. =)

    Best regards
    Bj”rn
    --- Mystic BBS v1.12 A47 2021/07/31 (Linux/64)
    * Origin: Star Collision BBS, Uppsala, Sweden (2:201/137)
  • From Björn Wiberg@2:201/137 to g00r00 on Wed Aug 4 13:02:10 2021
    Hello again, g00r00!

    'On 03 Aug 2021, Bj”rn Wiberg said the following...
    Shouldn't these % variables all be quoted? Like:

    Pack Cmd ³ zip -qj9 "%1" "%2"
    Unpack Cmd ³ unzip -oqqjC "%1" "%2" -d "%3"

    ...to be on the safe side? It seems to be that way for the other archivers.

    To answer myself -- no, not for %2 in the Pack Cmd, as Mystic uses wildcards when compressing e.g. the file lists, which would then become verbatim, and zip won't perform any wildcard expansion on its own.

    But this should be as OK as possible:

    Pack Cmd ³ zip -qj9 "%1" %2
    Unpack Cmd ³ unzip -oqqjC "%1" "%2" -d "%3"

    Best regards
    Bj”rn
    --- Mystic BBS v1.12 A47 2021/07/31 (Linux/64)
    * Origin: Star Collision BBS, Uppsala, Sweden (2:201/137)
  • From g00r00@1:129/215 to Björn Wiberg on Wed Aug 4 11:50:04 2021
    Shouldn't these % variables all be quoted? Like:

    Pack Cmd ³ zip -qj9 "%1" "%2"
    Unpack Cmd ³ unzip -oqqjC "%1" "%2" -d "%3"

    ...to be on the safe side? It seems to be that way for the other archivers.

    Yeah it probably should be I don't know if there was a reason just the "zip" command doesn't have it or if I just missed it. Probably the latter so I will update it and we'll see if anything breaks.

    Thanks!

    ... Running Windows is better than washing them!

    --- Mystic BBS v1.12 A47 2021/07/31 (Windows/64)
    * Origin: Sector 7 * Mystic WHQ (1:129/215)
  • From Björn Wiberg@2:201/137 to g00r00 on Wed Aug 4 19:04:58 2021
    Hello g00r00!

    Thank you for your reply!

    On 04 Aug 2021, g00r00 said the following...
    Yeah it probably should be I don't know if there was a reason just the "zip" command doesn't have it or if I just missed it. Probably the
    latter so I will update it and we'll see if anything breaks.

    Sorry, my fault (see one of my later replies) -- the Pack Cmd on Linux must have %2 unquoted as zip on that platform does not perform its own wildcard expansion. If quoted, compression of the file list for example will fail (it will look for a file named "/home/bbs/mystic/tempX/*" i.e. a with a literal *... Sadly.

    Let's hope no one uses paths with spaces for their Mystic installation. :)

    But the other unquoted ones (%1, %3) can and should probably be quoted.

    Best regards
    Bj”rn
    --- Mystic BBS v1.12 A47 2021/07/31 (Linux/64)
    * Origin: Star Collision BBS, Uppsala, Sweden (2:201/137)
  • From g00r00@1:129/215 to Björn Wiberg on Thu Aug 5 11:14:02 2021
    Sorry, my fault (see one of my later replies) -- the Pack Cmd on Linux must have %2 unquoted as zip on that platform does not perform its own

    I am going to hold off on any more updates until we are using the version with the ">" added to the execution on the Linux side.

    Update the latest version and then lets review the archive stuff after that!

    ... A SQL query walks into a bar and sees two tables. Asks: 'Can I join you?'

    --- Mystic BBS v1.12 A47 2021/07/31 (Windows/64)
    * Origin: Sector 7 * Mystic WHQ (1:129/215)
  • From Björn Wiberg@2:201/137 to g00r00 on Thu Aug 5 22:27:04 2021
    Hello g00r00!

    Thank you for your reply!

    On 05 Aug 2021, g00r00 said the following...
    Sorry, my fault (see one of my later replies) -- the Pack Cmd on Linu must have %2 unquoted as zip on that platform does not perform its ow

    I am going to hold off on any more updates until we are using the
    version with the ">" added to the execution on the Linux side.

    Update the latest version and then lets review the archive stuff after that!

    I'm currently using the following:

    Active ³ Yes
    Extension ³ ZIP
    OS ³ Linux
    Description ³ Info-ZIP Utilities
    Pack Cmd ³ zip -qj9 "%1" %2
    Unpack Cmd ³ unzip -oqqjC "%1" "%2" -d "%3"
    View Cmd ³

    (Notice the "%1" and "%3" but %2; speaking of quoting or not quoting "%3".)

    It seems to be working just fine.

    From the (built-in) archive viewer, I could navigate inside a ZIP containing a subdirectory and some files, and it viewed (= unpacked and displayed) them just fine.

    An strace looks fine as well:

    write(17, "2021.08.05 22:22:14 Executing: unzip -oqqjC \"/mnt/bbs/mystic/files/local/uploads/test.zip\" \"subdir/test2.txt\" -d \"/home/bbs/mystic/temp2/\" > /dev/null 2>&1\n", 156) = 156
    close(17) = 0
    fork(strace: Process 2298 attached
    ) = 2298
    [pid 2298] execve("/bin/sh", ["/bin/sh", "-c", "unzip -oqqjC \"/mnt/bbs/mystic/files/local/uploads/test.zip\" \"subdir/test2.txt\" -d \"/home/bbs/mystic/temp2/\" > /dev/null 2>&1"], ["LANG=en_US.UTF-8",

    Best regards
    Bj”rn

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