AgentD / squashfs-tools-ng

A new set of tools and libraries for working with SquashFS images
Other
194 stars 30 forks source link

test_tar_{gnu,pax,ustar} fail on 32-bit platforms #8

Closed mattst88 closed 4 years ago

mattst88 commented 4 years ago

On 32-bit platforms, struct stat's st_mtime, st_ctime, and st_atime fields are 32-bit (time_t). The failing tests check against values that do not fit in 32-bits:

       assert(hdr.sb.st_mtime == 8589934592);
       assert(hdr.sb.st_atime == 8589934592);
       assert(hdr.sb.st_ctime == 8589934592);

FWIW: -Wall warns about this on 32-bit platforms:

tests/tar_ustar.c:130:25: warning: comparison is always false due to limited range of data type [-Wtype-limits]
  assert(hdr.sb.st_mtime == 8589934592);
                         ^~

Opening tests/tar/large-mtime/pax.tar in vim shows

tar: Extended header mtime=8589934592 is out of range -2147483648..2147483647

So not sure what the best thing to do is. I know there's a lot of 2038 patches going around. Maybe don't test large-mtimes on 32-bit platforms?

AgentD commented 4 years ago

Resolved by 4fdfd1f