[File] offset directicve for file size detection not working! BUG?
Michał Górny
mgorny at gentoo.org
Sun Sep 11 05:39:57 UTC 2022
On Sun, 2022-09-11 at 03:35 +0200, Jörg Jenderek wrote:
> According to man page magic(4) i can use offset directive to
> show/test for a file size. So i insert after last test a line like:
> >>>-0 offset x FILE_SIZE=%lld
> That show the expected sizes. Then i tried to insert additional
> test lines before calling sub routine. For standard case these
> additional lines fragment look like:
>
> #>>>0 beshort x 1ST_VALUE=%x
> > > > -0 offset =32034 VARIANT_STANDARD
> #>>>>0 beshort x 1st_VALUE=%x
> > > > > 0 use degas-bitmap
>
> Now the sub routine prints other and wrong values. When i try to
> display the first value instead of sub routine, the line with
> "1st_VALUE=" is never executed whereas the line with "1ST_VALUE" is
> executed and show correct value. So i think this is a BUG in file
> command.
>
> After applying the above mentioned modifications by patch
> file-5.42-images-pi1.diff then for my Atari DEGAS bitmap values
> are wrong.
>
> Unfortunately i am no c programmer. So maybe somebody can look at
> mentioned item and fix this.
I am not sure whether this is a bug or not but if you call "0 use foo"
after offset, the subroutine starts at the offset you've set for
the offset call, i.e. at the end of file.
--
Best regards,
Michał Górny
More information about the File
mailing list