[File] newlines break file tests

Alexandre IOOSS erdnaxe at crans.org
Mon Aug 26 17:19:45 UTC 2024


Hello,

I recently noticed that tests are currently broken on file master 
branch. `make check` fails on my machine with:
```
TZ=UTC MAGIC=../magic/magic ./test -e ../tests/keyman-2.testfile 
../tests/keyman-2.result
../tests/keyman-2.testfile: Zip archive data, at least v1.0 to extract, 
compression method=deflate
test: ERROR: result was (len 70)
Zip archive data, at least v1.0 to extract, compression method=deflate
expected (len 29)
Keyman Compiled Package File
make[2]: *** [Makefile:791: check-local] Error 1
make[2]: Leaving directory '/home/erdnaxe/git/file/tests'
make[1]: *** [Makefile:667: check-am] Error 2
make[1]: Leaving directory '/home/erdnaxe/git/file/tests'
make: *** [Makefile:465: check-recursive] Error 1
```

Reverting commit 3bce3e16ec645be7a012ea9a29ad858510f84d4b makes the test 
pass, but if you look at the commit it does not really make sense why it 
would break the test.
During debugging, I noticed a strange behavior: adding 50 newlines at 
line 260 in magic/Magdir/archive breaks the tests/keyman-2 test.
I believe this is a bug in the file magic parser, and this bug is 
triggered when the magic definitions file is too big.

Do files under `magic/Magdir/` folder have a maximum size?

Best regards,
-- 
Alexandre


More information about the File mailing list