Skip to content
Snippets Groups Projects
Commit f76d6ecc authored by Andreas Dilger's avatar Andreas Dilger Committed by Oleg Drokin
Browse files

LU-7328 misc: no non-ASCII characters in commit messages


Some commit messages have control characters, or fancy quotation
marks, or mdash hyphens or similar, and this messes up the display
of "git log" and other tools depending on the current locale and
character set used in the terminal.

Add a check into commit-msg to reject commit messages that have
non-ASCII characters. This does not apply to characters used in
the Signed-off-by: or similar fields that list people's names.

Test-Parameters: trivial
Signed-off-by: default avatarAndreas Dilger <adilger@whamcloud.com>
Change-Id: I99d0954a68f8a5391195553ebf4b69181b6991f2
Reviewed-on: https://review.whamcloud.com/c/fs/lustre-release/+/53304


Tested-by: default avatarjenkins <devops@whamcloud.com>
Tested-by: default avatarMaloo <maloo@whamcloud.com>
Reviewed-by: default avatarTimothy Day <timday@amazon.com>
Reviewed-by: default avatarArshad Hussain <arshad.hussain@aeoncomputing.com>
Reviewed-by: default avatarOleg Drokin <green@whamcloud.com>
parent f35f897e
No related branches found
No related tags found
No related merge requests found
......@@ -71,7 +71,7 @@ die() {
# Called when doing the final "wrap up" clause because we've found
# one of the tagged lines that belongs in the final section.
#
function ck_wrapup() {
function ck_wrapup_started() {
$IS_WRAPPING_UP && return
$HAS_LAST_BLANK || error "blank line must preceed signoff section"
......@@ -82,8 +82,19 @@ function ck_wrapup() {
IS_WRAPPING_UP=true
}
function ck_is_ascii() {
LANG=C
[[ "${LINE//[![:alnum:][:blank:][:punct:]]/}" == "$LINE" ]] ||
error "non-printable characters in '$LINE'"
}
function ck_wrapup() {
ck_wrapup_started
ck_is_ascii
}
function do_signoff() {
ck_wrapup
ck_wrapup_started
# Signed-off-by: First Last <email@host.domain>
local txt=$(echo "${LINE#*: }" | grep -E "${EMAILPAT}")
if (( ${#txt} == 0 )); then
......@@ -125,7 +136,7 @@ function do_fixes() {
# All "emails" lines specify a person and email address
#
function do_emails() {
ck_wrapup
ck_wrapup_started
local txt=$(echo "${LINE#*: }" | grep -E "${EMAILPAT}")
(( ${#txt} == 0 )) && error "${LINE%: *} invalid name and email"
}
......@@ -134,6 +145,8 @@ function do_emails() {
#
function do_change() {
local url="${LINE#*change: }"
ck_is_ascii
[[ $url =~ $GERRIT_URL/[0-9][0-9][0-9] ]] ||
error "bad Gerrit URL, use '$GERRIT_URL/nnnnn' format"
}
......@@ -143,6 +156,8 @@ function do_change() {
#
function do_commit() {
local val=${LINE#*commit: }
ck_is_ascii
if [[ $val =~ TBD ]]; then
val=${val#TBD (from }
val=${val%)}
......@@ -183,6 +198,7 @@ function do_default_line() {
HAS_BODY=true
fi
HAS_LAST_BLANK=false
ck_is_ascii
}
# Add a new unique Change-Id
......@@ -240,7 +256,7 @@ for full details. A good example of a valid commit comment is:
changed (including important functions that were changed, if this
is useful to understand the patch, and for easier searching).
Performance patches should quanify the improvements being seen.
Wrap lines at/under $WIDTH_REG columns.
Wrap lines at/under $WIDTH_REG columns. Only ASCII text allowed.
Optionally, if the patch is backported from master, include links
to the original patch to simplify tracking it across branches/repos:
......
commit a3a51806ef361f55421a1bc07f64c78730ae50d5
Author: Shaun Tancheff <shaun.tancheff@hpe.com>
AuthorDate: Sun Jan 22 11:43:29 2023 -0600
Commit: Oleg Drokin <green@whamcloud.com>
CommitDate: Wed Feb 8 06:26:57 2023 +0000
LU-16118 build: Workaround __write_overflow_field errors
Linux commit v5.17-rc3-1-gf68f2ff91512
fortify: Detect struct member overflows in memcpy() at compile-time
memcpy and memset of collections of struct members
will trigger:
error: call to ‘__write_overflow_field’ declared with attribute
warning: detected write beyond size of field (1st parameter);
maybe use struct_group()?
[-Werror] __write_overflow_field(p_size_field, size);
Test-Parameters: trivial
HPE-bug-id: LUS-11194
Signed-off-by: Shaun Tancheff <shaun.tancheff@hpe.com>
Change-Id: Iacd1ab03d1b90ce62b5d7b65e1cd518a5f7981f2
Reviewed-on: https://review.whamcloud.com/c/fs/lustre-release/+/48364
Reviewed-by: Petros Koutoupis <petros.koutoupis@hpe.com>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
Reviewed-by: jsimmons <jsimmons@infradead.org>
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
Reviewed-by: Neil Brown <neilb@suse.de>
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment