Wireshark-dev: [Wireshark-dev] tools\check_spelling.py issue on Windows

Date Prev · Date Next · Thread Prev · Thread Next
From: Tamás Regős <regost@xxxxxxxxx>
Date: Tue, 3 Feb 2026 13:36:15 +0700
Hi Dev Team,

To eliminate minor syntax, spelling and similar bugs locally instead of finding them when the gitlab pipeline fails (again and again) I wanted to use tools\check_dissector.py or other tools e.g check_spelling.py for that matter (on Windows).

However, it seems there is a minor issue in check_spelling.py which prevents it from running on Windows.

Issue

"""
Traceback (most recent call last):
  File "Programs\Python\Python312-32\Lib\concurrent\futures\process.py", line 264, in _process_worker
    r = call_item.fn(*call_item.args, **call_item.kwargs)
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "wireshark\tools\check_spelling.py", line 390, in checkFile
    file.spellCheck(result)
  File "wireshark\tools\check_spelling.py", line 216, in spellCheck
    if word in wiki_db:
               ^^^^^^^
NameError: name 'wiki_db' is not defined
"""

The reason check_spelling.py works in the Wireshark GitLab pipeline but fails on a local Windows computer is due to a fundamental difference in how Linux and Windows handle multitasking in Python.

The "Fork" vs. "Spawn" Difference
  • On Linux (GitLab Pipeline): Python uses the fork method by default. When the script creates sub-processes to check files, it makes an exact copy of the current process's memory. This means the sub-processes "inherit" the wiki_db variable exactly as it was after being filled in the main block.
  • On Windows PC: Python uses the spawn method. Instead of copying memory, it starts a brand-new Python interpreter for every sub-process. Crucially, these new processes do not run the code inside your if __name__ == '__main__': block—they only see the global variables defined outside of it.

Fix

Add 1+1 line somewhere at the beginning of the file (after word_frequency line 44).
# Initialize wiki_db globally so it's accessible to worker processes
wiki_db = {}
 

If it's ok, I would raise an MR for this one line code change.

Please comment.

Thank you.

Regards,
Tamas