[physfs] Seeking backwards in .pk3 archive files fails on OS X (works on Windows)

Jay Dolan jay.t.dolan at gmail.com
Wed Jan 11 15:51:07 EST 2017


In attempting to randomly access lumps in a BSP file that came from a .pk3
archive, I think we've discovered a bug in PhysicsFS.

On OS X, it seems that you can not seek backwards in these files. On
Windows, it works fine. We've tried PhysicsFS 2.0.3 as well as hg HEAD.

I do not have a minimal test case right now, but here is some of the code
in question:
https://github.com/jdolan/quetoo/blob/e555322eb24465134989e11c2489df
81eebc41c8/src/collision/cm_bsp.c#L428

This is called in loop to load the lumps of the BSP that the game is
interested in. The first time this function is called on such a file, it
succeeds (the seek is a no-op). However, subsequent invocations will fail
to seek to offset 0, despite advertising that the seek was successful. The
subsequent read will then fail or, worse, retrieve garbage data.

One of our developers on Windows does not have this crash.. seeking back to
0 in the archive-sourced file works fine for him. So I can only conclude
that seeking backwards in zip-sourced files does not work correctly on OS
X.

Is this a known issue?

Thanks!

--
Jay Dolan
508-415-1866
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://icculus.org/pipermail/physfs/attachments/20170111/07ee5537/attachment.html>


More information about the physfs mailing list