Package: libdbi-perl / 1.643-3

t-51dbm_file.t-add-test-from-RT-99508.patch Patch series | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
From: Jens Rehsack <sno@netbsd.org>
Date: Tue, 6 Oct 2020 08:23:55 +0200
Subject: [1/2] t/51dbm_file.t: add test from RT#99508
Origin: https://github.com/perl5-dbi/dbi/commit/27b10b5c3aacabc091046beaba478e671bb6111c
Bug: https://github.com/perl5-dbi/dbi/pull/93
Bug-Debian: https://bugs.debian.org/972180
Bug-Debian-Security: https://security-tracker.debian.org/tracker/CVE-2014-10402

Add test with f_dir="something-not-existing" as reported in RT#99508
to verify when it's fixed for real.

Signed-off-by: Jens Rehsack <sno@netbsd.org>
---
 t/51dbm_file.t | 23 +++++++++++++++++++++++
 1 file changed, 23 insertions(+)

diff --git a/t/51dbm_file.t b/t/51dbm_file.t
index d9824cfca764..686a3d223a52 100644
--- a/t/51dbm_file.t
+++ b/t/51dbm_file.t
@@ -15,6 +15,27 @@ use DBI;
 
 do "./t/lib.pl";
 
+{
+    # test issue reported in RT#99508
+    my @msg;
+    eval {
+	local $SIG{__DIE__} = sub { push @msg, @_ };
+	my $dbh = DBI->connect ("dbi:DBM:f_dir=./hopefully-doesnt-existst;sql_identifier_case=1;RaiseError=1");
+    };
+    like ("@msg", qr{.*hopefully-doesnt-existst.*}, "Cannot open from non-existing directory with attributes in DSN");
+
+    @msg = ();
+    eval {
+	local $SIG{__DIE__} = sub { push @msg, @_ };
+	my $dbh = DBI->connect ("dbi:DBM:", , undef, undef, {
+	    f_dir               => "./hopefully-doesnt-existst",
+	    sql_identifier_case => 1,
+	    RaiseError          => 1,
+	});
+    };
+    like ("@msg", qr{.*hopefully-doesnt-existst}, "Cannot open from non-existing directory with attributes in HASH");
+}
+
 my $dir = test_dir();
 
 my $dbh = DBI->connect( 'dbi:DBM:', undef, undef, {
@@ -23,6 +44,8 @@ my $dbh = DBI->connect( 'dbi:DBM:', undef, undef, {
     }
 );
 
+ok( $dbh, "Connect with driver attributes in hash" );
+
 ok( $dbh->do(q/drop table if exists FRED/), 'drop table' );
 
 my $dirfext = $^O eq 'VMS' ? '.sdbm_dir' : '.dir';
-- 
2.28.0