Subject: Re: bug#77898: 31.0.50; arc-mode: Split PKZIP archive signature not recognized

From: Eli Zaretskii <[email-masked]>
Date: Fri, 18 Apr 2025 15:51:13 +0300

> Date: Fri, 18 Apr 2025 14:30:59 +0200
> From:  Jens Schmidt via "Bug reports for GNU Emacs,
>  the Swiss army knife of text editors" <[email-masked]>
> 
> The attached zip file is a "real" one, in the sense that it has been
> created in the wild.  It is a stripped down "terraform stack" generated
> by one of the cloud providers.
> 
> InfoZIP's unzip can handle that file without problems:
> 
>   [emacs-master]$ unzip -v
>   UnZip 6.00 of 20 April 2009, by Debian. Original by Info-ZIP.
>   [...]
> 
>   [emacs-master]$ unzip -l tf-stack.zip
>   Archive:  tf-stack.zip
>     Length      Date    Time    Name
>   ---------  ---------- -----   ----
>          38  2025-04-01 08:43   provider.tf
>   ---------                     -------
>          38                     1 file
> 
> However, "./src/emacs -Q tf-stack.zip" fails on it with:
> 
>   File mode specification error: (error "Buffer format not recognized")
> 
> It turns out that the zip file starts with a special marker 0x08074b50
> for spanned or split archives, as defined in the pseudo zip file
> specification "APPNOTE.txt" by PKWARE.  See section 8.5 "Capacities and
> Markers" of that document for more details.
> 
> The attached patch provides support for the aforementioned special
> marker, alongside with the already present "temporary spanning marker"
> 0x30304b50.  The patch itself is trivial, but I tried to provide above
> information also in the commit message for future reference.
> 
> WDYT?

Please add comments describing the possible signatures, with pointers
to specific sections of APPNOTE.txt.

Also, is it possible to add some tests for this?

Thanks.