Closed Bug 1664665 Opened 4 years ago Closed 4 years ago

Review EnigmailLog.data/getLogData and EnigmailConsole

Categories

(MailNews Core :: Security: OpenPGP, task, P2)

Tracking

(thunderbird_esr78 wontfix)

RESOLVED FIXED
89 Branch
Tracking Status
thunderbird_esr78 --- wontfix

People

(Reporter: standard8, Assigned: mkmelin)

References

(Blocks 1 open bug)

Details

Attachments

(4 files)

In looking through some of the Enigmail code that gets run on startup, I noticed that EnigmailLog.data (in log.jsm) gets initialised as an array, and appended to for every call to log a message (including processing the date object).

It is limited to 2500 messages, which is about ~350kb according to my about:memory.

It seems EnigmailLog.data was intended to be used by getLogData, but that doesn't appear to be used anywhere:

https://searchfox.org/comm-central/search?q=getLogData&path=&case=false&regexp=false

Should getLogData and EnigmailLog.data be dropped now?

Additionally, EnigmailConsole seems to be doing something similar, but with a string pipe that's limited to 32768 characters.

I think that EnigmailConsole data can be displayed on an about page, but I don't see how to get to it from within Thunderbird at the moment:

https://searchfox.org/comm-central/rev/cdb95f99696e2b0d3885bdb45b1c969820dd8d40/mail/extensions/openpgp/content/modules/protocolHandler.jsm#198

Longer term, it might be good to review Enigmail's logging and look to replace it with console.createInstance which creates a specific console instance and behaves like a normal console (this is based off Console.jsm).

Kaie/Patrick, could you advise please on what we need to keep or can get rid of for EnigmailLog/EnigmailConsole?

Flags: needinfo?(patrick)
Flags: needinfo?(kaie)

In Enigmail, there is a dialog that allows you to display the log and save it to a file.
The console was used to display the command line calls of gpg.
But both dialogs don't exist in Thunderbird, and gpg is not called directly anymore.

Therefore, EnigmailConsole can certainly be removed entirely.

EnigmailLog is still partially in use. If you set

  1. the pref "temp.openpgp.logDirectory" to a valid directory, and
  2. the env var NSPR_LOG_MODULES=enigmail.js:5
    then you'll get a log file with all EnigmailLog.DEBUG() entries.
Flags: needinfo?(patrick)
Flags: needinfo?(kaie)
Priority: -- → P2
Blocks: 1595318
Type: defect → task
Assignee: nobody → mkmelin+mozilla
Status: NEW → ASSIGNED
Target Milestone: --- → 89 Branch

This error handling is just small local methods. Moving it there means less complexity and more readability.

Pushed by mkmelin@iki.fi:
https://hg.mozilla.org/comm-central/rev/5ad8257d3c02
Remove EnigmailConsole. r=PatrickBrunschwig
https://hg.mozilla.org/comm-central/rev/438b02477534
Remove EnigmailLog.data/getLogData. r=PatrickBrunschwig
https://hg.mozilla.org/comm-central/rev/cede723c0d99
remove mail/extensions/openpgp/content/modules/searchCallback.jsm. r=PatrickBrunschwig
https://hg.mozilla.org/comm-central/rev/7ba95d2d89a7
remove/inline mail/extensions/openpgp/content/modules/errorHandling.jsm. r=PatrickBrunschwig

Status: ASSIGNED → RESOLVED
Closed: 4 years ago
Resolution: --- → FIXED
Regressions: 1873655
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: