From 6d4e1f8c5cff45bc631142f2810b9d49ae63348a Mon Sep 17 00:00:00 2001 From: JT Olio Date: Thu, 19 Feb 2026 18:31:05 +0000 Subject: [PATCH] fix: use POSIX-compliant awk bracket expressions for busybox compat [\[\] ] relies on GNU awk treating backslash as an escape inside bracket expressions. POSIX awk (including busybox) treats backslash literally, causing the regex to silently fail and suppress all output from ready, blocked, ls, and other listing commands. Use [][ ] instead, which is portable across all awk implementations. Co-Authored-By: Claude Opus 4.6 --- CHANGELOG.md | 3 +++ ticket | 24 ++++++++++++------------ 2 files changed, 15 insertions(+), 12 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 86c4d2d..6370f0e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,9 @@ ## [Unreleased] +### Fixed +- Use POSIX-compliant bracket expressions in awk regexes for busybox compatibility + ### Added - Plugin system: executables named `tk-` or `ticket-` in PATH are invoked automatically - `super` command to bypass plugins and run built-in commands directly diff --git a/ticket b/ticket index 1dedcec..b8c4862 100755 --- a/ticket +++ b/ticket @@ -316,7 +316,7 @@ cmd_dep_tree() { in_front && /^status:/ { status = $2 } in_front && /^deps:/ { deps = $2 - gsub(/[\[\] ]/, "", deps) + gsub(/[][ ]/, "", deps) } !in_front && /^# / && title == "" { title = substr($0, 3) } function store() { @@ -500,7 +500,7 @@ cmd_dep_cycle() { in_front && /^status:/ { status = $2 } in_front && /^deps:/ { deps = $2 - gsub(/[\[\] ]/, "", deps) + gsub(/[][ ]/, "", deps) } !in_front && /^# / && title == "" { title = substr($0, 3) } function store() { @@ -674,10 +674,10 @@ cmd_ls() { in_front && /^id:/ { id = $2 } in_front && /^status:/ { status = $2 } in_front && /^assignee:/ { assignee = $2 } - in_front && /^tags:/ { tags = $2; gsub(/[\[\] ]/, "", tags) } + in_front && /^tags:/ { tags = $2; gsub(/[][ ]/, "", tags) } in_front && /^deps:/ { deps = $2 - gsub(/[\[\] ]/, "", deps) + gsub(/[][ ]/, "", deps) } !in_front && /^# / && title == "" { title = substr($0, 3) } END { if (prev_file) emit() } @@ -721,10 +721,10 @@ cmd_ready() { in_front && /^status:/ { status = $2 } in_front && /^priority:/ { priority = $2 } in_front && /^assignee:/ { assignee = $2 } - in_front && /^tags:/ { tags = $2; gsub(/[\[\] ]/, "", tags) } + in_front && /^tags:/ { tags = $2; gsub(/[][ ]/, "", tags) } in_front && /^deps:/ { deps = $2 - gsub(/[\[\] ]/, "", deps) + gsub(/[][ ]/, "", deps) } !in_front && /^# / && title == "" { title = substr($0, 3) } function has_tag(tags_str, tag, i, n, arr) { @@ -815,7 +815,7 @@ cmd_closed() { in_front && /^id:/ { id = $2 } in_front && /^status:/ { status = $2 } in_front && /^assignee:/ { assignee = $2 } - in_front && /^tags:/ { tags = $2; gsub(/[\[\] ]/, "", tags) } + in_front && /^tags:/ { tags = $2; gsub(/[][ ]/, "", tags) } !in_front && /^# / && title == "" { title = substr($0, 3) } function has_tag(tags_str, tag, i, n, arr) { n = split(tags_str, arr, ",") @@ -858,10 +858,10 @@ cmd_blocked() { in_front && /^status:/ { status = $2 } in_front && /^priority:/ { priority = $2 } in_front && /^assignee:/ { assignee = $2 } - in_front && /^tags:/ { tags = $2; gsub(/[\[\] ]/, "", tags) } + in_front && /^tags:/ { tags = $2; gsub(/[][ ]/, "", tags) } in_front && /^deps:/ { deps = $2 - gsub(/[\[\] ]/, "", deps) + gsub(/[][ ]/, "", deps) } !in_front && /^# / && title == "" { title = substr($0, 3) } function has_tag(tags_str, tag, i, n, arr) { @@ -1028,7 +1028,7 @@ cmd_link() { } /^links:/ { # Parse existing links - gsub(/[\[\]]/, "", $0) + gsub(/[][]/, "", $0) sub(/^links: */, "", $0) m = split($0, existing, ", *") for (i = 1; i <= m; i++) { @@ -1140,8 +1140,8 @@ cmd_show() { /^---$/ { in_front = !in_front; next } in_front && /^id:/ { id = $2 } in_front && /^status:/ { status = $2 } - in_front && /^deps:/ { deps = $2; gsub(/[\[\] ]/, "", deps) } - in_front && /^links:/ { links = $2; gsub(/[\[\] ]/, "", links) } + in_front && /^deps:/ { deps = $2; gsub(/[][ ]/, "", deps) } + in_front && /^links:/ { links = $2; gsub(/[][ ]/, "", links) } in_front && /^parent:/ { parent = $2 } !in_front && /^# / && title == "" { title = substr($0, 3) }