parse_maintainer_name_email returns empty name and wrong email when string has "@" but no angle brackets
メンテナーはふだん 2 日以内に返信
@pujitha24 がすでに取り組んでいます。
2026年11月1日 から。
評価
調査の方向性
バグは src/packagedcode/utils.py 内の parse_maintainer_name_email() 中の has_email チェックにあります。debian.py と pypi.py の呼び出し元がメンテナー文字列を渡しています。issue にある3つの再現例を実行して、現在の出力を確認してください。両方の括弧がない文字列でメールアドレスが返されず、Debian の systemd の例が引き続き解析され、これらのパーサーの既存テストが引き続き通れば完了です。<[email protected] のケースについては、issue の期待値が確認を要する可能性があるため、期待される出力を確認してください。
索引モデルが issue の本文から書いたものです。
説明
parse_maintainer_name_email() in src/packagedcode/utils.py is meant to
split Name <email> strings. It should only extract an email when both <
and > are present. The check is wrong:
has_email = "@" in maintainer and all([
True
for char in email_wrappers
if char in maintainer
])
The list only holds the brackets that are present. If neither bracket is
present it is [], and all([]) is True. If only one is present it is
[True], also True. So any string containing @ is treated as Name <email>.
With no <, maintainer.rpartition("<") returns ('', '', maintainer).
The name becomes an empty string and the whole string is saved as the email.
This affects Debian maintainers and uploaders (debian.py) and
pyproject.toml authors and maintainers (pypi.py).
How To Reproduce
from packagedcode.utils import parse_maintainer_name_email
parse_maintainer_name_email("John Doe [email protected]")
# actual: ('', 'John Doe [email protected]')
# expected: ('John Doe [email protected]', None)
parse_maintainer_name_email("John Doe <[email protected]")
# actual: ('John Doe', '[email protected]')
# expected: ('John Doe <[email protected]', None)
parse_maintainer_name_email("Debian systemd Maintainers <[email protected]>")
# works correctly, unchanged
Suggested fix
has_email = "@" in maintainer and all(
char in maintainer
for char in email_wrappers
)
- 主要言語
- Python
- スター
- 2.7k
- フォーク
- 848
- 平均マージ
- 2日 19時間
- マージ済み PR(30日)
- 8
環境構築
- Dockerfile または Docker Compose ファイルあり
- プルリクエストのテンプレートあり
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
aboutcode-org/scancode-toolkit のほかの issue
-
scancode aborts when encountering a broken RPM archive対応中かも @adeba4343-web が 2 日前に担当しました。 オープンbug
難易度 2/5 1〜3時間 初心者へのやさしさ 62/100
aboutcode-org/scancode-toolkit#5407 · コメント 1 件 ·
メンテナーはふだん 2 日以内に返信
-
Four silent bugs: IsRequiredPhrase.license_expression returns None, find_in_path ignores later PATH changes, duplicate dict keys override license mappings対応中かも このイシューにリンクされたプルリクエストがオープン中、またはマージ済みです。 オープンbug
難易度 2/5 半日 初心者へのやさしさ 65/100
aboutcode-org/scancode-toolkit#5405 ·
メンテナーはふだん 2 日以内に返信
-
bug: Unreachable JSON extension and format validation in validate_input_path対応中かも @0Cymantek0 が 24 日前に担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
aboutcode-org/scancode-toolkit#5351 · コメント 1 件 ·
メンテナーはふだん 2 日以内に返信
-
CycloneDX output: metadata.properties[].value emits JSON array instead of string対応中かも @0Cymantek0 が 24 日前に担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 62/100
aboutcode-org/scancode-toolkit#5349 · コメント 1 件 ·
メンテナーはふだん 2 日以内に返信
-
Duplicate 'COPYLEFT' entries in legal file classification names in legal.py and classify.py対応中かも @Pradeepbeleri が 51 日前に担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 88/100
aboutcode-org/scancode-toolkit#5319 · コメント 2 件 ·
メンテナーはふだん 2 日以内に返信
aboutcode-org/scancode-toolkit の issue をすべて見る
似ている issue
-
flow-measurement measurement
難易度 1/5 1時間未満 初心者へのやさしさ 76/100
MichaelYcJo/SpecSeal#1366 ·
-
bug c/evals c/ui size:L
難易度 2/5 1〜3時間 初心者へのやさしさ 66/100
Arize-ai/phoenix#17633 · コメント 2 件 · リアクション 1 件 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
TransformerLensOrg/TransformerLens#1980 ·
メンテナーはふだん 1 日以内に返信
-
Module: Solr Needs: Lead Needs: Triage Theme: Search Type: Bug
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
internetarchive/openlibrary#14284 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
難易度 1/5 1時間未満 初心者へのやさしさ 69/100
SpaceCowMedia/commander-spellbook-backend#1292 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信