Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions RLTest/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -145,9 +145,11 @@ def fix_modulesArgs(modules, modulesArgs, defaultArgs=None, haveSeqs=True):
if type(modulesArgs) == str:
parts = split_by_semicolon(modulesArgs)
if len(parts) == 1:
# No semicolons - keep as plain string
# No unescaped semicolons - keep as a plain string, but take the split's
# single part rather than the input: the input still carries the backslashes
# of any escaped semicolon, and passing those on to the module is fatal.
is_plain_str = True
modulesArgs = [[modulesArgs.strip()]]
modulesArgs = [[parts[0]]]

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This can be a breaking chenge for redis serche, no?
@alonre24 ?

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I don't think so, I assume that if tests are passing, then it should be sufficient...

else:
# Has semicolons - already split
modulesArgs = [parts]
Expand Down
12 changes: 12 additions & 0 deletions tests/unit/test_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -108,3 +108,15 @@ def test_no_substring_match(self):
defaults = [['GC enabled']]
result = fix_modulesArgs(['/mod.so'], 'nogc TIMEOUT 80', defaults)
self.assertEqual(result, [['nogc TIMEOUT 80 GC enabled']])

# 13. Escaped semicolons in a plain string are unescaped, as the module needs the
# bare separator - a backslash reaching it makes the value invalid (MOD-18913)
def test_escaped_semicolons_plain_string(self):
result = fix_modulesArgs(['/mod.so'], r'COMPACTION_POLICY max:1m:1d\;min:10s:1h')
self.assertEqual(result, [['COMPACTION_POLICY max:1m:1d;min:10s:1h']])

# 13b. ...and also when defaults are merged into it
def test_escaped_semicolons_plain_string_with_defaults(self):
defaults = [['TIMEOUT 60']]
result = fix_modulesArgs(['/mod.so'], r'COMPACTION_POLICY max:1m:1d\;min:10s:1h', defaults)
self.assertEqual(result, [['COMPACTION_POLICY max:1m:1d;min:10s:1h TIMEOUT 60']])
Loading