@std/ini parse silently drops an entire section when the section name repeats

オープン 初心者向け
#7,360 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 1 日以内に返信

@Harsh23Kashyap がすでに取り組んでいます。

2026年10月19日 から。

  • #7361 @Harsh23Kashyap による — オープン

評価

難易度
2/5
見積もり時間
1〜3時間
初心者へのやさしさ
70/100
issue の種類
バグ
明瞭さ
おおむね明確
活発さ
活発
技術スタック
typescript
領域
backend

調査の方向性

まず @std/ini パーサーのエントリーポイントと、セクションヘッダーの繰り返しに関するテストを見つけます。ヘッダーが再び現れたときにセクションキーがどのように保存されるかを確認し、issue にある 2 つの再現例をテストでカバーしてください。以前のキーが保持されるか、重複したセクションでエラーが発生し、その動作がテストでカバーされれば完了です。

索引モデルが issue の本文から書いたものです。

説明

Describe the bug

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:

  • node-ini merges repeated sections: { s: { a: "1", b: "2" } }
  • 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
主要言語
TypeScript
スター
3.6k
フォーク
713
PR マージ指標
30日以内にマージされた PR はありません

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

denoland/std のほかの issue

denoland/std の issue をすべて見る

似ている issue

TypeScript の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。