]> granicus.if.org Git - file/commitdiff
From Michal:
authorChristos Zoulas <christos@zoulas.com>
Fri, 9 Nov 2018 17:58:28 +0000 (17:58 +0000)
committerChristos Zoulas <christos@zoulas.com>
Fri, 9 Nov 2018 17:58:28 +0000 (17:58 +0000)
The most correct way to detect the format would probably be to first
check for 'STOP' at the end, read the unsigned long preceding it and use
it as (negative) offset from end of file where 'XPAKPACK' is to be
found.  However, file does not seem to support that kind of lookup.

Therefore, I went for the second best thing and checking for additional
'XPAKSTOP' terminating the metadata blob.

Technically, the information could be usefully amended by stating
the compression used.  However, it seems that positive offsets following
negative offsets do not work, and reversing the logic would require
a lot of repetition, so I presumed it's not worth the effort.
You can view, comment on, or merge this pull request online at:

[This note is for me to fix positive offset from starting from negative
offsets.]

magic/Magdir/archive

index f8cf3a2684b51c614c345c7a69177d1d61d6d3e4..83620b9e3b655a108c9d6f005174643882c7d022 100644 (file)
@@ -1,5 +1,5 @@
 #------------------------------------------------------------------------------
-# $File: archive,v 1.119 2018/04/24 23:19:45 christos Exp $
+# $File: archive,v 1.120 2018/11/09 17:58:28 christos Exp $
 # archive:  file(1) magic for archive formats (see also "msdos" for self-
 #           extracting compressed archives)
 #
 
 # LyNX archive
 56     string  USE\040LYNX\040TO\040DISSOLVE\040THIS\040FILE    LyNX archive
+
+
+# Gentoo XPAK binary package
+# by Michal Gorny <mgorny@gentoo.org>
+# https://gitweb.gentoo.org/proj/portage.git/tree/man/xpak.5
+-4     string  STOP
+>-16   string  XPAKSTOP        Gentoo binary package (XPAK)