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

From: Yousef Alhouseen

Date: Thu Jun 25 2026 - 05:02:26 EST


Hi SJ,

You're right; the normal invocation path is through the drgn launcher,
so the no-drgn case I described is too narrow to justify the patch as
written.

Please drop this patch.

Thanks,
Yousef


On Wed, 24 Jun 2026 17:27:52 -0700, SeongJae Park <sj@xxxxxxxxxx> wrote:
> 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
>
> [...]