Skip to content

Workaround the Gradle crash due to non ASCII characters.#26024

Merged
amirh merged 1 commit intoflutter:masterfrom
amirh:unset_pr_message
Jan 4, 2019
Merged

Workaround the Gradle crash due to non ASCII characters.#26024
amirh merged 1 commit intoflutter:masterfrom
amirh:unset_pr_message

Conversation

@amirh
Copy link
Contributor

@amirh amirh commented Jan 3, 2019

Cirrus puts the PR description and commit message in environment
variables.
These messages tend to have non ASCII characters sometimes (like
emojis), which triggers a Gradle bug (gradle/gradle#3117) resulting
in Gradle crashing without a helpful error message.

The real solution to this problem should be fixing the Gradle bug.
The better workaround on the Flutter side would be to set a UTF8 locale
on the Cirrus machine, but I have yet figured out how to do it.
For now to avoid more people from hitting this I'm working around by
temporarily unsetting the Cirrus environment variables with the PR
description and commit message.

A non ASCII character to make sure it works: 😄

More details (including my failed attempts to set a UTF8 locale on Cirrus) here: #24935

@amirh amirh force-pushed the unset_pr_message branch from 1340331 to 933de9f Compare January 3, 2019 20:26
@amirh amirh changed the title [WIP] Workaround the Gradle crash due to non ASCII chars. Workaround the Gradle crash due to non ASCII chars. Jan 3, 2019
Cirrus puts the PR description and commit message in environment
variables.
These messages tend to have non ASCII characters sometimes (like
emojis), which triggers a Gradle bug (gradle/gradle#3117) resulting
in Gradle crashing without a helpful error message.

The real solution to this problem should be fixing the Gradle bug.
The better workaround on the Flutter side would be to set a UTF8 locale
on the Cirrus machine, but I have yet figured out how to do it.
For now to avoid more people from hitting this I'm working around by
temporarily unsetting the Cirrus environment variables with the PR
description and commit message.

A non ASCII character to make sure it works: 😄
@amirh amirh force-pushed the unset_pr_message branch from 933de9f to b54e22e Compare January 3, 2019 20:27
@amirh amirh changed the title Workaround the Gradle crash due to non ASCII chars. Workaround the Gradle crash due to non ASCII characters. Jan 3, 2019
@Hixie
Copy link
Contributor

Hixie commented Jan 3, 2019

Rather than doing this in our cirrus config, how about making the flutter tool filter all the environment variables? That would solve the problem for our users too.

@amirh
Copy link
Contributor Author

amirh commented Jan 3, 2019

I'm not sure we want to do this for our users, if you have your locale properly set to UTF8 it won't crash (which I want to believe is the case on most end user machines), and touching environment variables we know nothing about sounds dangerous.

Note that I did it in the cirrus script and not in bots/test.dart as I wanted to keep a consistent temp-workaround here and in flutter/plugins#1031.

Hopefully this workaround will be very temporary (and will be replaced by a less temporary workaround - set a UTF8 locale on the Cirrus image).

@Hixie
Copy link
Contributor

Hixie commented Jan 3, 2019

Fair enough. My worry is that people will run into this and not know what to do (it took us forever to figure it out too). If we could have the flutter tool at least detect the situation and link to the relevant Gradle bug report that would be really helpful to our users.

@amirh
Copy link
Contributor Author

amirh commented Jan 3, 2019

Agreed regarding having the flutter tool show a warning, the reason it isn't trivial is that I'm not sure how to detect the bad state, e.g I know you need a non-ASCII character in the environment, and a locale that is not properly set to handle UTF8, though I don't currently know how to characterize the error (if you follow my attempt description on #24935 you'll see that just checking the value of LANG is not enough).
We have #25589 to track a warning in the flutter tool.

@bparrishMines bparrishMines self-requested a review January 4, 2019 00:00
Copy link
Contributor

@bparrishMines bparrishMines left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@amirh amirh merged commit 3782b6a into flutter:master Jan 4, 2019
@amirh amirh deleted the unset_pr_message branch January 4, 2019 00:27
@zoechi zoechi added the c: contributor-productivity Team-specific productivity, code health, technical debt. label Jan 4, 2019
kangwang1988 pushed a commit to XianyuTech/flutter that referenced this pull request Feb 12, 2019
Cirrus puts the PR description and commit message in environment
variables.
These messages tend to have non ASCII characters sometimes (like
emojis), which triggers a Gradle bug (gradle/gradle#3117) resulting
in Gradle crashing without a helpful error message.

The real solution to this problem should be fixing the Gradle bug.
The better workaround on the Flutter side would be to set a UTF8 locale
on the Cirrus machine, but I have yet figured out how to do it.
For now to avoid more people from hitting this I'm working around by
temporarily unsetting the Cirrus environment variables with the PR
description and commit message.

A non ASCII character to make sure it works: 😄
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Aug 8, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

c: contributor-productivity Team-specific productivity, code health, technical debt.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants