From owner-freebsd-questions@FreeBSD.ORG Thu May 4 04:37:34 2006 Return-Path: X-Original-To: freebsd-questions@freebsd.org Delivered-To: freebsd-questions@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 6C2DB16A401 for ; Thu, 4 May 2006 04:37:34 +0000 (UTC) (envelope-from mark.rowlands@mypost.se) Received: from mxf1.bahnhof.se (mxf1.bahnhof.se [213.80.101.25]) by mx1.FreeBSD.org (Postfix) with ESMTP id E8C1743D46 for ; Thu, 4 May 2006 04:37:33 +0000 (GMT) (envelope-from mark.rowlands@mypost.se) Received: from localhost (mxf1.local [127.0.0.1]) by mxf1-reinject (Postfix) with ESMTP id 14039272A7 for ; Thu, 4 May 2006 06:37:31 +0200 (CEST) Received: from mxf1.bahnhof.se ([127.0.0.1]) by localhost (smtp-one-1.wash.one.se [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 13411-01-2 for ; Thu, 4 May 2006 06:36:59 +0200 (CEST) Received: from 81-170-153-180.bahnhofbredband.net (81-170-153-180.bahnhofbredband.net [81.170.153.180]) by mxf1.bahnhof.se (Postfix) with ESMTP id D1AC02728C for ; Thu, 4 May 2006 06:36:59 +0200 (CEST) From: mark To: freebsd-questions@freebsd.org Date: Wed, 3 May 2006 21:49:21 +0200 User-Agent: KMail/1.9.1 MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200605032149.24248.mark.rowlands@mypost.se> X-Virus-Scanned: by amavisd-new at one.se (smtp-one-1) X-Spam-Status: No, hits=-0.742 tagged_above=-999 required=6.31 tests=AWL, BAYES_00, RCVD_IN_NJABL_DUL X-Spam-Level: Subject: "Inappropriate file type or format" error when accessing berkely DB file via perl X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 04 May 2006 04:37:34 -0000 I am trying to access my squidguard berkely db files via perl and DB_File (as per the SquidGuard docs) When I run the following perl snippet #!/usr/bin/perl use DB_File; my (%url,%domain); $DB_BTREE->{compare} = \&domainmatch; my $domain_db = tie(%domain, "DB_File", "/var/db/squidGuard/warez/domains.db", O_CREAT| O_RDWR, 0664, $DB_BTREE) || die("domains.db: $!\n"); $domain_db->put(".six.com","") unless(exists($domain{"six.com"})); $domain_db->sync; # Seems to only sync the last change. undef($domain_db); # Destroy the object untie(%domain); # Sync and close the file and undef the hash The following is returned domains.db: Inappropriate file type or format When I do a file /var/db/squidGuard/warez/domains.db the following is displayed /var/db/squidGuard/warez/domains.db: Berkeley DB (Btree, version 8, native byte-order) When I create a db with perl #!/usr/bin/perl -w use strict; use DB_File; my %database; tie %database, 'DB_File', "createdb.dat" or die "Can't initialize database: $!\n"; untie %database; exit; then file createdb.dat reveals :- createdb.dat: Berkeley DB 1.85 (Hash, version 2, native byte-order) I suspect the version 2 / version 8 is the srouce of my innappropriate file type or format error! So ...... I tried reinstalling DB_file guessing that it had some kind of dependency on DB3.. Thsi had no effect. I tried reinstalling Perl itself. Also no effect. So I am a bit stuck, How do I get DB_File to play nice with DB3 or should I be trying some other method to access these files. Relevant Ports installed db3-3.3.11_2,1 bsdpan-DB_File-1.814 p5-DBD-mysql41-3.0002 squid-2.5.13 squidGuard-1.2.0_1 perl-5.8.8 possible related ports dbh-1.0.24_1 gdbm-1.8.3_2 p5-DBI-1.50 FreeBSD pcmarpxy.mwrwin2k.se 6.0-STABLE FreeBSD 6.0-STABLE #1: Fri Dec 23 11:58:53 CET 2005 root@pcmarpxy.mwrwin2k.se:/usr/obj/usr/src/sys/MARK i386