Open Bug 2079145 Opened 1 month ago Updated 20 hours ago

Make LogModule::Get reject log module names that MOZ_LOG can't parse

Categories

(Core :: XPCOM, enhancement)

enhancement

Tracking

()

REOPENED

People

(Reporter: dcarver, Assigned: dcarver)

References

(Depends on 1 open bug, Blocks 1 open bug)

Details

Attachments

(1 external file)

Plan:

  1. Consider changing the MOZ_LOG parser so that space is no longer a delimiter and trailing spaces are trimmed?
  2. Rename the modules that cannot be controlled through MOZ_LOG:
  3. Make LogModule::Get return nullptr, with a warning, for invalid names.
  4. Handle nullptr in the callers that use the module without checking it: LogModulePrefWatcher, Console, LogModuleManager::Init and SpiderMonkey's GetLoggerByName.
See Also: → 2080769

The severity field is not set for this bug.
:nika, could you have a look please?

For more information, please visit BugBot documentation.

Flags: needinfo?(nika)

this isn't a defect

Type: defect → enhancement
Flags: needinfo?(nika)
See Also: → 2084142

Bug 2084142 replaces this plan. Log module names now match by a key in ASCII lowercase that keeps only letters, digits, _, - and ., so modules such as Login crypto or *** PurgeTrackerService: can be configured without being renamed, and LogModule::Get no longer needs to reject names. Bug 2080769 covers spaces in names.

The one module still out of reach is 3pcbexception: MOZ_LOG doesn't accept a name starting with a digit.

Status: ASSIGNED → RESOLVED
Closed: 1 month ago
Resolution: --- → WONTFIX
See Also: → 2084279
See Also: → 2084854
Status: RESOLVED → REOPENED
Resolution: WONTFIX → ---
See Also: → 2094687

LazyLogModule names are checked at compile time, but LogModule::Get also gets
names at runtime, from the logModule or the prefix of the JS consoles, the
logging.<name> prefs and SpiderMonkey's loggers. A name that isn't a valid log
module name, as IsValidLogModuleName tells, can't be set in MOZ_LOG, so DEBUG
builds now report it with a warning. The module is still created and
returned, so the callers don't change.

The check runs before CreateOrGetModule takes mModulesLock: NS_WARNING records
a profiler marker, which must not happen under that lock.

You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: