Thread (4 messages) flat view 4 messages, 2 authors, 2025-02-10
STALE547d

[PATCH] thunderbird-patch-inline: avoid bashism

From: brian m. carlson <hidden>
Date: 2025-02-04 01:55:31
Subsystem: the rest · Maintainer: Linus Torvalds

The use of "echo -e" is not portable and not specified by POSIX.  dash
does not support any options except "-n", and so this script will not
work on operating systems which use that as /bin/sh.

Fortunately, the solution is easy: switch to printf(1), which is
specified by POSIX and allows the escape sequences we want to use.  This
will allow the script to work with any POSIX shell.

Signed-off-by: brian m. carlson <redacted>
---
 contrib/thunderbird-patch-inline/appp.sh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

I noticed this in Debian bug 772238[0], while looking for any bug
reports that I might be able to fix.  It was reported in 2014 and has
gone unfixed since then, so possibly this script is seeing relatively
little use on Debian and Ubuntu.

I have not CC'd any of the authors because nobody's touched this in over
9 years and none of those people are still active.

[0] https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=772238
diff --git a/contrib/thunderbird-patch-inline/appp.sh b/contrib/thunderbird-patch-inline/appp.sh
index 1053872eea..c55c2caa41 100755
--- a/contrib/thunderbird-patch-inline/appp.sh
+++ b/contrib/thunderbird-patch-inline/appp.sh
@@ -31,7 +31,7 @@ BODY=$(sed -e "1,/${SEP}/d" $1)
 CMT_MSG=$(sed -e '1,/^$/d' -e '/^---$/,$d' "${PATCH}")
 DIFF=$(sed -e '1,/^---$/d' "${PATCH}")
 
-CCS=$(echo -e "$CMT_MSG\n$HEADERS" | sed -n -e 's/^Cc: \(.*\)$/\1,/gp' \
+CCS=$(printf '%s\n%s' "$CMT_MSG" "$HEADERS" | sed -n -e 's/^Cc: \(.*\)$/\1,/gp' \
 	-e 's/^Signed-off-by: \(.*\)/\1,/gp')
 
 echo "$SUBJECT" > $1
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help