Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Zipstream-php is amd64 only? #3928

Open
lachlan-00 opened this issue Apr 10, 2024 · 7 comments
Open

Zipstream-php is amd64 only? #3928

lachlan-00 opened this issue Apr 10, 2024 · 7 comments
Labels
dependencies Pull requests that update a dependency file docker refer to the official docker repo

Comments

@lachlan-00
Copy link
Member

@usox i'm getting a build error on arm for the preview builds on patch7. is this lib amd64 only?

#18 3508.2 Composer plugins have been disabled for safety in this non-interactive session.
#18 3508.2 Set COMPOSER_ALLOW_SUPERUSER=1 if you want to allow plugins to run as root/super user.
#18 3508.2 Do not run Composer as root/super user! See https://getcomposer.org/root for details
#18 3509.3 Composer could not detect the root package (ampache/ampache) version, defaulting to '1.0.0'. See https://getcomposer.org/root-version
#18 3509.6 Installing dependencies from lock file (including require-dev)
#18 3509.7 Verifying lock file contents can be installed on current platform.
#18 3510.3 Your lock file does not contain a compatible set of packages. Please run composer update.
#18 3510.3
#18 3510.3   Problem 1
#18 3510.3     - maennchen/zipstream-php is locked to version 3.1.0 and an update of this package was not requested.
#18 3510.3     - maennchen/zipstream-php 3.1.0 requires php-64bit ^8.1 -> the php-64bit package is disabled by your platform config. Enable it again with "composer config platform.php-64bit --unset".
#18 3510.3
------
Dockerfile:8
@lachlan-00 lachlan-00 added docker refer to the official docker repo dependencies Pull requests that update a dependency file labels Apr 10, 2024
@usox
Copy link
Contributor

usox commented Apr 10, 2024

Ok, that seems to be the case - that's odd.

I'm afraid we'll have to look for a replacement for the library if we want to continue to support zips and 32-bit, as the old version will no longer be updated.

We'll have to see what exactly is done with zip archives. Perhaps we can do without the library altogether.

@usox
Copy link
Contributor

usox commented Apr 10, 2024

Ok, I've had a look around. We have the following options:

  • Downgrade to ZipStream version 2. Disadvantage: No updates, even transitive dependencies are no longer updated

  • Use the native ZipArchive functionality. Disadvantage: Does not work in-memory but only with a temporary file - so you have to perform cleanups again

  • 64bit only. Disadvantage: Meh.

  • Remove Zip function: Meh.

@lachlan-00
Copy link
Member Author

There's also a bug in it where the zips are created but unreadable. The zip will open in 7Zip but not in the windows explorer.

2024-04-10T23:20:31+00:00 [user] (/var/www/music/vendor/maennchen/zipstream-php/src/File.php:334) -> hash_update(): Argument #2 ($data) must be of type string, bool given

I think it might be time to ZipArchive it and keep what function that can be. If the native class can only handle part of the existing functions it's probably better than a massive change like dropping all other architectures.

@usox
Copy link
Contributor

usox commented Apr 11, 2024

We just have to be careful, because the behavior of ZipStream and ZipArchive is different.
ZipStream keeps the archive in RAM, ZipArchive works with a temporary file. Therefore, when using ZipArchive in the future, we have to run a cleanup job that deletes old temp files (otherwise the temp directory will fill up very quickly).

ZipStream had the disadvantage that on machines with very little RAM (e.g. RPI) it was sometimes not possible to create archives at all (an archive with 1-2 albums with flac files can be 1.5GB).

usox added a commit to usox/ampache that referenced this issue Apr 11, 2024
usox added a commit to usox/ampache that referenced this issue Apr 11, 2024
@usox
Copy link
Contributor

usox commented Apr 11, 2024

I'm not entirely convinced, but "works for me"

@lachlan-00
Copy link
Member Author

I wrote a version quickly last night, and I realise what my error was now.

addFile without a valid file will break the archive.

It's not pretty compared to zipstream but I can at least download a zip in Windows with it

@usox
Copy link
Contributor

usox commented Apr 12, 2024

I think it will take another 1-2 iterations until it's ok. But at least it's no longer a blocker.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
dependencies Pull requests that update a dependency file docker refer to the official docker repo
Projects
None yet
Development

No branches or pull requests

2 participants