Closed Bug 1493345 Opened Last year Closed Last year

Build systems uses curses.tigetstr in the blessings namespace

Categories

(Firefox Build System :: General, defect)

defect
Not set

Tracking

(firefox64 fixed)

RESOLVED FIXED
mozilla64
Tracking Status
firefox64 --- fixed

People

(Reporter: jaygkamat, Assigned: jaygkamat)

Details

Attachments

(1 file)

User Agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) QtWebEngine/5.7.1 Chrome/49.0.2623.111 Safari/537.36

Steps to reproduce:

Build system uses 'blessings.tigetstr', but that function isn't defined in blessings. It happens to be pulled from curses, and it may cause crashes when TERM is improperly set.

D5377 fixes this.


Actual results:

error: must call (at least) setupterm() first

  File "/var/tmp/portage/www-client/firefox-60.2.0/work/firefox-60.2.0/python/mach/mach/main.py", line 359, in run
    return self._run(argv)
  File "/var/tmp/portage/www-client/firefox-60.2.0/work/firefox-60.2.0/python/mach/mach/main.py", line 448, in _run
    write_times=write_times)
  File "/var/tmp/portage/www-client/firefox-60.2.0/work/firefox-60.2.0/python/mach/mach/logging.py", line 214, in add_terminal_logging
    formatter.set_terminal(self.terminal)
  File "/var/tmp/portage/www-client/firefox-60.2.0/work/firefox-60.2.0/python/mach/mach/logging.py", line 96, in set_terminal
    self._sgr0 = blessings.tigetstr('sgr0') or '' if terminal and blessings else ''


Expected results:

No crash while building.
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 https://github.com/erikrose/blessings/pull/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 (https://github.com/erikrose/blessings/pull/137) 
firefox will build fine with TERM improperly set.
Comment on attachment 9011162 [details]
Bug 1493345 Fix improper usage of blessings.tigetstr

Ted Mielczarek [:ted] [:ted.mielczarek] has approved the revision.
Attachment #9011162 - Flags: review+
Component: Untriaged → General
Product: Firefox → Firefox Build System
Pushed by tmielczarek@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/f69ecb2abf86
Fix improper usage of blessings.tigetstr r=ted,firefox-build-system-reviewers
https://hg.mozilla.org/mozilla-central/rev/f69ecb2abf86
Status: UNCONFIRMED → RESOLVED
Closed: Last year
Resolution: --- → FIXED
Target Milestone: --- → mozilla64
Assignee: nobody → jaygkamat
You need to log in before you can comment on or make changes to this bug.