-
Notifications
You must be signed in to change notification settings - Fork 136
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
Default to TERM=dumb even if $TERM is set but empty #138
Conversation
We can't handle this case properly in this way, for example, TERM could be set to
I'm relying on I'm honestly baffled where However, if we wanted to be a bit more robust, we could ensure that setupterm is always called with dumb, although I'm worried this will be a little too invasive. I don't think
|
I understand. Your proposed solution would work for us. But don't we know that
doesn't work? I guess that's what you meant with
because if "dumb" isn't available (that's like before when we called "" (empty) or your "I am never going to be a valid terminfo database file" value), we would run into the error I have shown in #137 I think or am I wrong? |
Yes, you would. The thing I don't understand is that the line that's erroring is:
and I cannot find the definition of Maybe we should define a In practice though 99.9% of machines probably have |
Definition of
|
Indeed, but then that's not something defined in blessings at all. That's If blessings changes it's usages of |
I've submitted a small patch to firefox to fix the usage of |
@@ -95,7 +95,7 @@ def __init__(self, kind=None, stream=None, force_styling=False): | |||
# send them to stdout as a fallback, since they have to go | |||
# somewhere. | |||
try: | |||
setupterm(kind or environ.get('TERM', 'dumb'), | |||
setupterm(kind or environ.get('TERM', 'dumb') or 'dumb', |
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.
Do you see anything wrong with setupterm(kind or environ.get('TERM') or 'dumb',
, just to remove repetition?
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.
Not sure if you are asking me. No, I don't see anything wrong with that. The idea is:
Use "kind", if not set, try to read environment variable "TERM" and treat an empty value like TERM is set to "dumb".
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.
Thanks! Tweaked and merged.
…ild-system-reviewers blessings.tigetstr is not part of its API. It happens to work because blessings imports curses using 'from curses import tigetstr'. Instead, we can just use terminal.normal, which contains the string we were going to get anyway. See erikrose/blessings#138 for more information. Let me know if there's a better way of resolving this. Hopefully with this + the patch I submitted to blessings (erikrose/blessings#137) firefox will build fine with TERM improperly set. Differential Revision: https://phabricator.services.mozilla.com/D5377 --HG-- extra : moz-landing-system : lando
…ild-system-reviewers blessings.tigetstr is not part of its API. It happens to work because blessings imports curses using 'from curses import tigetstr'. Instead, we can just use terminal.normal, which contains the string we were going to get anyway. See erikrose/blessings#138 for more information. Let me know if there's a better way of resolving this. Hopefully with this + the patch I submitted to blessings (erikrose/blessings#137) firefox will build fine with TERM improperly set. Differential Revision: https://phabricator.services.mozilla.com/D5377 UltraBlame original commit: f69ecb2abf86e239c528a27f394e88019bd7cdae
…ild-system-reviewers blessings.tigetstr is not part of its API. It happens to work because blessings imports curses using 'from curses import tigetstr'. Instead, we can just use terminal.normal, which contains the string we were going to get anyway. See erikrose/blessings#138 for more information. Let me know if there's a better way of resolving this. Hopefully with this + the patch I submitted to blessings (erikrose/blessings#137) firefox will build fine with TERM improperly set. Differential Revision: https://phabricator.services.mozilla.com/D5377 UltraBlame original commit: f69ecb2abf86e239c528a27f394e88019bd7cdae
…ild-system-reviewers blessings.tigetstr is not part of its API. It happens to work because blessings imports curses using 'from curses import tigetstr'. Instead, we can just use terminal.normal, which contains the string we were going to get anyway. See erikrose/blessings#138 for more information. Let me know if there's a better way of resolving this. Hopefully with this + the patch I submitted to blessings (erikrose/blessings#137) firefox will build fine with TERM improperly set. Differential Revision: https://phabricator.services.mozilla.com/D5377 UltraBlame original commit: f69ecb2abf86e239c528a27f394e88019bd7cdae
We run into this because a Gentoo tinderbox system trying to build current Mozilla Firefox failed to do so because
TERM
wasn't set. Well, it was set but it was set to an empty value, e.g.TERM=
.This small addition to #137 will fix such scenarios as well.
In theory a user could still have set
TERM=" "
which will cause troubles. Not sure if you want to do something liketo catch almost all scenarios...