symfony / flex

Composer plugin for Symfony
MIT License
4.17k stars 183 forks source link

Symfony Flex fails when using Composer 2.7.0, running as root #1013

Closed ThomasBerends closed 9 months ago

ThomasBerends commented 9 months ago

Yesterday since the release of Composer 2.7.0, pipelines started failing for me.

The error:

Generating autoload files
137 packages you are using are looking for funding.
Use the `composer fund` command to find out more!
> symfony-cmd
sh: 1: symfony-cmd: not found
Script symfony-cmd handling the auto-scripts event returned with error code 127
Script @auto-scripts was called via post-install-cmd

The steps related:

                  - curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer
                  - composer install

This was solved by adding --version=2.6.6 to the Composer installation, but that's of course a temporary solution.

This seems to happen on a simple Symfony 6.3 project. I haven't tested on other projects.

Full steps:

                  - echo "memory_limit = 512M" > $PHP_INI_DIR/conf.d/docker-php-custom.ini
                  - cd app
                  - apt-get update && apt-get install -y libfreetype6-dev libjpeg62-turbo-dev libpng-dev
                  - apt-get install -y libzip-dev git wget --no-install-recommends libicu-dev
                  - apt-get clean
                  - apt-get install -y libicu-dev
                  - docker-php-ext-configure intl
                  - docker-php-ext-configure gd --with-freetype --with-jpeg
                  - docker-php-ext-install pdo mysqli pdo_mysql zip intl gd
                  - curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer
                  - composer install
                  - ./vendor/bin/phpcs
                  - ./vendor/bin/phpstan analyse -c phpstan.neon
                  - ./vendor/bin/phpunit

On the php:8.2 image, provided by Bitbucket.

If there's any questions, feel free to reply or I'm ThomasToSpace in the Symfony Slack.

xabbuh commented 9 months ago

Are you by chance running Composer as root?

wouterj commented 9 months ago

From docker-php-ext-configure, I guess these steps are run without a Docker container. That more or less implies indeed that the commands are run as root.

xabbuh commented 9 months ago

see composer/composer#11839 then

ThomasBerends commented 9 months ago

Hmm, weird that I didn't get any of the mentioned warnings. Bit of a shock that Bitbucket runs everything as root by default.

I've adapted the title. Shall I close the bug as well since it's not directly related to Flex?

stof commented 9 months ago

Closing this as this is indeed not directly related to Flex.

stof commented 9 months ago

@ThomasBerends the output snippet you shared in the issue started at the autoload generation, meaning that it was not the full composer output. The warning is one of the first things displayed by composer. https://github.com/composer/composer/pull/11842 should make that easier to notice in 2.7.1+ by also showing a warning at the time an error is reported.

ThomasBerends commented 9 months ago

@stof Can confirm this is the case. I see the warnings now indeed. Completely glossed over it due to the lack of colors in Bitbucket's output.

Thanks!