#1152272 checkbashisms: printf %q false positive inside a multi-line single-quoted Go template argument

Package:
devscripts
Source:
devscripts
Description:
scripts to make the life of a Debian Package maintainer easier
Submitter:
Tomáš Chvátal
Date:
2026-10-27 11:27:04 UTC
Severity:
normal
#1152272#5
Date:
2026-10-27 11:26:47 UTC
From:
To:
checkbashisms reports "printf %q" for text inside a multi-line
single-quoted argument — a Go text/template passed to
podman inspect --format — where printf is a Go template function,
not a shell command:

    #!/bin/sh
    eval "$(${container_manager} inspect --type container --format \
    	'container_status={{.State.Status}};
    	unshare_groups={{ index .Config.Labels "distrobox.unshare_groups" }};
    	{{range .Config.Env}}{{if and (ge (len .) 5) (eq (slice . 0 5)
"PATH=")}}container_path={{slice . 5 | printf "%q"}}{{end}}{{end}}' \
    	"${container_name}")"

Actual output (checkbashisms 2.26.9, exit 1):

    possible bashism in test.sh line 6 (printf %q):
    	{{range .Config.Env}}{{if and (ge (len .) 5) (eq (slice . 0 5)
"PATH=")}}container_path={{slice . 5 | printf "%q"}}{{end}}{{end}}' \

Expected: no output. The template is one single-quoted argument;
its lines are data for podman. The checker's multi-line
quoted-block tracking loses the block before the last line (a
double-quoted string on an interior line desynchronises it), so
that line is checked as shell text. Reduced from the shipped
distrobox-enter (distrobox 1.8.2.5), which draws this hit at
line 657; the same file's other data-only hits are filed
separately.

Disclosure, encouraged by GR 2026-002: this report was drafted with
AI assistance; the reproducer was verified by me against
checkbashisms 2.26.9.