Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix reply schemas validator build issue due to new regular expression #13103

Merged
merged 2 commits into from
Mar 2, 2024

Conversation

enjoy-binbin
Copy link
Collaborator

@enjoy-binbin enjoy-binbin commented Mar 2, 2024

The new regular expression break the validator:

In file included from commands.c:10:
commands_with_reply_schema.def:14528:72: error: stray ‘\’ in program
14528 | struct jsonObjectElement MEMORY_STATS_ReplySchema_patternProperties__db\_\d+__properties_overhead_hashtable_main_elements[] = {

The reason is that special characters are not added to to_c_name,
causes special characters to appear in the structure name, causing
c file compilation to fail.

Broken by #12913

The new regular expression break the validator:
```
In file included from commands.c:10:
commands_with_reply_schema.def:14528:72: error: stray ‘\’ in program
14528 | struct jsonObjectElement MEMORY_STATS_ReplySchema_patternProperties__db\_\d+__properties_overhead_hashtable_main_elements[] = {
```

The reason is that special characters are not added to to_c_name,
causes special characters to appear in the structure name, causing
c file compilation to fail.

Change "^db\\.\\d+$" to "^db\\\\.\\\\d+$" because this, it seems that
invalid escape will occur during the process, did not bother to check.
```
In file included from commands.c:10:
./commands_with_reply_schema.def:14560:23: error: unknown escape sequence '\.' [-Werror,-Wunknown-escape-sequence]
{JSON_TYPE_OBJECT,"^db\.\d+$",.value.object=&MEMORY_STATS_ReplySchema_patternProperties__db_____},

```
@enjoy-binbin enjoy-binbin marked this pull request as ready for review March 2, 2024 10:28
@enjoy-binbin
Copy link
Collaborator Author

enjoy-binbin commented Mar 2, 2024

src/commands/memory-stats.json Outdated Show resolved Hide resolved
utils/generate-command-code.py Outdated Show resolved Hide resolved
@enjoy-binbin
Copy link
Collaborator Author

Copy link
Member

@oranagra oranagra left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this one makes more sense to me.

@oranagra oranagra merged commit df75153 into redis:unstable Mar 2, 2024
13 checks passed
@enjoy-binbin enjoy-binbin deleted the fix_reply_schema branch March 3, 2024 02:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

None yet

2 participants