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

Avoids errors when Extracting PHARs in class BinaryInstaller.php line 214 (PharData decompressing) #210

Closed

Conversation

beto-aveiga
Copy link
Collaborator

@beto-aveiga beto-aveiga commented May 23, 2023

Description

It avoids errors when extracting PHARs.
Possibly related to: https://bugs.php.net/bug.php\?id\=75101

More information in the linked ticket below.

Solves

#135

@deviantintegral
Copy link
Member

@beto-aveiga does #207 avoid this issue for you?

@beto-aveiga
Copy link
Collaborator Author

@deviantintegral
I haven't tried it, but I checked the PR and think it won't work.
I updated the description of this PR so you know what issue it is solving.

@beto-aveiga
Copy link
Collaborator Author

Opening

@beto-aveiga beto-aveiga marked this pull request as ready for review May 23, 2023 18:09
@beto-aveiga beto-aveiga changed the title Try to avoid 'Unable to add newly converted phar... to the list of ph… Avoids errors when Extracting PHARs in class BinaryInstaller.php line 214 (PharData decompressing) May 23, 2023
@beto-aveiga
Copy link
Collaborator Author

@deviantintegral @justafish I just tried this today. I could replicate the PHAR extracting in Tugboat, then added it to the composer file and work. Please review this. Many thanks!

@beto-aveiga
Copy link
Collaborator Author

FYI this is the error I was having in Tugboat:

- Skip [web-root]/modules/README.txt: overridden in abcd/xyz.org-cms
- Skip [web-root]/profiles/README.txt: overridden in abcd/xyz.org-cms
- Skip [web-root]/themes/README.txt: overridden in abcd/xyz.org-cms
Scaffolding files for lullabot/drainpipe:
- Skip [project-root]/.env because it already exists and overwrite is false.
> cd web && patch -p1 <../patches/htaccess-modifications.patch
patching file .htaccess
Updating BLT template files...
> blt blt:update --ansi --no-interaction
> blt:init:shell-alias
The BLT alias is already installed and up to date.
BLT 12 is end-of-life and unmaintained. Upgrade immediately to the latest major release.
See https://docs.acquia.com/blt/#releases-and-versioning
.gitignore does not contain drainpipe ignores. Compare .gitignore in the root of your repository with /var/lib/tugboat/vendor/lullabot/drainpipe/scaffold/gitignore and update as needed.
🪠 [Drainpipe] vendor/lullabot/drainpipe/scaffold/env/dotenv.php' missing from autoload-dev files
Using cached version of task v3.24.0 (05315061a703fc656984315f25813560f06ecd0076b220d07e1ef39f7f00a586)

In BinaryInstaller.php line 214:
                                                                                                                                                                                     
Unable to add newly converted phar "/root/.composer/cache/files/lullabot/drainpipe/bin/task/3.24.0/task_linux_amd64.tar" to the list of phars, a phar with that name already exists  
                                                                                                                                                                                     

Copy link
Contributor

@YesCT YesCT left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I read https://bugs.php.net/bug.php?id=75101 and I can see how this approach could be a fix for us.

I'm not sure how to reproduce the bug though.

$cacheDestination = $cacheFolder.\DIRECTORY_SEPARATOR.$fileName;
$cacheDestination = $cacheFolder.\DIRECTORY_SEPARATOR.bin2hex(random_bytes(5)).$fileName;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks like an implementation of the suggested quick fix from https://bugs.php.net/bug.php?id=75101

Quick fix would be to copy the file to a temporary location so it has a different name and doesn't get cached.


https://www.w3schools.com/php/phptryit.asp?filename=tryphp_compiler

Screenshot 2023-06-16 at 2 56 00 PM

gives a result like 4f06fe1a59 or 050b9c8d10

Seems a good length and character set for adding to a filename.

@deviantintegral
Copy link
Member

If you switch to global binaries as in the other PR, this code isn't called for task or local-security-checker.

However, this is still worth fixing given that's opt in and we need to support this setup until at least the next major version of Drainpipe.

@davereid davereid self-assigned this Feb 1, 2024
@justafish justafish added this to the Bad Task Binary milestone Feb 1, 2024
@deviantintegral deviantintegral added bug Something isn't working client affected labels Feb 19, 2024
@justafish justafish closed this Mar 19, 2024
@justafish justafish deleted the try-to-avoid-cache-issue-when-extracting-binaries branch March 19, 2024 12:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working client affected
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants