[SERVER-54031] errorcodes.py doesn't check embedded C++ code in Python scripts Created: 25/Jan/21  Updated: 29/Oct/23  Resolved: 06/Mar/21

Status: Closed
Project: Core Server
Component/s: Build
Affects Version/s: None
Fix Version/s: 4.9.0, 4.4.5, 4.0.24, 4.2.14

Type: Bug Priority: Major - P3
Reporter: Eric Milkie Assignee: Billy Donahue
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Backports
Backwards Compatibility: Fully Compatible
Operating System: ALL
Backport Requested:
v4.4, v4.2, v4.0
Sprint: Service Arch 2021-03-08
Participants:

 Description   

We seem to have ended up with a duplicate assert code 40088 between these two places:
https://github.com/mongodb/mongo/blob/d5d4b4945fabfb772b758b95fbfa698c4448484e/src/mongo/util/generate_icu_init_cpp.py#L110
https://github.com/mongodb/mongo/blob/d5d4b4945fabfb772b758b95fbfa698c4448484e/src/mongo/db/repl/replication_coordinator_impl.cpp#L767

I believe this is because buildscripts/errorcodes.py isn't looking in .py files, but it probably can be easily adapted to do so.

This issue is important because we actually have a problem report from the field with this exact error code.



 Comments   
Comment by Githook User [ 11/Mar/21 ]

Author:

{'name': 'Billy Donahue', 'email': 'billy.donahue@mongodb.com', 'username': 'BillyDonahue'}

Message: SERVER-54031 Include .py and .idl files in the errorcodes.py scan
Branch: v4.0
https://github.com/mongodb/mongo/commit/59dcc00af2ed0091088081449fa47fac73943cac

Comment by Githook User [ 11/Mar/21 ]

Author:

{'name': 'Billy Donahue', 'email': 'billy.donahue@mongodb.com', 'username': 'BillyDonahue'}

Message: SERVER-54031 Include .py and .idl files in the errorcodes.py scan
Branch: v4.2
https://github.com/mongodb/mongo/commit/6bc5f238ca6c1f5dc8e3552300412ce6f1cc6a60

Comment by Githook User [ 11/Mar/21 ]

Author:

{'name': 'Billy Donahue', 'email': 'billy.donahue@mongodb.com', 'username': 'BillyDonahue'}

Message: SERVER-54031 Include .py and .idl files in the errorcodes.py scan
Branch: v4.4
https://github.com/mongodb/mongo/commit/d2baae7c97e0d67f5e7d82ac0ff1f0313103bcad

Comment by Githook User [ 06/Mar/21 ]

Author:

{'name': 'Billy Donahue', 'email': 'billy.donahue@mongodb.com', 'username': 'BillyDonahue'}

Message: SERVER-54031 Include .py and .idl files in the errorcodes.py scan
Branch: master
https://github.com/mongodb/mongo/commit/982db36aae245c4cac674587bde741604748fc27

Comment by Billy Donahue [ 25/Feb/21 ]

CR https://mongodbcr.appspot.com/741550008/

Comment by Billy Donahue [ 25/Feb/21 ]

After looking at this with more time to reflect on it, it's easy enough to just do it.

The errant python example is the only place where any .py file would match the patterns we scan for.
Pretty amazing. It's the only instance of a message id and it's in conflict.

I was a little worried that we might have other gen files or .yy files or .inl or whatever of this flavor.
So just for fun I tried opening up filename filter to scan to ALL files regardless of extension and didn't find any more msgid pattern hits.

I do think we should add .idl files as well though since they can conceivably include c++ snippets of interest.

I also noticed that the pattern we scan for will not handle the newer iassert or tassert macros.
When I extended the pattern to find those I found 2 more conflicts! We'll have to change those too.

The get_all_source_files function doesn't need to be in buildscripts/utils.py. The only caller is errorcodes.py and bring it
local to that caller allows a little more flexibility in getting the filematching patterns customized for the exact use case that
errorcodes.py needs.

Generated at Thu Feb 08 05:32:29 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.