[File] Help implementing "octal" indirect offset support

Michał Górny mgorny at gentoo.org
Fri Sep 9 14:42:43 UTC 2022


Hi,

I'd like to implement support for reading octal numbers like these used
in the ustar format and using them as indirect offsets.  This would
permit the GPKG magic to obtain the length of a tar archive member
and use it to locate the record for the second member.  However, after
staring at the existing code for an hour or so I don't seem to be able
to figure out how to do that.

FWICS the closest thing file(1) currently supports are *id3 types.  IIUC
the code just reads them as 32-bit integer and then transforms them
as appropriate.  I suppose I could try implementing something similar
on top of *quad types to be able to read up to 8 octal digits.

I suppose this would be good enough for my use case but I'm wondering if
you can think of a better way of implementing this.  TIA.

-- 
Best regards,
Michał Górny



More information about the File mailing list