Skip to content

GH-3099: Parse Redis INFO output without using Properties.load()#3382

Open
won-seoop wants to merge 1 commit into
spring-projects:mainfrom
won-seoop:fix/3099-info-properties-parsing
Open

GH-3099: Parse Redis INFO output without using Properties.load()#3382
won-seoop wants to merge 1 commit into
spring-projects:mainfrom
won-seoop:fix/3099-info-properties-parsing

Conversation

@won-seoop

@won-seoop won-seoop commented Jun 10, 2026

Copy link
Copy Markdown

Summary

Closes #3099. Closes #3020.

Properties.load() interprets \u sequences as Unicode escapes. Redis INFO output can contain Windows-style paths in fields like exe_path, config_file, rdb_filename, and aof_filename that include sequences such as c:\users\.... When these paths pass through Properties.load(), the \u prefix triggers a Unicode parsing error (or silently corrupts the value).

The Redis INFO format is a simple key:value text format — it is not a Java .properties file and should not be parsed as one.

Changes

Fixes #3099: Replaced the Properties.load()-based implementation in Converters.toProperties(String) with a direct line-by-line parser that:

  • Skips blank lines and section-header comments (# Server, # Memory, etc.)
  • Splits each line on the first colon only (matching Redis INFO's key:value format)
  • Does not interpret any escape sequences, preserving values exactly as Redis emits them

Fixes #3020: StringToPropertiesConverter now delegates to Converters.toProperties(String) rather than duplicating the parsing logic, eliminating the duplication flagged in that issue.

Test plan

  • Existing tests pass (no behaviour change for normal INFO output)
  • Manually verify that INFO output containing c:\users\... paths (Windows Redis) is parsed without error

🤖 Generated with Claude Code

…ies.load()

Properties.load() interprets \u sequences as Unicode escapes, which
breaks when Redis INFO output contains Windows-style paths (e.g.
C:\Users\...\AppData). The Redis INFO format is a simple key:value text
format, not a Java .properties file.

Replace the Properties.load()-based parsing with a direct line-by-line
parser that:
- Skips blank lines and section comments (# prefix)
- Splits each line on the first colon only
- Does not interpret any escape sequences

This fixes parsing of Redis INFO output on Windows where the exe_path,
config_file, rdb_filename, etc. entries contain backslash-u sequences.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged label Jun 10, 2026
@lh0156

lh0156 commented Jun 14, 2026

Copy link
Copy Markdown

Nice fix. I looked into this locally and I think a few additional regression cases would make the coverage stronger, since the previous Properties.load() path could also apply Java properties escape/continuation semantics.

Cases that seem worth covering:

  • Windows-style paths containing \u, such as c:\users\...
  • malformed Unicode-like sequences such as \u12GZ
  • trailing backslash values, to ensure Java properties line continuation is not applied
  • values containing additional colons, e.g. IPv6 endpoints or host:port
  • invalid INFO lines mixed with valid entries
  • duplicate keys preserving Properties last-write-wins behavior

I have a local version of these tests if it would be useful.

@mp911de mp911de added type: task A general task and removed status: waiting-for-triage An issue we've not yet triaged labels Jun 15, 2026
@mp911de mp911de self-assigned this Jun 15, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

type: task A general task

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Redis INFO output is parsed as (Java) properties, although it is not the same format Duplicate code in StringToPropertiesConverter class

4 participants