Comment 4 for bug 6834

Revision history for this message
Debian Bug Importer (debzilla) wrote :

Message-ID: <email address hidden>
Date: Sat, 10 Jul 2004 12:09:21 -0400 (EDT)
From: Jayen Ashar <email address hidden>
To: Frank Lichtenheld <email address hidden>
cc: <email address hidden>
Subject: Re: Bug#256314: Found the cause

> >If I try to tie an array read only, and the file does not exist, the
> >file is created (wrong), but the tie fails (right).
>
> This behaviour is caused by the following code in DB_File.pm:
>
> # make recno in Berkeley DB version 2 (or better) work like
> # recno in version 1.
> if ($db_version > 1 and defined $arg[4] and $arg[4] =~ /RECNO/ and
> $arg[1] and ! -e $arg[1]) {
> open(FH, ">$arg[1]") or return undef ;
> close FH ;
> chmod $arg[3] ? $arg[3] : 0666 , $arg[1] ;
> }
>
> So, it's a feature, not a bug ;)

Okay, so it creates the file on purpose. But why does the tie fail?

> >If I try to tie an array read only, and the file does exist, the tie
> >fails with no error (wrong).
>
> Hmm, writing to a RDONLY array should probably cause an error, but it
> doesn't. Seems like a bug, but I don't know enough about the Perl XS
> interaction to spot the exact place where a change would be needed.
>

I didn't get to the point where I write yet. I'm just talking about
tying. Why does the tie fail? And why isn't there an error?

--Jayen

-----------
Jayen Ashar
Verification Engineer, IBM
ECE+CS+robotics+languages, CMU '02