wikimedia / composer-merge-plugin

Merge one or more additional composer.json files at Composer runtime
MIT License
924 stars 160 forks source link

"... MergePlugin.php): failed to open stream: No such file or directory" on Virtualbox in a vboxsf shared directory #194

Open JasonWeakley opened 3 years ago

JasonWeakley commented 3 years ago

I am running geerlingguy's Drupal Vagrant VM, with Drupal 9, and Composer 1.10.17 2020-10-30 22:31:58

When I try to install this plugin I get the following:

1/2:        https://packages.drupal.org/8/drupal/provider-2020-4$1674a0a1f0f068ac666d0812b807672ce7f586ac08a042dc0c0fd66369537568.json
2/2:        https://packages.drupal.org/8/drupal/provider-2020-3$272787ef0cd84c34bba98eb97731fc2b85e1ad9acba629f380b9684b1b48daab.json
Finished: success: 2, skipped: 0, failure: 0, total: 2
1/8:        http://repo.packagist.org/p/provider-2020-01$071f956a426ebb1b2df51bc6998d2002f82c87975ca5a8815a1c0a9481d58531.json
2/8:        http://repo.packagist.org/p/provider-latest$0face4a9d4f5763492c164f414aac88af75cfa54b99e0947c690902eed1d72db.json
3/8:        http://repo.packagist.org/p/provider-2020-10$39640db8c8083d5a0b835c3a3eb3d09fee39d6d02b6840d1843e59eeaa6bbb96.json
4/8:        http://repo.packagist.org/p/provider-2020-07$6b81bfaabfd6c688cc560dc9033d371b3da3ead8c6b7ab5a8c5457d09474548f.json
5/8:        http://repo.packagist.org/p/provider-2016$a429dc1c03909dedd1c264145e45084c0c6ff203c05970e9141e7303c60f90a4.json
6/8:        http://repo.packagist.org/p/provider-2018$ac74fccb57b7defa5f2300ea8b5935b5932bc5e5556a14babe0bd42df62979a8.json
7/8:        http://repo.packagist.org/p/provider-2019$1c69ed9ce245d15477ed17b40baab66750fed89d366265e52748df70c00c02a2.json
8/8:        http://repo.packagist.org/p/provider-2020-04$8712e9f773fe6bcd4c7134261ca674eeb98dcaae88e6fb35a5dc2178f2fbcc75.json
Finished: success: 8, skipped: 0, failure: 0, total: 8

Using version ^1.4 for wikimedia/composer-merge-plugin ./composer.json has been updated Loading composer repositories with package information Updating dependencies (including require-dev) Package operations: 1 install, 0 updates, 0 removals

Installation failed, reverting ./composer.json to its original content.

[RuntimeException] Could not delete /var/www/drupalvm/drupal/vendor/wikimedia/composer-merge-plugin/src/Merge:

I've looked in the src directory and neither the MergePlugin.php or the Logger.php files are there, after repeated attempts.

reedy commented 3 years ago

What happens if you run composer clearcache (or similar to clear the composer cache) and try again?

bd808 commented 3 years ago

I am seeing this same issue while working on a fresh MediaWiki-Vagrant install. Running composer clearcache did make the v1.4.1 package download again, but it does not seem to include the expected file.

$ unzip -l caf9a7d0b6830ef3f8e1e1f8835bc0a4c595d44f.zip
Archive:  caf9a7d0b6830ef3f8e1e1f8835bc0a4c595d44f.zip
81c6ac72a24a67383419c7eb9aa2b3437f2ab100
  Length      Date    Time    Name
---------  ---------- -----   ----
        0  2017-04-25 02:31   wikimedia-composer-merge-plugin-81c6ac7/
     1095  2017-04-25 02:31   wikimedia-composer-merge-plugin-81c6ac7/LICENSE
     9082  2017-04-25 02:31   wikimedia-composer-merge-plugin-81c6ac7/README.md
     1400  2017-04-25 02:31   wikimedia-composer-merge-plugin-81c6ac7/composer.json
        0  2017-04-25 02:31   wikimedia-composer-merge-plugin-81c6ac7/src/
     2348  2017-04-25 02:31   wikimedia-composer-merge-plugin-81c6ac7/src/Logger.php
        0  2017-04-25 02:31   wikimedia-composer-merge-plugin-81c6ac7/src/Merge/
    19452  2017-04-25 02:31   wikimedia-composer-merge-plugin-81c6ac7/src/Merge/ExtraPackage.php
      411  2017-04-25 02:31   wikimedia-composer-merge-plugin-81c6ac7/src/Merge/MissingFileException.php
     4100  2017-04-25 02:31   wikimedia-composer-merge-plugin-81c6ac7/src/Merge/NestedArray.php
     9827  2017-04-25 02:31   wikimedia-composer-merge-plugin-81c6ac7/src/Merge/PluginState.php
     5169  2017-04-25 02:31   wikimedia-composer-merge-plugin-81c6ac7/src/Merge/StabilityFlags.php
    13161  2017-04-25 02:31   wikimedia-composer-merge-plugin-81c6ac7/src/MergePlugin.php
---------                     -------
    66045                     13 files
bd808 commented 3 years ago

but it does not seem to include the expected file.

    13161  2017-04-25 02:31   wikimedia-composer-merge-plugin-81c6ac7/src/MergePlugin.php

The file is there in the zip archive. Not sure why my eyes did not see that. Also not sure why composer does not see it at this point.

bd808 commented 3 years ago

My failures are with Composer version 1.10.19 2020-12-04 09:14:16. This really feels like a regression on the composer side somehow. Our v1.4.1 tag has not changed since April 2017.

bd808 commented 3 years ago

@reedy made a guess in a discussion on IRC that this may have something to do with the length of the path to the file. I have done some experiments in my failing MediaWiki-Vagrant's Virtualbox VM to see if I can prove or disprove that.

I am actually seeing everything working fine regardless of the directory depth or path length as long as the target directory is NOT on a share mounted from the host os. composer install works exactly as expected with composer 1.10.19 if I do the work in /tmp/vagrant/mediawiki which is on the Virtualbox VM's root partition. The failure happens when I try the exact same operations with the exact same composer.json file and package cache state in the /vagrant/mediawiki directory which is a vboxsf share from my host computer (MacOS 10.15.7) mounted at /vagrant in the Virtualbox VM.

bd808 commented 3 years ago

The failure happens when I try the exact same operations with the exact same composer.json file and package cache state in the /vagrant/mediawiki directory which is a vboxsf share from my host computer (MacOS 10.15.7) mounted at /vagrant in the Virtualbox VM.

I think I can confirm that this bug, at least in my reproduction case, is related to Virtualbox's vboxsf shared directory system. In MediaWiki-Vagrant you can switch to using NFS for sharing rather than Virtualbox's native shares with the commands vagrant config nfs_shares yes; vagrant halt; vagrant up. After doing this and verifying from inside the VM that /vagrant is an NFS mount I can no longer recreate the plugin installation failure. Instead composer install works exactly as expected.