View Issue Details

IDProjectCategoryView StatusLast Update
0000386fileGeneralpublic2022-10-09 18:00
Reporterdelphij Assigned Tochristos  
PrioritynormalSeverityminorReproducibilityalways
Status resolvedResolutionfixed 
Product Version5.43 
Summary0000386: tests/gpkg-1-zst.result contains an extra \n
Description(I'm not 100% sure if this is a defect or not; it was discovered by FreeBSD CI, and https://ci.freebsd.org/job/FreeBSD-main-amd64-test/22193/testReport/usr.bin.file/file_test/contrib_file_tests/ is an example)

So basically what our test cases does is that for each *.testfile under file's tests/, it does a "file --brief" on it and compare the trimmed output against the .result. The code can be found here:

https://cgit.freebsd.org/src/tree/usr.bin/file/tests/file_test.sh

In file 5.42, a test case was added for gpkg-1-zst.testfile, but the result contained an extra \n at the end, so the cmp would fail because the result is no longer exactly identical.
Steps To Reproduce$ file --brief tests/gpkg-1-zst.testfile | tr -d '\012' > /tmp/actual
$ cmp tests/gpkg-1-zst.result /tmp/actual
cmp: EOF on /tmp/actual

Expected result: cmp should give empty result.
Additional InformationProposed fix would be to remove the trailing \n so it matches the others:

truncate -s 85 tests/gpkg-1-zst.result

and possibly run the tests as part of CI process for file :) However, I am not 100% sure if the omission of the trailing \n's were intentional for these .result files. It took me some time to understand why the FreeBSD test case was removing the \n (https://cgit.freebsd.org/src/tree/usr.bin/file/tests/file_test.sh#n43).

So please consider either applying this fix or changing all the .result files so that they have a trailing \n.
TagsNo tags attached.

Activities

christos

2022-10-09 18:00

manager   ~0003828

Added newlines to all result files for consistency.

Issue History

Date Modified Username Field Change
2022-10-01 06:18 delphij New Issue
2022-10-09 18:00 christos Assigned To => christos
2022-10-09 18:00 christos Status new => assigned
2022-10-09 18:00 christos Status assigned => resolved
2022-10-09 18:00 christos Resolution open => fixed
2022-10-09 18:00 christos Note Added: 0003828