DUNE-DAQ / daq-buildtools

Make life for developers easier through a collection of CMake functions and scripts
0 stars 1 forks source link

filter commit messages before generating build_info json file #180

Closed dingp closed 2 years ago

dingp commented 2 years ago

The is a bug related to "Invalid control character" found in commit messages when generating build_info json file.

An example can be found here https://github.com/DUNE-DAQ/timing/runs/5516138212?check_suite_focus=true#step:6:602

The generated json file is:

{
"user for build":         "root",
"hostname for build":     "5aae83962923",
"build time":             "Fri Mar 11 20:49:49 UTC 2022",
"local repo dir":         "/scratch/n0311/sourcecode/timing",
"git branch":             "develop",
"git commit hash":        "345a005cb52da50ad3c56769d682226bcd4b0a10",
"git commit time":        "Fri Mar 11 09:20:36 2022 +0000",
"git commit description": "add control hub      connection entries for np04 timing hardware",
"git commit author":      "Stoyan Trilov",
"uncommitted changes":    ""
}

Python is complaining with:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/cvmfs/dunedaq.opensciencegrid.org/products/python/v3_8_3b/Linux64bit+4.18-2.28/lib/python3.8/json/__init__.py", line 293, in load
    return loads(fp.read(),
  File "/cvmfs/dunedaq.opensciencegrid.org/products/python/v3_8_3b/Linux64bit+4.18-2.28/lib/python3.8/json/__init__.py", line 357, in loads
    return _default_decoder.decode(s)
  File "/cvmfs/dunedaq.opensciencegrid.org/products/python/v3_8_3b/Linux64bit+4.18-2.28/lib/python3.8/json/decoder.py", line 337, in decode
    obj, end = self.raw_decode(s, idx=_w(s, 0).end())
  File "/cvmfs/dunedaq.opensciencegrid.org/products/python/v3_8_3b/Linux64bit+4.18-2.28/lib/python3.8/json/decoder.py", line 353, in raw_decode
    obj, end = self.scan_once(s, idx)
json.decoder.JSONDecodeError: Invalid control character at: line 9 column 43 (char 407)

The offending character is in the 43rd character in "git commit description": "add control hub connection entries for np04 timing hardware",.