DBI parse_dsn accepts malformed DSNs without the dbi prefix

Open
#1,390 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
3/5
Estimated time
1-2 days
Newbie friendliness
72/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Active
Tech stack
perl
Domain
backend

Research direction

Start by running t/02_basic.t and comparing the bundled DBI->parse_dsn behavior with standard DBI, focusing on the malformed "bi:mysql:database=mytbl" case. The change is done when the missing dbi: prefix is rejected and DBIx::DSN::Resolver->resolv croaks on both execution backends.

Written by the indexing model from the issue text.

Description

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

Dominant language
Perl
Stars
64
Forks
6
Avg merge
5h 25m
Merged PRs (30d)
157

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from fglock/PerlOnJava

All issues in fglock/PerlOnJava

Similar issues

More Perl issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.