Hacktoberfest 2026:维护者为十月标记出来的 issue,仍然开放、适合新手。 浏览 Hacktoberfest issue

DBI parse_dsn accepts malformed DSNs without the dbi prefix

未关闭
#1,390 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 1 天内回复

还没有人认领这个 Issue。

评估

难度
3/5
预计耗时
1-2 天
新手友好度
72/100
Issue 类型
缺陷
描述清晰度
描述清楚
活跃度
活跃
技术栈
perl
领域
backend

调研方向

首先运行 t/02_basic.t,并将捆绑的 DBI->parse_dsn 行为与标准 DBI 进行比较,重点关注格式错误的 "bi:mysql:database=mytbl" 情况。当缺少 dbi: 前缀时被拒绝,并且 DBIx::DSN::Resolver->resolv 在两个执行后端上都 croaks 时,修改就完成了。

由索引模型根据 Issue 内容生成。

描述

area:cpan-port area:runtime bug

Summary

The bundled DBI->parse_dsn accepts malformed DSNs that do not begin with the required dbi: prefix. This causes DBIx::DSN::Resolver to silently return an invalid DSN instead of throwing an error.

Affected distribution

  • Distribution: DBIx-DSN-Resolver
  • Version: 0.09
  • CPAN run: 20260915-125610-17469
  • PerlOnJava commit: 30095483379e4aa76540da1330f8f407bc145151

Reproduction

use DBIx::DSN::Resolver;

my $resolver = DBIx::DSN::Resolver->new;
eval { $resolver->resolv('bi:mysql:database=mytbl') };
die "expected an error\n" unless $@;

The same behavior is covered by the upstream test t/02_basic.t, line 34:

eval {
    $r->resolv("bi:mysql:database=mytbl"),
};
ok($@);

Expected behavior

The malformed bi: DSN should be rejected by DBI->parse_dsn, causing DBIx::DSN::Resolver->resolv to croak.

Actual behavior

PerlOnJava accepts the malformed DSN and returns it unchanged:

value=bi:mysql:database=mytbl err=[]

The failure is reproducible on both execution backends:

  • JVM backend: t/02_basic.t fails at test 6 (line 34).
  • Interpreter backend: the focused reproduction also returns the invalid DSN without an error.

Comparison with system Perl

System Perl passes the complete upstream suite:

t/00_compile.t .. ok
t/02_basic.t .... ok
t/03_dsn.t ...... ok
Result: PASS

The archived PerlOnJava CPAN run reports 1 failed subtest out of 18, with the other test files passing. The failure is independent of DNS/network availability because it concerns the malformed DSN without a hostname.

Suggested investigation

Compare the bundled PerlOnJava implementation of DBI->parse_dsn with standard DBI behavior. It should reject DSNs that do not match the required dbi:<driver>:<driver_dsn> form, rather than treating bi: as a valid scheme and allowing DBIx::DSN::Resolver to return the original string.

Labels

bug, area:cpan-port, area:runtime

主要语言
Perl
星标
64
派生
7
平均合并
4 小时 29 分钟
30 天内合并 PR
176

环境准备

  • 提供 Dockerfile 或 Docker Compose 文件
  • 没有 Pull Request 模板
  • 阅读贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

fglock/PerlOnJava 的其他 Issue

查看 fglock/PerlOnJava 的全部 Issue

相似的 Issue

更多 Perl Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。