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

LINSERT ignores lower case 'before' #945

Closed
prvyk opened this issue Jan 22, 2025 · 2 comments
Closed

LINSERT ignores lower case 'before' #945

prvyk opened this issue Jan 22, 2025 · 2 comments

Comments

@prvyk
Copy link
Contributor

prvyk commented Jan 22, 2025

Describe the bug

rpush mylist 0",
rpush mylist 2",
linsert mylist before 2 1
lrange mylist 0 -1

Result:
0 2 1

This is because ListObjectImpl.cs:95 only compares against uppercase CmdStrings.BEFORE .

( One could add the lower case version, but if the choice is to allow input like 'LInsert mylist aGter 0 1' in order to optimize, perhaps the better way would be to only compare the first character against 'B' or 'b', or even '((ushort)char & 1) != 1' ? ).


Was found by running

https://github.com/tair-opensource/resp-compatibility/

and inspecting the testcase failure.

Steps to reproduce the bug

rpush mylist 0",
rpush mylist 2",
linsert mylist before 2 1
lrange mylist 0 -1

Expected behavior

0 1 2

Screenshots

No response

Release version

v1.0.52

IDE

No response

OS version

No response

Additional context

No response

@badrishc
Copy link
Contributor

badrishc commented Jan 22, 2025

Good catch. We should probably make it:

var insertBefore = position.EqualsUpperCaseSpanIgnoringCase(CmdStrings.BEFORE);

@Vijay-Nirmal
Copy link
Contributor

@prvyk Can you raise a PR to fix this if possible?

prvyk pushed a commit to prvyk/garnet that referenced this issue Jan 23, 2025
TalZaccai pushed a commit that referenced this issue Jan 23, 2025
Co-authored-by: prvyk <github@privatemail.fastmailbox.net>
@prvyk prvyk closed this as completed Jan 23, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants