From eb984bbc56cfcdaecf6707a0c1d585b265bb7c2a Mon Sep 17 00:00:00 2001 From: Aarav Gupta Date: Mon, 16 Mar 2026 06:28:38 +0530 Subject: [PATCH 1/4] fix(substitution_args.py): _resolve_args() not finding commands --- xacro/substitution_args.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/xacro/substitution_args.py b/xacro/substitution_args.py index b022e821..3eabc031 100644 --- a/xacro/substitution_args.py +++ b/xacro/substitution_args.py @@ -39,6 +39,7 @@ import math import os +import shlex import yaml from io import StringIO @@ -332,10 +333,10 @@ def _resolve_args(arg_str, context, commands): valid = ['find', 'env', 'optenv', 'dirname', 'arg'] resolved = arg_str for a in _collect_args(arg_str): - splits = [s for s in a.split(' ') if s] - if not splits[0] in valid: + splits = shlex.split(a) + if splits[0] not in valid: raise SubstitutionException('Unknown substitution command [%s]. ' - 'Valid commands are %s' % (a, valid)) + 'Valid commands are %s' % (splits[0], valid)) command = splits[0] args = splits[1:] if command in commands: From 4842ef33b7665f1cab140070b7ec7cc2cddc4c53 Mon Sep 17 00:00:00 2001 From: Aarav Gupta Date: Tue, 17 Mar 2026 20:38:51 +0530 Subject: [PATCH 2/4] refactor: Use .strip() to fix the bug --- xacro/substitution_args.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/xacro/substitution_args.py b/xacro/substitution_args.py index 3eabc031..df738568 100644 --- a/xacro/substitution_args.py +++ b/xacro/substitution_args.py @@ -333,11 +333,11 @@ def _resolve_args(arg_str, context, commands): valid = ['find', 'env', 'optenv', 'dirname', 'arg'] resolved = arg_str for a in _collect_args(arg_str): - splits = shlex.split(a) - if splits[0] not in valid: + splits = [s for s in a.split(' ') if s] + if splits[0].strip() not in valid: raise SubstitutionException('Unknown substitution command [%s]. ' 'Valid commands are %s' % (splits[0], valid)) - command = splits[0] + command = splits[0].strip() args = splits[1:] if command in commands: resolved = commands[command](resolved, a, args, context) From d08853591f3b45400a773eb174f5dd56a957c8e4 Mon Sep 17 00:00:00 2001 From: Aarav Gupta Date: Tue, 17 Mar 2026 21:33:11 +0530 Subject: [PATCH 3/4] refactor: Fix the bug by splitting on any whitespace --- xacro/substitution_args.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/xacro/substitution_args.py b/xacro/substitution_args.py index df738568..f708174b 100644 --- a/xacro/substitution_args.py +++ b/xacro/substitution_args.py @@ -333,11 +333,11 @@ def _resolve_args(arg_str, context, commands): valid = ['find', 'env', 'optenv', 'dirname', 'arg'] resolved = arg_str for a in _collect_args(arg_str): - splits = [s for s in a.split(' ') if s] - if splits[0].strip() not in valid: + splits = [s for s in a.split() if s] + if splits[0] not in valid: raise SubstitutionException('Unknown substitution command [%s]. ' 'Valid commands are %s' % (splits[0], valid)) - command = splits[0].strip() + command = splits[0] args = splits[1:] if command in commands: resolved = commands[command](resolved, a, args, context) From 09ea855b853c102d90fb9bb2a5a7e669ffacd8a7 Mon Sep 17 00:00:00 2001 From: Robert Haschke Date: Tue, 17 Mar 2026 21:08:25 +0100 Subject: [PATCH 4/4] cleanup --- xacro/substitution_args.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/xacro/substitution_args.py b/xacro/substitution_args.py index f708174b..bd30f8e8 100644 --- a/xacro/substitution_args.py +++ b/xacro/substitution_args.py @@ -39,7 +39,6 @@ import math import os -import shlex import yaml from io import StringIO @@ -336,7 +335,7 @@ def _resolve_args(arg_str, context, commands): splits = [s for s in a.split() if s] if splits[0] not in valid: raise SubstitutionException('Unknown substitution command [%s]. ' - 'Valid commands are %s' % (splits[0], valid)) + 'Valid commands are %s' % (a, valid)) command = splits[0] args = splits[1:] if command in commands: