fisharebest / webtrees

Online genealogy
https://webtrees.net
GNU General Public License v3.0
490 stars 301 forks source link

Could not open zip archive at:/tmp/... #3226

Closed bombaata closed 4 years ago

bombaata commented 4 years ago

Hi, I'm having an issue while using compression when exporting my database :

Could not open zip archive at:/tmp/webtrees-zip-c2Vf2S, error: 19 …/vendor/league/flysystem-ziparchive/src/ZipArchiveAdapter.php:86
#0 …/vendor/league/flysystem-ziparchive/src/ZipArchiveAdapter.php(42): League\Flysystem\ZipArchive\ZipArchiveAdapter->openArchive()
#1 …/app/Http/RequestHandlers/ExportGedcomClient.php(109): League\Flysystem\ZipArchive\ZipArchiveAdapter->__construct()
#2 …/app/Http/Middleware/WrapHandler.php(83): Fisharebest\Webtrees\Http\RequestHandlers\ExportGedcomClient->handle()
#3 …/vendor/oscarotero/middleland/src/Dispatcher.php(136): Fisharebest\Webtrees\Http\Middleware\WrapHandler->process()
#4 …/app/Module/HitCountFooterModule.php(157): Middleland\Dispatcher->handle()
#5 …/vendor/oscarotero/middleland/src/Dispatcher.php(136): Fisharebest\Webtrees\Module\HitCountFooterModule->process()
#6 …/app/Http/Middleware/AuthManager.php(57): Middleland\Dispatcher->handle()
#7 …/vendor/oscarotero/middleland/src/Dispatcher.php(136): Fisharebest\Webtrees\Http\Middleware\AuthManager->process()
#8 …/app/Http/Middleware/CheckCsrf.php(75): Middleland\Dispatcher->handle()
#9 …/vendor/oscarotero/middleland/src/Dispatcher.php(136): Fisharebest\Webtrees\Http\Middleware\CheckCsrf->process()
#10 …/vendor/oscarotero/middleland/src/Dispatcher.php(118): Middleland\Dispatcher->handle()
#11 …/app/Http/Middleware/Router.php(134): Middleland\Dispatcher->dispatch()
#12 …/vendor/oscarotero/middleland/src/Dispatcher.php(136): Fisharebest\Webtrees\Http\Middleware\Router->process()
#13 …/app/Http/Middleware/BootModules.php(62): Middleland\Dispatcher->handle()
#14 …/vendor/oscarotero/middleland/src/Dispatcher.php(136): Fisharebest\Webtrees\Http\Middleware\BootModules->process()
#15 …/app/Http/Middleware/LoadRoutes.php(76): Middleland\Dispatcher->handle()
#16 …/vendor/oscarotero/middleland/src/Dispatcher.php(136): Fisharebest\Webtrees\Http\Middleware\LoadRoutes->process()
#17 …/app/Http/Middleware/UseTransaction.php(45): Middleland\Dispatcher->handle()
#18 …/vendor/illuminate/database/Concerns/ManagesTransactions.php(29): Fisharebest\Webtrees\Http\Middleware\UseTransaction::Fisharebest\Webtrees\Http\Middleware\{closure}()
#19 …/app/Http/Middleware/UseTransaction.php(46): Illuminate\Database\Connection->transaction()
#20 …/vendor/oscarotero/middleland/src/Dispatcher.php(136): Fisharebest\Webtrees\Http\Middleware\UseTransaction->process()
#21 …/app/Http/Middleware/DoHousekeeping.php(81): Middleland\Dispatcher->handle()
#22 …/vendor/oscarotero/middleland/src/Dispatcher.php(136): Fisharebest\Webtrees\Http\Middleware\DoHousekeeping->process()
#23 …/app/Http/Middleware/UseTheme.php(70): Middleland\Dispatcher->handle()
#24 …/vendor/oscarotero/middleland/src/Dispatcher.php(136): Fisharebest\Webtrees\Http\Middleware\UseTheme->process()
#25 …/app/Http/Middleware/CheckForMaintenanceMode.php(51): Middleland\Dispatcher->handle()
#26 …/vendor/oscarotero/middleland/src/Dispatcher.php(136): Fisharebest\Webtrees\Http\Middleware\CheckForMaintenanceMode->process()
#27 …/app/Http/Middleware/UseLanguage.php(73): Middleland\Dispatcher->handle()
#28 …/vendor/oscarotero/middleland/src/Dispatcher.php(136): Fisharebest\Webtrees\Http\Middleware\UseLanguage->process()
#29 …/app/Http/Middleware/UseSession.php(73): Middleland\Dispatcher->handle()
#30 …/vendor/oscarotero/middleland/src/Dispatcher.php(136): Fisharebest\Webtrees\Http\Middleware\UseSession->process()
#31 …/app/Http/Middleware/UseFilesystem.php(58): Middleland\Dispatcher->handle()
#32 …/vendor/oscarotero/middleland/src/Dispatcher.php(136): Fisharebest\Webtrees\Http\Middleware\UseFilesystem->process()
#33 …/app/Http/Middleware/UpdateDatabaseSchema.php(58): Middleland\Dispatcher->handle()
#34 …/vendor/oscarotero/middleland/src/Dispatcher.php(136): Fisharebest\Webtrees\Http\Middleware\UpdateDatabaseSchema->process()
#35 …/app/Http/Middleware/UseDebugbar.php(67): Middleland\Dispatcher->handle()
#36 …/vendor/oscarotero/middleland/src/Dispatcher.php(136): Fisharebest\Webtrees\Http\Middleware\UseDebugbar->process()
#37 …/app/Http/Middleware/UseDatabase.php(106): Middleland\Dispatcher->handle()
#38 …/vendor/oscarotero/middleland/src/Dispatcher.php(136): Fisharebest\Webtrees\Http\Middleware\UseDatabase->process()
#39 …/app/Http/Middleware/BadBotBlocker.php(208): Middleland\Dispatcher->handle()
#40 …/vendor/oscarotero/middleland/src/Dispatcher.php(136): Fisharebest\Webtrees\Http\Middleware\BadBotBlocker->process()
#41 …/app/Http/Middleware/UseCache.php(74): Middleland\Dispatcher->handle()
#42 …/vendor/oscarotero/middleland/src/Dispatcher.php(136): Fisharebest\Webtrees\Http\Middleware\UseCache->process()
#43 …/vendor/middlewares/client-ip/src/ClientIp.php(81): Middleland\Dispatcher->handle()
#44 …/app/Http/Middleware/ClientIp.php(47): Middlewares\ClientIp->process()
#45 …/vendor/oscarotero/middleland/src/Dispatcher.php(136): Fisharebest\Webtrees\Http\Middleware\ClientIp->process()
#46 …/app/Http/Middleware/HandleExceptions.php(76): Middleland\Dispatcher->handle()
#47 …/vendor/oscarotero/middleland/src/Dispatcher.php(136): Fisharebest\Webtrees\Http\Middleware\HandleExceptions->process()
#48 …/app/Http/Middleware/BaseUrl.php(77): Middleland\Dispatcher->handle()
#49 …/vendor/oscarotero/middleland/src/Dispatcher.php(136): Fisharebest\Webtrees\Http\Middleware\BaseUrl->process()
#50 …/app/Http/Middleware/ReadConfigIni.php(65): Middleland\Dispatcher->handle()
#51 …/vendor/oscarotero/middleland/src/Dispatcher.php(136): Fisharebest\Webtrees\Http\Middleware\ReadConfigIni->process()
#52 …/app/Http/Middleware/SecurityHeaders.php(47): Middleland\Dispatcher->handle()
#53 …/vendor/oscarotero/middleland/src/Dispatcher.php(136): Fisharebest\Webtrees\Http\Middleware\SecurityHeaders->process()
#54 …/app/Http/Middleware/EmitResponse.php(57): Middleland\Dispatcher->handle()
#55 …/vendor/oscarotero/middleland/src/Dispatcher.php(136): Fisharebest\Webtrees\Http\Middleware\EmitResponse->process()
#56 …/app/Http/Middleware/PhpEnvironment.php(49): Middleland\Dispatcher->handle()
#57 …/vendor/oscarotero/middleland/src/Dispatcher.php(136): Fisharebest\Webtrees\Http\Middleware\PhpEnvironment->process()
#58 …/vendor/oscarotero/middleland/src/Dispatcher.php(118): Middleland\Dispatcher->handle()
#59 …/index.php(55): Middleland\Dispatcher->dispatch()
#60 {main}

Using webtrees 2.0.3.

Same error occurs using PHP 7.2.30 or 7.4.5 (ondrej PHP repo) on Ubuntu 18.04.4 LTS.

Steps to reproduce :

  1. Go to export
  2. Either select "Compress the GEDCOM file" or "Include media"
  3. Continue
  4. Error happens.

A blank zip file is written in the path with correct rights :

   0 -rw-------  1 www-data www-data    0 May  6 10:19 webtrees-zip-8ECdVe
   0 -rw-------  1 www-data www-data    0 May 10 10:47 webtrees-zip-c2Vf2S
   0 -rw-------  1 www-data www-data    0 May  6 10:14 webtrees-zip-Ce0JKI
   0 -rw-------  1 www-data www-data    0 May 10 10:24 webtrees-zip-Gxbx8W
   0 -rw-------  1 www-data www-data    0 May 10 10:20 webtrees-zip-HOuAEy
   0 -rw-------  1 www-data www-data    0 May  6 10:20 webtrees-zip-K6Ht86
   0 -rw-------  1 www-data www-data    0 May 10 10:19 webtrees-zip-KKpGw4
   0 -rw-------  1 www-data www-data    0 May  6 10:19 webtrees-zip-Kpmokr
   0 -rw-------  1 www-data www-data    0 May 10 10:40 webtrees-zip-nJetgO
   0 -rw-------  1 www-data www-data    0 May 10 10:27 webtrees-zip-oHfyOX
   0 -rw-------  1 www-data www-data    0 May 10 10:23 webtrees-zip-ouHw0W
   0 -rw-------  1 www-data www-data    0 May 10 10:42 webtrees-zip-sUG3UT
   0 -rw-------  1 www-data www-data    0 May  6 10:13 webtrees-zip-u3dCJA
   0 -rw-------  1 www-data www-data    0 May  6 10:17 webtrees-zip-wCmcRt

Worked a few weeks ago.

I suspect a bug with a recent update of libzip4, as per may 1st I upgraded : 2020-05-01 11:19:04 upgrade libzip4:amd64 1.5.1-4+ubuntu18.04.1+deb.sury.org+2 1.6.1-3+ubuntu18.04.1+deb.sury.org+2

fisharebest commented 4 years ago

This issue has already been fixed.

The original code created an empty file, and the ZipArchive library could use it to create a new/empty zip file.

Recently, this stopped working. Probably some library. I didn't find out exactly which one.

The change was to create the temporary filename, but not the empty file.

fisharebest commented 4 years ago

https://github.com/fisharebest/webtrees/commit/a00baf472844c2db5ceef8a740f7eaac375894e7