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

Unable to rename temporary phar archive when using Vagrant #116

Closed
nxu opened this issue Mar 10, 2021 · 2 comments · Fixed by #130
Closed

Unable to rename temporary phar archive when using Vagrant #116

nxu opened this issue Mar 10, 2021 · 2 comments · Fixed by #130
Assignees
Milestone

Comments

@nxu
Copy link

nxu commented Mar 10, 2021

Hey

first of all, thank you for phar-composer, I love it and I've been using it for years.

Now i updated it to 1.2.0 to support composer 2 and I have an issue I simply can not seem to solve. I tried it on different computers with different php versions (7.3 and 8.0):

  • I have a folder called create-project with a PHP project in it
  • I run ./phar-composer.phar build create-project
  • The phar file gets built and the temporary file create-project.phar.<numbers>.phar gets saved
  • phar-composer throws the following error:
PHP Warning:  rename(create-project.phar.1982369873.phar,create-project.phar): Text file busy in phar:///home/vagrant/code/phar-composer.phar/src/Clue/PharComposer/Phar/PharComposer.php on line 226

Warning: rename(create-project.phar.1982369873.phar,create-project.phar): Text file busy in phar:///home/vagrant/code/phar-composer.phar/src/Clue/PharComposer/Phar/PharComposer.php on line 226



  [UnexpectedValueException]
  Unable to rename temporary phar archive to "create-project.phar"



build [project] [target]

After this, the temporary phar file works fine and I can also rename it manually. It looks like phar-composer doesn't close the handle to the file before trying to rename it.

Can you please help me with debugging?

@clue
Copy link
Owner

clue commented Dec 28, 2021

@nxu Thanks for reporting, this shouldn't have happened!

Unfortunately, I can not reproduce the problem you're seeing locally and it looks like you're the first to run into this issue. Can you provide instructions on how to reproduce this?

It looks like this might be related to using a shared folder in Vagrant? Can you try executing this in a different directory? Shared folders and slow network mounted drives could be a potential problem here if the writing is performed in the background and temporarily blocks the rename command. If this is the case, introducing some optional delays or fsync() calls might help. I'm happy to accept PRs to address this!

As much as I'd love to work on this myself, there are currently no immediate plans to build this from my end (no demand at the moment and more important outstanding issues currently). If you need this for a commercial project and you want to help sponsor this feature, feel free to reach out and I'm happy to take a look.

@clue clue changed the title Unable to rename temporary phar archive Unable to rename temporary phar archive when using Vagrant Dec 29, 2021
@clue clue removed the bug label Dec 29, 2021
@clue clue added this to the v1.4.0 milestone Feb 13, 2022
@clue clue self-assigned this Feb 13, 2022
@clue
Copy link
Owner

clue commented Feb 14, 2022

This has now been resolved by a combination of #128, #129, and #130. I'll make sure to get this version shipped asap :shipit:

I hope this helps! 👍 If so, consider supporting this project, for example by becoming a sponsor ❤️

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants