From 3b4b33f776c85a6acd8792b2f20d4a07797e9107 Mon Sep 17 00:00:00 2001 From: Ricardo Baratto Date: Wed, 28 Oct 2026 16:23:01 -0400 Subject: [PATCH] cmdline: Prevent exception when ddata is called with no arguments The chkx command line parser assumes set_defaults has been called with a 'func' argument and ddata wasn't doing that. This would cause an exception to be raised if you call ddata by itself: ``` $ chkx ddata Traceback (most recent call last): File ".../chb/cmdline/chkx", line 2047, in args.func(args) ^^^^^^^^^ AttributeError: 'Namespace' object has no attribute 'func' ``` To keep things simple, the default function just tells the user to run with --help to get all the details. ``` $ chkx ddata Run ddata --help to see available subcommands ``` --- chb/cmdline/chkx | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/chb/cmdline/chkx b/chb/cmdline/chkx index d09597c8..bce4bf71 100755 --- a/chb/cmdline/chkx +++ b/chb/cmdline/chkx @@ -266,6 +266,10 @@ def simulatecommand(args: argparse.Namespace) -> NoReturn: exit(0) +def ddatacommand(args: argparse.Namespace) -> NoReturn: + print("Run ddata --help to see available subcommands") + exit(0) + ''' def reportappcalls(args): (path,filename) = UC.get_path(args.xname,checkresults=True) @@ -601,6 +605,7 @@ def parse() -> argparse.Namespace: # -------------------------------------------------------- disassembly data -- ddatacmd = subparsers.add_parser("ddata") + ddatacmd.set_defaults(func=ddatacommand) ddataparsers = ddatacmd.add_subparsers(title="show options") # -- ddata globalvars --