On 11/15/25 20:55, Prawesh Mandal wrote:
Hello all*,*
While working on a patch I ran into an issue where the formatting check
script (|solenv/clang-format/check-last-commit|) fails when /_clang-
format 18_/ is already installed.
*> Problem*
Even though |clang-format-18| is correctly installed and available in |
PATH |the script exits with:
| core git:(master) solenv/clang-format/check-last-commit
Use of uninitialized value $clang_format in -x at solenv/clang-format/
check-last-commit line 43, <FILES> line 9.
solenv/clang-format/check-last-commit: ERROR: no clang-format 5.0.0 was
found.
|
*> Environment*
|core git:(master) clang-format-18 --version
Ubuntu clang-format version 18.1.3 (1ubuntu1)|
*> Root Cause*
After inspecting |solenv/clang-format/ClangFormat.pm |it seems the issue
comes from overly strict version checking:
-> The script hardcodes the required version to |5.0.0|.
-> The regex used to detect the version doesn’t match Ubuntu’s output
format (e.g., |Ubuntu clang-format version 18.1.3 (1ubuntu1)|).
*> Proposed Solution*
Instead of requiring an exact version match we could allow any /*clang-
format version ≥ 5.0.0*/.
The decision to require 5.0.0 is deliberate, see
https://wiki.documentfoundation.org/Development/clang-format
The idea was to limit formatting churn that would be caused by future
versions changing and adding various rules. I do think that at some
point we need to do a version bump there. Version 5.0.0 was released in
2017 and one would think that in 8 years the opinions on formatting
would have stabilised and besides, we are missing formatting rules for
newer C++ features.
Ilmari