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

Regression in edge cases where root package gets added to a repository already during the install process #11495

Closed
Seldaek opened this issue Jun 6, 2023 · 6 comments
Labels
Milestone

Comments

@Seldaek
Copy link
Member

Seldaek commented Jun 6, 2023

Error: Package "[redacted]" cannot be added to repository "root package repo" as it is already in repository "root package repo".

Happens with composer install run with version 2.5.7. Was no problem with 2.5.5.

Error: Package "[redacted]" cannot be added to repository "root package repo" as it is already in repository "root package repo".

In BasePackage.php line 137:
                                                                               
  [LogicException]                                                             
  Package "[redacted]" cannot be added to repository "root packag  
  e repo" as it is already in repository "root package repo".                  
                                                                               

Exception trace:
  at phar:///usr/local/bin/composer/src/Composer/Package/BasePackage.php:137
 Composer\Package\BasePackage->setRepository() at phar:///usr/local/bin/composer/src/Composer/Repository/ArrayRepository.php:223
 Composer\Repository\ArrayRepository->addPackage() at phar:///usr/local/bin/composer/src/Composer/Repository/ArrayRepository.php:48
 Composer\Repository\ArrayRepository->__construct() at phar:///usr/local/bin/composer/src/Composer/Repository/RootPackageRepository.php:28
 Composer\Repository\RootPackageRepository->__construct() at /home/runner/work/admin/admin/vendor/laminas/laminas-component-installer/src/PackageProvider/PackageProviderDetectionFactory.php:32
 Laminas\ComponentInstaller\PackageProvider\PackageProviderDetectionFactory->__construct() at /home/runner/work/admin/admin/vendor/laminas/laminas-component-installer/src/PackageProvider/PackageProviderDetectionFactory.php:38
 Laminas\ComponentInstaller\PackageProvider\PackageProviderDetectionFactory::create() at /home/runner/work/admin/admin/vendor/laminas/laminas-component-installer/src/ComponentInstaller.php:163
 Laminas\ComponentInstaller\ComponentInstaller->Laminas\ComponentInstaller\{closure}() at /home/runner/work/admin/admin/vendor/laminas/laminas-component-installer/src/ComponentInstaller.php:963
 Laminas\ComponentInstaller\ComponentInstaller->addPackageToConfig() at /home/runner/work/admin/admin/vendor/laminas/laminas-component-installer/src/ComponentInstaller.php:221
 Laminas\ComponentInstaller\ComponentInstaller->onPostPackageInstall() at phar:///usr/local/bin/composer/src/Composer/EventDispatcher/EventDispatcher.php:206
 Composer\EventDispatcher\EventDispatcher->doDispatch() at phar:///usr/local/bin/composer/src/Composer/EventDispatcher/EventDispatcher.php:148
 Composer\EventDispatcher\EventDispatcher->dispatchPackageEvent() at phar:///usr/local/bin/composer/src/Composer/Installer/InstallationManager.php:396
 Composer\Installer\InstallationManager::Composer\Installer\{closure}() at phar:///usr/local/bin/composer/src/Composer/Installer/InstallationManager.php:411
 Composer\Installer\InstallationManager->executeBatch() at phar:///usr/local/bin/composer/src/Composer/Installer/InstallationManager.php:319
 Composer\Installer\InstallationManager->downloadAndExecuteBatch() at phar:///usr/local/bin/composer/src/Composer/Installer/InstallationManager.php:218
 Composer\Installer\InstallationManager->execute() at phar:///usr/local/bin/composer/src/Composer/Installer.php:797
 Composer\Installer->doInstall() at phar:///usr/local/bin/composer/src/Composer/Installer.php:289
 Composer\Installer->run() at phar:///usr/local/bin/composer/src/Composer/Command/InstallCommand.php:146
 Composer\Command\InstallCommand->execute() at phar:///usr/local/bin/composer/vendor/symfony/console/Command/Command.php:298
 Symfony\Component\Console\Command\Command->run() at phar:///usr/local/bin/composer/vendor/symfony/console/Application.php:1040
 Symfony\Component\Console\Application->doRunCommand() at phar:///usr/local/bin/composer/vendor/symfony/console/Application.php:301
 Symfony\Component\Console\Application->doRun() at phar:///usr/local/bin/composer/src/Composer/Console/Application.php:378
 Composer\Console\Application->doRun() at phar:///usr/local/bin/composer/vendor/symfony/console/Application.php:171
 Symfony\Component\Console\Application->run() at phar:///usr/local/bin/composer/src/Composer/Console/Application.php:141
 Composer\Console\Application->run() at phar:///usr/local/bin/composer/bin/composer:88
 require() at /usr/local/bin/composer:29

install [--prefer-source] [--prefer-dist] [--prefer-install PREFER-INSTALL] [--dry-run] [--download-only] [--dev] [--no-suggest] [--no-dev] [--no-autoloader] [--no-progress] [--no-install] [--audit] [--audit-format AUDIT-FORMAT] [-v|vv|vvv|--verbose] [-o|--optimize-autoloader] [-a|--classmap-authoritative] [--apcu-autoloader] [--apcu-autoloader-prefix APCU-AUTOLOADER-PREFIX] [--ignore-platform-req IGNORE-PLATFORM-REQ] [--ignore-platform-reqs] [--] [<packages>...]

Error: Process completed with exit code 1.
##[debug]Finishing: Install locked dependencies from composer.lock

Originally posted by @Mischosch in #11455 (comment)

@Seldaek
Copy link
Member Author

Seldaek commented Jun 6, 2023

This issue is caused by a combination of Laminas/ComponentInstaller and #11475 both not cloning the root package as they should, so this went boom. It's easy to fix on our end, the problem will remain in the third party code but that's probably not a big deal in isolation.

@Seldaek Seldaek added this to the 2.5 milestone Jun 6, 2023
@Seldaek Seldaek added the Bug label Jun 6, 2023
@stof
Copy link
Contributor

stof commented Jun 6, 2023

@Seldaek shouldn't this be fixed already ?

@Seldaek
Copy link
Member Author

Seldaek commented Jun 6, 2023

Fixed where?

@stof
Copy link
Contributor

stof commented Jun 6, 2023

In the commit you made referencing this issue: 902a153

@Seldaek
Copy link
Member Author

Seldaek commented Jun 6, 2023

Ah well yes it is fixed, just not marked fixed by github yet because not merged back in main branch yet.

@Seldaek Seldaek closed this as completed in 902a153 Jun 7, 2023
@Mischosch
Copy link

🙇 thanks for looking into it!

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

No branches or pull requests

3 participants