You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
@std/ini parse silently drops an entire section when the section name repeats #7360
When an INI document contains the same section header twice, parse keeps only the last occurrence's keys. The earlier section's keys vanish without an error, so a valid config loses settings silently.
Reproduction
import{parse}from"jsr:@std/ini";parse("[s]\na=1\n[s]\nb=2");// -> { s: { b: 2 }} (a=1 is gone)parse("[db]\nhost=a\nport=1\n[db]\nuser=b");// -> { db: { user: "b" }} (host and port are gone)
Expected behavior
Other mainstream INI parsers do not lose the earlier content:
Python's configparser raises DuplicateSectionError (in strict mode, the default)
Either merging or raising protects the caller; silently discarding the first section does not. Repeated sections can appear when config files are concatenated or appended to, so this is reachable in practice, not just hand-written edge cases.
Environment
@std/ini (JSR, latest)
Node 22 for the harness; the code path is engine-independent
Activity