lint: prohibit to use %m specifier in pr_* functions

As our pr_* functions are complex and can call different system calls
inside before actual printing (e.g. gettimeofday for timestamps) actual
errno at the time of printing may be changed.

Signed-off-by: Pavel Tikhomirov <ptikhomirov@virtuozzo.com>
This commit is contained in:
Pavel Tikhomirov 2023-01-25 10:57:18 +03:00 committed by Andrei Vagin
parent f73ba77269
commit 7459d02043

View file

@ -431,7 +431,7 @@ lint:
# Do not append \n to pr_perror or fail
! git --no-pager grep -E '^\s*\<(pr_perror|fail)\>.*\\n"'
# Do not use %m with pr_perror or fail
! git --no-pager grep -E '^\s*\<(pr_perror|fail)\>.*%m'
! git --no-pager grep -E '^\s*\<(pr_(err|perror|warn|debug|info|msg)|fail)\>.*%m'
# Do not use errno with pr_perror or fail
! git --no-pager grep -E '^\s*\<(pr_perror|fail)\>\(".*".*errno'
# End pr_(err|warn|msg|info|debug) with \n