[File] [PATCH] Add magic for Gentoo GLEP 78 (GPKG) binary packages
Christos Zoulas
christos at zoulas.com
Wed Sep 7 11:29:48 UTC 2022
Committed, thanks!
christos
> On Sep 5, 2022, at 7:47 AM, Michał Górny <mgorny at gentoo.org> wrote:
>
> Add the basic magic for the new Gentoo binary package format introduced
> via GLEP 78. The format uses an uncompressed .tar container that
> can easily be recognized by its first member being a file named
> "<directory>/gpkg-1". The check additionally reports the compression
> used for the binary package members by looking at the second member's
> name.
>
> The check currently works only if "-e tar" is used. I would like to
> look into adding an appropriate logic for detecting the format
> in is_tar() and forcing the fallback to magic rules explicitly
> in the future.
>
> An interesting extension would also be to add support for tar-style
> octal numbers in offset expressions, as that would make it possible
> to determine the offset of the second member metadata, and therefore
> determine whether the binary package is signed.
> ---
> magic/Magdir/archive | 22 ++++++++++++++++++++++
> 1 file changed, 22 insertions(+)
>
> diff --git a/magic/Magdir/archive b/magic/Magdir/archive
> index df78791c..2aaa7310 100644
> --- a/magic/Magdir/archive
> +++ b/magic/Magdir/archive
> @@ -32,6 +32,9 @@
>>>>>>>>> 0 regex \^[0-9]{2,4}[.](png|jpg|jpeg|tif|tiff|gif|bmp)
> #foo
>>>>>>>>>> 0 use tar-cbt
> +# GPKG starts with <directory>/gpkg-1 file
> +>>>>>>>>0 search/100 /gpkg-1\0
> +>>>>>>>>>0 use tar-gpkg
> # if 1st member name without digits and without used image suffix then it is a TAR archive
>>>>>>>>> 0 default x
>>>>>>>>>> 0 use tar-file
> @@ -169,6 +172,25 @@
> # or maybe like ComicInfo.xml
>> 0 string >\0 \b, 1st image %-.60s
>
> +# Summary: Gentoo GLEP 78 binary package
> +# URL: https://www.gentoo.org/glep/glep-0078.html
> +# Note: assumes the strict format
> +0 name tar-gpkg
> +>0 string x Gentoo GLEP 78 (GPKG) binary package
> +!:mime application/x-tar
> +!:ext tar
> +# the logic below requires the gpkg-1 file to be empty
> +>>124 string 00000000000\0
> +# determine the compression used by looking at the second member name
> +>>>512 search/100 .tar.
> +>>>>&0 string gz\0 using gzip compression
> +>>>>&0 string bz2\0 using bzip2 compression
> +>>>>&0 string lz\0 using lzip compression
> +>>>>&0 string lz4\0 using lz4 compression
> +>>>>&0 string lzo\0 using lzo compression
> +>>>>&0 string xz\0 using xz compression
> +>>>>&0 string zst\0 using zstd compression
> +
> # Incremental snapshot gnu-tar format from:
> # https://www.gnu.org/software/tar/manual/html_node/Snapshot-Files.html
> 0 string GNU\ tar- GNU tar incremental snapshot data
> --
> 2.37.3
>
> --
> File mailing list
> File at astron.com
> https://mailman.astron.com/mailman/listinfo/file
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 235 bytes
Desc: Message signed with OpenPGP
URL: <https://mailman.astron.com/pipermail/file/attachments/20220907/df3c3d0f/attachment.asc>
More information about the File
mailing list