From 9eec04f0f36189adc97e4464c7b52f835ca5583c Mon Sep 17 00:00:00 2001 From: Jan Lindemann Date: Thu, 1 Oct 2026 06:54:51 +0200 Subject: [PATCH] cmds.posix.copy: Allow missing mode option The -m option of posix copy is optional, and its argparse default is None, but _run() converts it unconditionally and crashes: mode = int(args.mode, 0) so every copy without -m died with TypeError: int() can't convert non-string with explicit base before the copy even started. Convert the mode only when it is given, and pass None otherwise, which copy() already treats as "no mode change". Signed-off-by: Jan Lindemann Assisted-by: unsloth/Qwen3.8-27B-GGUF:Q4_K_M with pi.dev v0.99.2 --- src/python/jw/pkg/cmds/posix/CmdCopy.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/python/jw/pkg/cmds/posix/CmdCopy.py b/src/python/jw/pkg/cmds/posix/CmdCopy.py index cd9b7dab..aa578b64 100644 --- a/src/python/jw/pkg/cmds/posix/CmdCopy.py +++ b/src/python/jw/pkg/cmds/posix/CmdCopy.py @@ -58,6 +58,7 @@ class CmdCopy(Cmd): # export __expand(args.dst), owner = args.owner, group = args.group, - mode = int(args.mode, 0), + # -- A mode is given as a string, if at all + mode = int(args.mode, 0) if args.mode is not None else None, recursive = args.recursive, )