diff --git a/misc/scripts/black_format.sh b/misc/scripts/black_format.sh index 3a64284eb65..48dc14c7341 100755 --- a/misc/scripts/black_format.sh +++ b/misc/scripts/black_format.sh @@ -20,7 +20,7 @@ fi # A diff has been created, notify the user, clean up, and exit. printf "\n\e[1;33m*** The following changes must be made to comply with the formatting rules:\e[0m\n\n" # Perl commands replace trailing spaces with `·` and tabs with ``. -printf "$diff\n" | perl -pe 's/(.*[^ ])( +)(\e\[m)$/my $spaces="·" x length($2); sprintf("$1$spaces$3")/ge' | perl -pe 's/(.*[^\t])(\t+)(\e\[m)$/my $tabs="" x length($2); sprintf("$1$tabs$3")/ge' +printf "%s\n" "$diff" | perl -pe 's/(.*[^ ])( +)(\e\[m)$/my $spaces="·" x length($2); sprintf("$1$spaces$3")/ge' | perl -pe 's/(.*[^\t])(\t+)(\e\[m)$/my $tabs="" x length($2); sprintf("$1$tabs$3")/ge' printf "\n\e[1;91m*** Please fix your commit(s) with 'git commit --amend' or 'git rebase -i '\e[0m\n" exit 1 diff --git a/misc/scripts/clang_format.sh b/misc/scripts/clang_format.sh index 74a8e1a8a3a..453d6fa212a 100755 --- a/misc/scripts/clang_format.sh +++ b/misc/scripts/clang_format.sh @@ -47,7 +47,7 @@ fi # A diff has been created, notify the user, clean up, and exit. printf "\n\e[1;33m*** The following changes must be made to comply with the formatting rules:\e[0m\n\n" # Perl commands replace trailing spaces with `·` and tabs with ``. -printf "$diff\n" | perl -pe 's/(.*[^ ])( +)(\e\[m)$/my $spaces="·" x length($2); sprintf("$1$spaces$3")/ge' | perl -pe 's/(.*[^\t])(\t+)(\e\[m)$/my $tabs="" x length($2); sprintf("$1$tabs$3")/ge' +printf "%s\n" "$diff" | perl -pe 's/(.*[^ ])( +)(\e\[m)$/my $spaces="·" x length($2); sprintf("$1$spaces$3")/ge' | perl -pe 's/(.*[^\t])(\t+)(\e\[m)$/my $tabs="" x length($2); sprintf("$1$tabs$3")/ge' printf "\n\e[1;91m*** Please fix your commit(s) with 'git commit --amend' or 'git rebase -i '\e[0m\n" exit 1 diff --git a/misc/scripts/clang_tidy.sh b/misc/scripts/clang_tidy.sh index c4811b903cc..0c6998b4916 100755 --- a/misc/scripts/clang_tidy.sh +++ b/misc/scripts/clang_tidy.sh @@ -27,7 +27,7 @@ fi # A diff has been created, notify the user, clean up, and exit. printf "\n\e[1;33m*** The following changes must be made to comply with the formatting rules:\e[0m\n\n" # Perl commands replace trailing spaces with `·` and tabs with ``. -printf "$diff\n" | perl -pe 's/(.*[^ ])( +)(\e\[m)$/my $spaces="·" x length($2); sprintf("$1$spaces$3")/ge' | perl -pe 's/(.*[^\t])(\t+)(\e\[m)$/my $tabs="" x length($2); sprintf("$1$tabs$3")/ge' +printf "%s\n" "$diff" | perl -pe 's/(.*[^ ])( +)(\e\[m)$/my $spaces="·" x length($2); sprintf("$1$spaces$3")/ge' | perl -pe 's/(.*[^\t])(\t+)(\e\[m)$/my $tabs="" x length($2); sprintf("$1$tabs$3")/ge' printf "\n\e[1;91m*** Please fix your commit(s) with 'git commit --amend' or 'git rebase -i '\e[0m\n" exit 1 diff --git a/misc/scripts/dotnet_format.sh b/misc/scripts/dotnet_format.sh index cac00f5cb1c..e2b4ba5e437 100755 --- a/misc/scripts/dotnet_format.sh +++ b/misc/scripts/dotnet_format.sh @@ -31,7 +31,7 @@ fi # A diff has been created, notify the user, clean up, and exit. printf "\n\e[1;33m*** The following changes must be made to comply with the formatting rules:\e[0m\n\n" # Perl commands replace trailing spaces with `·` and tabs with ``. -printf "$diff\n" | perl -pe 's/(.*[^ ])( +)(\e\[m)$/my $spaces="·" x length($2); sprintf("$1$spaces$3")/ge' | perl -pe 's/(.*[^\t])(\t+)(\e\[m)$/my $tabs="" x length($2); sprintf("$1$tabs$3")/ge' +printf "%s\n" "$diff" | perl -pe 's/(.*[^ ])( +)(\e\[m)$/my $spaces="·" x length($2); sprintf("$1$spaces$3")/ge' | perl -pe 's/(.*[^\t])(\t+)(\e\[m)$/my $tabs="" x length($2); sprintf("$1$tabs$3")/ge' printf "\n\e[1;91m*** Please fix your commit(s) with 'git commit --amend' or 'git rebase -i '\e[0m\n" exit 1 diff --git a/misc/scripts/file_format.sh b/misc/scripts/file_format.sh index 94a3affbd70..ad586578836 100755 --- a/misc/scripts/file_format.sh +++ b/misc/scripts/file_format.sh @@ -82,7 +82,7 @@ then # A diff has been created, notify the user, clean up, and exit. printf "\n\e[1;33m*** The following changes must be made to comply with the formatting rules:\e[0m\n\n" # Perl commands replace trailing spaces with `·` and tabs with ``. - printf "$diff\n" | perl -pe 's/(.*[^ ])( +)(\e\[m)$/my $spaces="·" x length($2); sprintf("$1$spaces$3")/ge' | perl -pe 's/(.*[^\t])(\t+)(\e\[m)$/my $tabs="" x length($2); sprintf("$1$tabs$3")/ge' + printf "%s\n" "$diff" | perl -pe 's/(.*[^ ])( +)(\e\[m)$/my $spaces="·" x length($2); sprintf("$1$spaces$3")/ge' | perl -pe 's/(.*[^\t])(\t+)(\e\[m)$/my $tabs="" x length($2); sprintf("$1$tabs$3")/ge' fi printf "\n\e[1;91m*** Please fix your commit(s) with 'git commit --amend' or 'git rebase -i '\e[0m\n" diff --git a/misc/scripts/header_guards.sh b/misc/scripts/header_guards.sh index 1f8aa6151c8..0a26422703c 100755 --- a/misc/scripts/header_guards.sh +++ b/misc/scripts/header_guards.sh @@ -81,7 +81,7 @@ fi # A diff has been created, notify the user, clean up, and exit. printf "\n\e[1;33m*** The following changes must be made to comply with the formatting rules:\e[0m\n\n" # Perl commands replace trailing spaces with `·` and tabs with ``. -printf "$diff\n" | perl -pe 's/(.*[^ ])( +)(\e\[m)$/my $spaces="·" x length($2); sprintf("$1$spaces$3")/ge' | perl -pe 's/(.*[^\t])(\t+)(\e\[m)$/my $tabs="" x length($2); sprintf("$1$tabs$3")/ge' +printf "%s\n" "$diff" | perl -pe 's/(.*[^ ])( +)(\e\[m)$/my $spaces="·" x length($2); sprintf("$1$spaces$3")/ge' | perl -pe 's/(.*[^\t])(\t+)(\e\[m)$/my $tabs="" x length($2); sprintf("$1$tabs$3")/ge' printf "\n\e[1;91m*** Please fix your commit(s) with 'git commit --amend' or 'git rebase -i '\e[0m\n" exit 1