After checking a few more things with the same zip file Ps7cho uploaded,
win10 - winrar 5.60 beta1 64-bit does not detect errors
win10 - 7zip 18.01 x64 gives the warning "Headers Error"
win10 - 7zip 16.04 x64 does not detecterror
ubuntu16.04 - php with zip version 1.15.2, below is the code using to call the zip library to check the file
Code: Select all
$fileTmp = $_FILES['file']['tmp_name'];
$zip = new ZipArchive();
$res = $zip->open($fileTmp, ZipArchive::CHECKCONS);
if ($res !== TRUE) {
switch($res) {
case ZipArchive::ER_NOZIP:
unlink($fileTmp);
die('Error z'.__LINE__.': Not a zip archive');
case ZipArchive::ER_INCONS :
unlink($fileTmp);
die('Error z'.__LINE__.': Zip consistency check failed');
case ZipArchive::ER_CRC :
unlink($fileTmp);
die('Error z'.__LINE__.': Zip checksum failed');
default:
unlink($fileTmp);
die('Error z'.__LINE__.': Zip error ' . $res);
}
}
fails on case ZipArchive::ER_INCONS
"client" is the same file that Ps7cho uploaded - fails php and 7zip check
"server" is the started on the client file then immediately stopped, triggering the server to save the loaded game -fails php and 7zip check
"7zip" is the original save unzipped, and re archived - passes php check
"winrar" is the original save unzipped, and re archived - passes php check
The server save is a different size than ps7cho's upload. This could be different compression levels between the server and the client configurations. 7zip and winrar filesize can be almost completely disregarded due to potential compression methods. However it is interesting that the same version of factorio (albeit, ps7cho is running windows 10, and the server is running ubuntu 16.04) is producing different sized files.
if I take the server's file, extract it, and re-archive with 7zip, the file size is further reduced to 1.17mb. start/stopping this file returns the save to the same 1.28mb as before.
Another thing to note, is that the server and a client will start fine with any of these files. It's mainly a problem for us since the server is checking for zip inconsistency, which we will likely disable soon so we can upload files again. But this is also concerning that factorio is doing something to cause inconsistency. Downloading the server generated, and attempting to re-upload also triggers the inconsistency error.
--edit: correction
The php zip check is failing on validating ZipArchive::CHECKCONS, indicating there is an error with the zip file. we'll have to remove both the consistency error and the default error case to enable file uploads on our server again. This check is being use to try and ensure only actual zip files are uploaded to the server. The consistency check was in case the zip was legitimately corrupted; ie, a server force stopped before a save completed, or some other situation where a factorio save might be interrupted. These files would prevent the server from starting.