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

2.3 snapshot endless loop bug #10648

Closed
staabm opened this issue Mar 21, 2022 · 4 comments
Closed

2.3 snapshot endless loop bug #10648

staabm opened this issue Mar 21, 2022 · 4 comments
Labels
Milestone

Comments

@staabm
Copy link
Contributor

staabm commented Mar 21, 2022

first: sorry for the not really usefull report... I don't know yet the steps on how to repro it better.

running composer 2.3-snapshot commands on my windows laptop I get a kind of endless-loop which looks like

d - discard this, do not change composer.json and do not allow the plugin to run
? - print help
y - add package to allow-plugins in composer.json and let it run immediately
n - add package (as disallowed) to allow-plugins in composer.json to suppress further prompts
d - discard this, do not change composer.json and do not allow the plugin to run
? - print help
y - add package to allow-plugins in composer.json and let it run immediately
n - add package (as disallowed) to allow-plugins in composer.json to suppress further prompts
d - discard this, do not change composer.json and do not allow the plugin to run
? - print help
y - add package to allow-plugins in composer.json and let it run immediately
n - add package (as disallowed) to allow-plugins in composer.json to suppress further prompts
d - discard this, do not change composer.json and do not allow the plugin to run
? - print help
y - add package to allow-plugins in composer.json and let it run immediately
n - add package (as disallowed) to allow-plugins in composer.json to suppress further prompts
d - discard this, do not change composer.json and do not allow the plugin to run
? - print help
y - add package to allow-plugins in composer.json and let it run immediately
n - add package (as disallowed) to allow-plugins in composer.json to suppress further prompts
d - discard this, do not change composer.json and do not allow the plugin to run
? - print help
y - add package to allow-plugins in composer.json and let it run immediately
n - add package (as disallowed) to allow-plugins in composer.json to suppress further prompts
d - discard this, do not change composer.json and do not allow the plugin to run
? - print help
y - add package to allow-plugins in composer.json and let it run immediately
n - add package (as disallowed) to allow-plugins in composer.json to suppress further prompts
d - discard this, do not change composer.json and do not allow the plugin to run
? - print help
y - add package to allow-plugins in composer.json and let it run immediately
n - add package (as disallowed) to allow-plugins in composer.json to suppress further prompts
d - discard this, do not change composer.json and do not allow the plugin to run
? - print help
y - add package to allow-plugins in composer.json and let it run immediately
n - add package (as disallowed) to allow-plugins in composer.json to suppress further prompts
d - discard this, do not change composer.json and do not allow the plugin to run
? - print help
y - add package to allow-plugins in composer.json and let it run immediately
n - add package (as disallowed) to allow-plugins in composer.json to suppress further prompts
d - discard this, do not change composer.json and do not allow the plugin to run
? - print help
y - add package to allow-plugins in composer.json and let it run immediately
n - add package (as disallowed) to allow-plugins in composer.json to suppress further prompts
d - discard this, do not change composer.json and do not allow the plugin to run
? - print help
y - add package to allow-plugins in composer.json and let it run immediately
n - add package (as disallowed) to allow-plugins in composer.json to suppress further prompts
d - discard this, do not change composer.json and do not allow the plugin to run
? - print help
y - add package to allow-plugins in composer.json and let it run immediately
n - add package (as disallowed) to allow-plugins in composer.json to suppress further prompts
d - discard this, do not change composer.json and do not allow the plugin to run
? - print help

it seem to happen when running composer update and these composer scripts are defined:

...
    "scripts": {
        "bin": "echo 'bin not installed - use `composer bin all install` to install binaries'",
        "post-update-cmd": ["@composer bin all update --ansi"],
...

we are using https://github.com/bamarni/composer-bin-plugin


in composer stable the same situation leads to

Generating autoload files
Loading composer repositories with package information
Updating dependencies
Nothing to modify in lock file
Writing lock file
Installing dependencies from lock file (including require-dev)
Package operations: 67 installs, 0 updates, 0 removals
  - Installing rector/extension-installer (0.10.2): Extracting archive
rector/extension-installer contains a Composer plugin which is currently not in your allow-plugins config. See https://getcomposer.org/allow-plugins
Do you trust "rector/extension-installer" to execute code and wish to enable it now? (writes "allow-plugins" to composer.json) [y,n,d,?] Plugin initialization failed (Aborted), uninstalling plugin
  - Removing rector/extension-installer (0.10.2)
    Install of rector/extension-installer failed


  [Symfony\Component\Console\Exception\RuntimeException]
  Aborted


update [--with WITH] [--prefer-source] [--prefer-dist] [--prefer-install PREFER-INSTALL] [--dry-run] [--dev] [--no-dev] [--lock] [--no-install] [--no-autoloader] [--no-suggest] [--no-progress] [-w|--with-dependencies] [-W|--with-all-dependencies] [-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] [--prefer-stable] [--prefer-lowest] [-i|--interactive] [--root-reqs] [--] [<packages>]...

Script @composer bin all update --ansi handling the post-update-cmd event returned with error code 1
@staabm staabm changed the title 2.3 snapshot bug 2.3 snapshot endless loop bug Mar 21, 2022
@Seldaek Seldaek added this to the 2.3 milestone Mar 30, 2022
@Seldaek Seldaek added the Bug label Mar 30, 2022
@Seldaek
Copy link
Member

Seldaek commented Mar 30, 2022

Seems like the IO is not interactive but is still seen as such? Thus it defaults to ? and prints the help in a loop..

Setting -n in your post-update-cmd should fix it I suspect. But anyway Composer probably should not endless loop like this so I'll look at fixing that.

@Seldaek
Copy link
Member

Seldaek commented Mar 30, 2022

Can you please try with latest snapshot see if this resolves it for you?

@staabm
Copy link
Contributor Author

staabm commented Mar 30, 2022

I doesn't look super nice, but it works now

...
Installing dependencies from lock file (including require-dev)
Package operations: 68 installs, 0 updates, 0 removals
  - Installing composer/package-versions-deprecated (1.11.99.5): Extracting archive
  - Installing rector/extension-installer (0.10.2): Extracting archive
rector/extension-installer contains a Composer plugin which is currently not in your allow-plugins config. See https://getcomposer.org/allow-plugins
Do you trust "rector/extension-installer" to execute code and wish to enable it now? (writes "allow-plugins" to composer.json) [y,n,d,?] y - add package to allow-plugins in composer.json and let it run immediately
n - add package (as disallowed) to allow-plugins in composer.json to suppress further prompts
d - discard this, do not change composer.json and do not allow the plugin to run
? - print help
y - add package to allow-plugins in composer.json and let it run immediately
n - add package (as disallowed) to allow-plugins in composer.json to suppress further prompts
d - discard this, do not change composer.json and do not allow the plugin to run
? - print help
y - add package to allow-plugins in composer.json and let it run immediately
n - add package (as disallowed) to allow-plugins in composer.json to suppress further prompts
d - discard this, do not change composer.json and do not allow the plugin to run
? - print help
y - add package to allow-plugins in composer.json and let it run immediately
n - add package (as disallowed) to allow-plugins in composer.json to suppress further prompts
d - discard this, do not change composer.json and do not allow the plugin to run
? - print help
y - add package to allow-plugins in composer.json and let it run immediately
n - add package (as disallowed) to allow-plugins in composer.json to suppress further prompts
d - discard this, do not change composer.json and do not allow the plugin to run
? - print help
y - add package to allow-plugins in composer.json and let it run immediately
n - add package (as disallowed) to allow-plugins in composer.json to suppress further prompts
d - discard this, do not change composer.json and do not allow the plugin to run
? - print help
  - Installing composer/semver (3.3.1): Extracting archive
  - Installing psr/log (2.0.0): Extracting archive
  - Installing composer/pcre (1.0.1): Extracting archive
  - Installing composer/xdebug-handler (2.0.5): Extracting archive
  - Installing doctrine/inflector (2.0.4): Extracting archive
  - Installing symfony/polyfill-mbstring (v1.25.0): Extracting archive
  - Installing ergebnis/json-printer (3.2.0): Extracting archive
  - Installing idiosyncratic/editorconfig (0.1.3): Extracting archive
...

thanks for the fast fix

@Seldaek
Copy link
Member

Seldaek commented Mar 30, 2022

Yeah if you have time you could try to figure out why $io->isInteractive() returns true in your env.. Or as I said add -n to make it explicit it is not interactive, I believe it should remove the prompts:

   "post-update-cmd": ["@composer bin all update --ansi -n"],

And another alternative is of course to configure allow-plugins correctly so it stops prompting :)

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

2 participants