Closed Bug 1891886 Opened 1 year ago Closed 1 year ago

python/mozbuild/mozbuild/controller/building.py uses hasattr("handler") but probably means "_handler", used elsewhere in file.

Categories

(Firefox Build System :: General, defect)

defect

Tracking

(firefox127 fixed)

RESOLVED FIXED
127 Branch
Tracking Status
firefox127 --- fixed

People

(Reporter: jgilbert, Assigned: jgilbert)

Details

Attachments

(1 file)

/attr\(.*"handler"/:
https://searchfox.org/mozilla-central/search?q=attr%5C%28.*%22handler%22&path=&case=false&regexp=true

Number of results: 2 (maximum is around 4000)
 
§ Core code (2 lines across 1 files)
 
▼ Textual Occurrences (2 lines across 1 files)
	python/mozbuild/mozbuild/controller/building.py
681	have_handler = hasattr(self, "handler")
743	have_handler = hasattr(self, "handler")
[EOF]

/\._handler/:
https://searchfox.org/mozilla-central/search?q=%5C._handler&path=*py&case=true&regexp=true

§ Core code (6 lines across 1 files)
 
▼ Textual Occurrences (6 lines across 1 files)
	python/mozbuild/mozbuild/controller/building.py
627	self._handler = TerminalLoggingHandler()
628	self._handler.setFormatter(log_manager.terminal_formatter)
629	self._handler.footer = self.footer
631	old = log_manager.replace_terminal_handler(self._handler)
632	self._handler.level = old.level
641	self._handler.footer = None
 
§ Third-party code (11 lines across 4 files)
[...]

Elsewhere in this file, we set ._handler, but never .handler. This
was probably missed in a refactor, possibly long ago. hasattr is
hazardous like this, so it would be even better not to use it, but we
can at least do the right thing the wrong way, rather than what seems to
be the wrong thing here before this change.

I was hoping that this might fix the ansi escape code corruption that
happens during builds for me, but it does not seem to.
Still, this seems like what was intended, so let's assert and try to
move forward.

Assignee: nobody → jgilbert
Status: NEW → ASSIGNED
Pushed by jgilbert@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/d5a79ab1ec0f Check for hasattr("_handler") not "handler" in mozbuild/controller/building.py. r=firefox-build-system-reviewers,glandium
Status: ASSIGNED → RESOLVED
Closed: 1 year ago
Resolution: --- → FIXED
Target Milestone: --- → 127 Branch
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: