[interchange-cvs] interchange - heins modified 3 files
interchange-core@icdevgroup.org
interchange-core@icdevgroup.org
Fri Aug 9 22:30:59 2002
User: heins
Date: 2002-08-10 02:30:27 GMT
Modified: lib/Vend Data.pm Interpolate.pm Scan.pm
Log:
* Patches to make instant database handling of delimited files work.
* Changed _file_security_scalar in Scan.pm to use the standard
file_name_is_absolute() routine instead of homegrown check.
Which exposed a rather nasty little fault in the logic there.
-- If the search type is db, and the basename of the source
file for the table does not match the table name, there is
a big problem. The table name will be transformed by this
routine, and the search will fail with a "foo non-existent
table" error.
I don't think this has bitten very many people, because in
practice most people name the file the same as the table, but
it should be corrected. Unfortunately, we don't know the search
type until after this is done.
My idea is that we no longer be able to find the file name for
a text search based on the table name. I doubt many people were
intentionally using this feature, and all you have to do is
pass "products.txt" on the fi=3D spec to solve the problem.
Revision Changes Path
2.15 +2 -1 interchange/lib/Vend/Data.pm
rev 2.15, prev_rev 2.14
Index: Data.pm
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
RCS file: /var/cvs/interchange/lib/Vend/Data.pm,v
retrieving revision 2.14
retrieving revision 2.15
diff -u -r2.14 -r2.15
--- Data.pm 7 Aug 2002 08:02:59 -0000 2.14
+++ Data.pm 10 Aug 2002 02:30:26 -0000 2.15
@@ -1,6 +1,6 @@
# Vend::Data - Interchange databases
#
-# $Id: Data.pm,v 2.14 2002/08/07 08:02:59 mheins Exp $
+# $Id: Data.pm,v 2.15 2002/08/10 02:30:26 mheins Exp $
#=20
# Copyright (C) 1996-2002 Red Hat, Inc. <interchange@redhat.com>
#
@@ -100,6 +100,7 @@
=20=09
$Vend::Database{$dbname}
and return $Vend::Database{$dbname}->ref();
+ $Vend::WriteDatabase{$file} and $Vend::WriteDatabase{$dbname} =3D 1;
if( file_name_is_absolute($_[0]) ) {
my $msg =3D errmsg(
"Instant database (%s): no absolute file names.",
2.103 +5 -2 interchange/lib/Vend/Interpolate.pm
rev 2.103, prev_rev 2.102
Index: Interpolate.pm
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
RCS file: /var/cvs/interchange/lib/Vend/Interpolate.pm,v
retrieving revision 2.102
retrieving revision 2.103
diff -u -r2.102 -r2.103
--- Interpolate.pm 7 Aug 2002 08:02:59 -0000 2.102
+++ Interpolate.pm 10 Aug 2002 02:30:26 -0000 2.103
@@ -1,6 +1,6 @@
# Vend::Interpolate - Interpret Interchange tags
#=20
-# $Id: Interpolate.pm,v 2.102 2002/08/07 08:02:59 mheins Exp $
+# $Id: Interpolate.pm,v 2.103 2002/08/10 02:30:26 mheins Exp $
#
# Copyright (C) 1996-2002 Red Hat, Inc. <interchange@redhat.com>
#
@@ -27,7 +27,7 @@
require Exporter;
@ISA =3D qw(Exporter);
=20
-$VERSION =3D substr(q$Revision: 2.102 $, 10);
+$VERSION =3D substr(q$Revision: 2.103 $, 10);
=20
@EXPORT =3D qw (
=20
@@ -2060,6 +2060,9 @@
$Sql{$tab} =3D $hole->wrap($db->dbh())
if $db->can('dbh');
$Db{$tab} =3D $hole->wrap($db);
+ if($db->config('name') ne $tab) {
+ $Db{$db->config('name')} =3D $Db{$tab};
+ }
}
else {
$Sql{$tab} =3D $db->[$Vend::Table::DBI::DBI]
2.16 +4 -6 interchange/lib/Vend/Scan.pm
rev 2.16, prev_rev 2.15
Index: Scan.pm
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
RCS file: /var/cvs/interchange/lib/Vend/Scan.pm,v
retrieving revision 2.15
retrieving revision 2.16
diff -u -r2.15 -r2.16
--- Scan.pm 7 Aug 2002 08:02:59 -0000 2.15
+++ Scan.pm 10 Aug 2002 02:30:26 -0000 2.16
@@ -1,6 +1,6 @@
# Vend::Scan - Prepare searches for Interchange
#
-# $Id: Scan.pm,v 2.15 2002/08/07 08:02:59 mheins Exp $
+# $Id: Scan.pm,v 2.16 2002/08/10 02:30:26 mheins Exp $
#
# Copyright (C) 1996-2002 Red Hat, Inc. <interchange@redhat.com>
#
@@ -29,7 +29,7 @@
perform_search
);
=20
-$VERSION =3D substr(q$Revision: 2.15 $, 10);
+$VERSION =3D substr(q$Revision: 2.16 $, 10);
=20
use strict;
use Vend::Util;
@@ -873,19 +873,17 @@
defined $_[1] ? $_[1] : '';
}
=20
-my $Pat =3D ($^O =3D~ /win32/i) ? '([A-Za-z]:)?[\\/]' : '/';
-
sub _file_security {
my ($junk, $param, $passed) =3D @_;
$passed =3D [] unless $passed;
my(@files) =3D grep /\S/, split /\s*[,\0]\s*/, $param, -1;
for(@files) {
- my $ok =3D (m:^$Pat:o || /\.\./) ? 0 : 1;
+ my $ok =3D (file_name_is_absolute($_) or /\.\./) ? 0 : 1;
if(!$ok) {
$ok =3D 1 if $_ eq $::Variable->{MV_SEARCH_FILE};
$ok =3D 1 if $::Scratch->{$_};
}
- if($_ !~ /\./) {
+ if(/^\w+$/ and ! $::Variable->{MV_DEFAULT_SEARCH_DB}) {
$_ =3D $Vend::Cfg->{Database}{$_}{file}
if defined $Vend::Cfg->{Database}{$_};
}