Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork9.7k
Revert "bug #33897 [Console] Consider STDIN interactive (ostrolucky)"#36027
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Uh oh!
There was an error while loading.Please reload this page.
Conversation
ostrolucky commentedMar 11, 2020 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
We should consider changing QuestionHelper so it falls back to non-interactive behaviour if it's unable to read the input. That would cover both use cases. |
nicolas-grekas left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
I'm with@ostrolucky about the unexpected behavior this produced.
I know no other unix commands that behave like that.
Let's consider#36031 first.
teohhanhui commentedMar 12, 2020
@nicolas-grekas#33897 muddles the water on what (non-)interactive means, using a definition which is inconsistent with the existing UNIX command line tools and literature:#30726 (comment) As@ostrolucky has admitted in#30726 (comment), it's possible to fix#30726 by untying the behaviour of That should make sure we don't redefine what "interactive" means and risk breaking many users. |
…input (ostrolucky)This PR was merged into the 4.4 branch.Discussion----------[Console] Fallback to default answers when unable to read input| Q | A| ------------- | ---| Branch? | 4.4| Bug fix? | yes| New feature? | no| Deprecations? | no| Tickets |Fix#36027,Fix#35988| License | MIT| Doc PR |Alternative to#36027.This fixes linked issues without having to revert fix for#30726. Successfully tested with composer script, `docker run` and `docker run -it`.Commits-------8ddaa20 [Console] Fallback to default answers when unable to read input
…input (ostrolucky)This PR was merged into the 4.4 branch.Discussion----------[Console] Fallback to default answers when unable to read input| Q | A| ------------- | ---| Branch? | 4.4| Bug fix? | yes| New feature? | no| Deprecations? | no| Tickets | Fix #36027, Fix #35988| License | MIT| Doc PR |Alternative tosymfony/symfony#36027.This fixes linked issues without having to revert fix for #30726. Successfully tested with composer script, `docker run` and `docker run -it`.Commits-------8ddaa20b29 [Console] Fallback to default answers when unable to read input
teohhanhui commentedMar 16, 2020
I hope the maintainers can take a good look at the arguments in this and related issues and PRs. Can we come to the agreement that changing the definition of (non-)interactive is a BC break? Fixing |
ostrolucky commentedMar 16, 2020 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
Nobody was able to provide example of package having such code. And in same way as changing definition of interactive flag can in theory break code, dropping its usage from Regarding BC break, yes. But you need to realize every bug fix is BC break for everybody relying on such bug. Change of behaviour is not covered by Symfony BC promise, only change of API. |
teohhanhui commentedMar 17, 2020 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
Changing the definition of interactivity to go against extensive existing command line tools and literature is not sensible and should never have been done. If the intent really is to have a Symfony-specific definition of interactivity (why?), then it must be well documented (and even then, it'll be a major gotcha) and certainly not something that should be done in a patch release.
That's comparing apples to oranges. If people have assumptions about how |
ostrolucky commentedMar 17, 2020
We already had this disccussion in#30726 (comment) I don't see any paragraph in your links which would forbid labeling command interactive if it can receive input from user programatically without pressing individual keys. They even go contrary to your opinion: First link mentioning It's also clearly not such a big BC break because nobody bothered to post link to public project that this change breaks. I agree it would be better to not do this in patch release. I didn't intend to do that, but it's done. |
teohhanhui commentedMar 17, 2020 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
Let us get into the nitty-gritty of it then. Fromhttps://www.tldp.org/LDP/abs/html/intandnonint.html, if you look at the last code snippet, there's a
Apparently, PHP has
It wasn't implying that
and
There's something that you've missed. Fromhttps://pubs.opengroup.org/onlinepubs/9699919799/utilities/sh.html:
and
|
teohhanhui commentedMar 17, 2020
Why this is important Compliance to POSIX standards ensures the best chance of interoperability with other command line tools. This is not just about PHP programs. Userswill experience unexpected behaviours otherwise (because we generally assume that command line tools play by POSIX rules), that they will then have to work around. |
ostrolucky commentedMar 17, 2020
It's ironic that this was done to be more POSIX compliant, as there are no POSIX tools that accept user input, but don't accept them via redirection. This was broken in symfony/console for years, then again my PR was without proper feedback for months, even though title clearly explained very same thing you are arguing against now. My goal was achieved and despite that, I was willing to create 3rd PR provided somebody would link me public project for which such change is BC breaking. Nobody did, so I assume either it doesn't exist or nobody was motivated enough to find it. I don't have energy to make it "perfect" for one set of people, only so another set of people will come complaining about question helper that stopped respecting interactive flag and they have difficulties testing it. If you think this is important, I think it would be better if you create a PR with your sugggestions, then you provide support for these people. You have my support. If you don't like that, watch pull requests of symfony more often so you can provide feedback when there is right time for it. |
danepowell commentedMar 19, 2020
This is definitely a BC break. It just killed our project. Here's a passing test (on Symfony Console 4.4.4) and a failing one (on 4.4.5):
Note that the text before the failure ("We strive...") comes from the following line and should not appear in the context of this non-interactive command (see the isInteractive() conditional): This should not have changed in a point release, it was very hard to diagnose the root cause. I'm not sure how we're supposed to work around it now. |
nicolas-grekas commentedMar 19, 2020
@danepowell can you confirm#36031 fixes the issue for you too? |
danepowell commentedMar 19, 2020
@nicolas-grekas thanks, indeed that seems to fix it. Thanks for the reference, I didn't catch that in all of the other discussion. |
helhum commentedApr 23, 2020
@ostrolucky Here is a breaking scenario: Calling the command without attached terminal, will still call the interact method, which calls Yes, the command would have failed before as well. But it would have failed with a proper error message that the argument is missing. Now an infinite loop is triggered, because thehidden response is empty, but it is checked for Besides that, even for not hidden questions the output of the command is quite different. Before this change While this can be handled by catching the That said, my conclusion would be, that this change should rather be reverted in Symfony < 5 and the hidden question behaviour needs to be fixed in 5.x |
chalasr commentedApr 23, 2020
@helhum Can you please transform your comment into a new issue (following the bug report template)? That would be great. |
ostrolucky commentedApr 23, 2020
Indeed, please create issue. Example command would be great as well, because I wasn't able to quite follow what should I do to reproduce this. |
helhum commentedApr 24, 2020
@chalasr@ostrolucky here we go:#36565 |
ostrolucky commentedApr 24, 2020
Issue you created looks awesome! I'm actually surprised of effort you must have put into this. Nevertheless, thanks! 🥇 I'll look into this in detail ASAP. |
helhum commentedApr 24, 2020
I'm an OSS maintainer myself and I know how helpful good bug reports are 😃 |
Uh oh!
There was an error while loading.Please reload this page.
This reverts#33897, as it removes detection of a (pseudo-)TTY, while trying to fix a separate issue. it broke many more use cases than it solved.
Some more discussionhere.
I'm opening here as@ostrolucky said on slack he didn't want to continue discussion on old PR's. That's fair.
My specific grief with the change was that it breaks
docker runwhen not using a tty.This should not be interactive:
docker run --rm IMAGE bin/consolecommandthis should be interactive:
docker run --rm -it IMAGE bin/consolecommandwith#33897, both the above commands make the console interactive.