[PATCH 2/5] tools/bootconfig: Preserve quotes in exported event actions

From: Eduardo Mucelli Rezende Oliveira

Date: Sat Oct 31 2026 - 14:37:14 EST


Reading complete trigger lines preserves filters that can contain single
quotes. Enclosing every action in single bootconfig quotes then produces
invalid output for a valid trigger such as traceoff if prev_comm == 'abc'.

Use double quotes for actions containing only single quotes. Actions with
both quote types can be emitted without enclosing quotes when they have
no bootconfig delimiters. Warn and skip unrepresentable actions containing
both quote types and delimiters, following the event-filter handling.

Fixes: 6a5740440c47 ("tools/bootconfig: Preserve event trigger filters in ftrace2bconf.sh")
Signed-off-by: Eduardo Mucelli Rezende Oliveira <edumucelli@xxxxxxxxx>
---
I reproduced this with valid traceoff triggers using single-quoted
filters in a temporary tracefs instance on my Ubuntu machine, running
kernel 7.0.0-38-generic, with recording disabled.

The original export failed bootconfig parsing. With the fix, supported
single-quoted actions parsed and their decoded commands could be
restored unchanged to tracefs. Unrepresentable mixed-quote actions
produced a warning and were skipped. Mixed quotes without delimiters
and ordinary double-quoted filters were checked as well.

tools/bootconfig/scripts/ftrace2bconf.sh | 17 ++++++++++++++++-
1 file changed, 16 insertions(+), 1 deletion(-)

diff --git a/tools/bootconfig/scripts/ftrace2bconf.sh b/tools/bootconfig/scripts/ftrace2bconf.sh
index 31702be0c68d..77ec17c94a17 100755
--- a/tools/bootconfig/scripts/ftrace2bconf.sh
+++ b/tools/bootconfig/scripts/ftrace2bconf.sh
@@ -126,7 +126,22 @@ per_event_options() { # event-dir
*:count=*)
action="${action_cmd%:count=*}:${action_cmd##*:count=}$action_rest";;
esac
- emit_kv $PREFIX.event.$group.$event.actions += "'$action'"
+ case "$action" in
+ *\'*)
+ case "$action" in
+ *\"*)
+ case "$action" in
+ *[,\;\#\}]*)
+ cat 1>&2 << EOF
+# WARN: $PREFIX.event.$group.$event.actions cannot be quoted for bootconfig. Skip it.
+EOF
+ continue;;
+ esac;;
+ *) action="\"$action\"";;
+ esac;;
+ *) action="'$action'";;
+ esac
+ emit_kv $PREFIX.event.$group.$event.actions += "$action"
done

if [ $GROUP_ENABLED -eq 0 ] && event_is_enabled $evdir/enable; then
--
2.53.0