aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPeter Wu <peter@lekensteyn.nl>2019-01-04 14:27:57 +0100
committerAnders Broman <a.broman58@gmail.com>2019-01-04 14:45:03 +0000
commita4dad7cb6dab626887c252ac74a21b8a942ec2d0 (patch)
tree59aca2234a8e3450120d427830ff76a0be17ed2f
parentbbf77f935e67c3f8fec776bbff275352a03ed617 (diff)
commit-msg: accept commit messages with backslashes
Dash (/bin/sh on Ubuntu) treats backslashes specially in an echo command. This could fail the validate-commit.py script when '\r' or '\n' occur anywhere in a commit message. Change-Id: Icec2c1e8ad1b365b4326ecc6ba9667ac64866fdd Reviewed-on: https://code.wireshark.org/review/31368 Petri-Dish: Peter Wu <peter@lekensteyn.nl> Tested-by: Petri Dish Buildbot Reviewed-by: Anders Broman <a.broman58@gmail.com>
-rwxr-xr-xtools/commit-msg4
1 files changed, 2 insertions, 2 deletions
diff --git a/tools/commit-msg b/tools/commit-msg
index 7eecbb6202..e5a4627803 100755
--- a/tools/commit-msg
+++ b/tools/commit-msg
@@ -206,7 +206,7 @@ fixup_message() {
# - Must not mistake "bug:" in the description for tags in contexts such
# as "to reproduce this\nbug: 1) step 2) another step 3) etc.".
# - If preceded by other tags (like Change-Id), do not add newline.
- msg=$(echo "$msg" | awk '
+ msg=$(printf "%s\n" "$msg" | awk '
# Eat the "--verbose" diff
/^#.*(8<|>8)/ {
while (getline) { }
@@ -273,7 +273,7 @@ fixup_message() {
}
}
}
- ') && echo "$msg" > "$MSG"
+ ') && printf "%s\n" "$msg" > "$MSG"
}