Re: [PATCH] tools/writeback: parse help before importing drgn

From: SeongJae Park

Date: Wed Jun 24 2026 - 20:28:15 EST


On Wed, 24 Jun 2026 14:35:14 +0200 Yousef Alhouseen <alhouseenyousef@xxxxxxxxx> wrote:

> wb_monitor.py imports drgn before argparse can handle "-h". That makes
> help fail on systems where drgn is not installed, even though the script
> does not need drgn to print usage text.

But... How do you execute the drgn script on systems not having drgn? I tried
to mimic the situation and reproduce the issue you are saying about, but what I
get is like below:

$ sudo mv /usr/bin/drgn /usr/bin/drgn.bak
$ drgn tools/writeback/wb_monitor.py
-bash: /usr/bin/drgn: No such file or directory
$ python tools/writeback/wb_monitor.py
Traceback (most recent call last):
File "/home/lkhack/linux/tools/writeback/wb_monitor.py", line 44, in <module>
bdi_list = prog['bdi_list']
^^^^
NameError: name 'prog' is not defined


Thanks,
SJ

[...]