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

From: Martin Mathieson <martin.r.mathieson@xxxxxxxxxxxxxx>
Date: Tue, 3 Feb 2026 10:06:52 +0000
Glad you were able to quickly recreate - I will get them merged at some point today.
I'm definitely missing something about these remote branches - I sometimes notice some that were not automatically deleted and I don't know why..
Martin

On Tue, Feb 3, 2026 at 9:59 AM Tamás Regős <regost@xxxxxxxxx> wrote:
I have to recreate it all from scratch then. I'll do 2 new MRs. It's all deleted locally and remotely...

Sorry :)

For me the auto delete never works, I have to delete the branches manually at the end.


On Tue, 3 Feb 2026 at 16:56, Martin Mathieson via Wireshark-dev <wireshark-dev@xxxxxxxxxxxxx> wrote:
Yes, never seen that before (commits and changes gone!), usually I leave the branch (on gitlab) to be automatically deleted once the merge has completed.

Do you still have your local branches..?
Martin

On Tue, Feb 3, 2026 at 9:38 AM Tamás Regős <regost@xxxxxxxxx> wrote:
I might have deleted my branches too early before the merge was fully completed?

Can you please check?


On Tue, 3 Feb 2026 at 15:48, Martin Mathieson via Wireshark-dev <wireshark-dev@xxxxxxxxxxxxx> wrote:
Hi Tamas, your change makes good sense to me.  Happy for you to raise an MR.

Thanks!
Martin

On Tue, Feb 3, 2026 at 6:36 AM Tamás Regős <regost@xxxxxxxxx> wrote:
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
_______________________________________________
Wireshark-dev mailing list -- wireshark-dev@xxxxxxxxxxxxx
To unsubscribe send an email to wireshark-dev-leave@xxxxxxxxxxxxx
_______________________________________________
Wireshark-dev mailing list -- wireshark-dev@xxxxxxxxxxxxx
To unsubscribe send an email to wireshark-dev-leave@xxxxxxxxxxxxx
_______________________________________________
Wireshark-dev mailing list -- wireshark-dev@xxxxxxxxxxxxx
To unsubscribe send an email to wireshark-dev-leave@xxxxxxxxxxxxx
_______________________________________________
Wireshark-dev mailing list -- wireshark-dev@xxxxxxxxxxxxx
To unsubscribe send an email to wireshark-dev-leave@xxxxxxxxxxxxx
_______________________________________________
Wireshark-dev mailing list -- wireshark-dev@xxxxxxxxxxxxx
To unsubscribe send an email to wireshark-dev-leave@xxxxxxxxxxxxx