From a4dad7cb6dab626887c252ac74a21b8a942ec2d0 Mon Sep 17 00:00:00 2001 From: Peter Wu Date: Fri, 4 Jan 2019 14:27:57 +0100 Subject: 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 Tested-by: Petri Dish Buildbot Reviewed-by: Anders Broman --- tools/commit-msg | 4 ++-- 1 file 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" } -- cgit v1.2.3