Skip to content
Tcl Source Code Ticket Change Details
Login

Ticket Change Details

Overview

Artifact ID: bdbb1d6ffadfca29684c2e1f16b5dd08c0a9f3a65d55e3089ab2baa1185ec64d
Ticket: aaa84fbbc59fc039788c080a8cd32d2f73316db9
zipfs info on mountpoint of executable returns zero offset in field 4
User & Date: apnadkarni on 2024-12-04 06:50:45
Changes

  1. icomment:
    For the record, below is a summary comparison of the current implementation of zipfs and Julian's patched version.
    
    Currently, the Unix autoconf build appends the zip file to the executable/shared library and then does a `zip -A` to fix up the offsets in the zip ToC.
    
    The Windows nmake on the other hand uses Tcl's own `zipfs mkimg` command for the same purpose which does not fix up the offsets in the zip ToC.
    
    The difference shows up in two ways. *Some* external utilities, like `unzip`, display a warning on binaries constructed without adjustment of the offsets (as in the nmake case, or if `zip -A` is not invoked in the autoconf case)
    
    ```
    Archive:  tcl90.dll
    warning [tcl90.dll]:  2947584 extra bytes at beginning or within zipfile
    ```
    
    Note this does not affect actual operation of the unzip command. Also, unlike `unzip`, `7z` does not report this either as an error or warning.
    
    The problem with the autoconf build however, is that `zipfs info` which is **documented** as returning the offset of the archive within the executable instead returns 0.
    
    ```
    % zipfs info //zipfs:/lib/tcl
    /home/apnadkarni/tcl/9.0.0/lib/libtcl9.0.so 0 0 0
    ```
    
    Thus `zipfs info` cannot be used by Tcl utilities to split attached zip archives in wrapped binaries.
    
    The patch from Julian, **in conjunction with the removal** of the `zip -A` step from the autoconf build fixes this at the cost of the warning above.
    
    ```
    % zipfs info //zipfs:/lib/tcl
    C:/src/tcltk/wip/tcl/win/Release_AMD64_VC1939/tcl90.dll 0 0 2947584
    ```
    
    where the last element is the offset for splitting the wrapped binary.
    
    Even though this generates the warning from `unzip -l`, it is proposed that the patch be accepted and additionally the `zip -A` step be removed because the warning is benign as well as limited only to some utilities. Moreover, the ability to directly manipulate the splits and re-wrap from within Tcl easily without re-parsing is considered more useful.
    
  2. login: "apnadkarni"
  3. mimetype: "text/x-markdown"