[Debconf-devel] Bug#577632: Can't locate filetest.pm in @INC ... dpkg: error processing debconf
Joey Hess
joeyh at debian.org
Tue Apr 13 16:30:54 UTC 2010
Debconf can't use perl modules that are in perl-modules, it has to work
with only perl-base.
I'd suggest this patch as the cleanest fix. Only problem is that
DbDriver::Stack can fail if the topmost DbDriver in a stack is readonly,
and this can turn DbDrivers that were at least apparently not readonly
into readonly ones. I think, but am not sure, that the stack dbdriver
would fail only if the file dbdriver would have failed before.
Index: Debconf/DbDriver/File.pm
===================================================================
--- Debconf/DbDriver/File.pm (revision 2440)
+++ Debconf/DbDriver/File.pm (working copy)
@@ -92,28 +92,29 @@
close $fh;
}
- # Open file for read but also with write access so below exclusive
- # lock can be done portably.
- my $openmode = "<";
- if (not $this->{readonly}) {
- use filetest 'access';
- if (-W $this->{filename}) {
- $openmode = "+<";
+ if (! $this->{readonly}) {
+ # Open file for read but also with write access so
+ # exclusive lock can be done portably.
+ if (open ($this->{_fh}, "+<", $this->{filename})) {
+ # Now lock the file with flock locking. I don't
+ # wait on locks, just error out. Since I open a
+ # lexical filehandle, the lock is dropped when
+ # this object is destroyed.
+ while (! flock($this->{_fh}, LOCK_EX | LOCK_NB)) {
+ next if $! == &POSIX::EINTR;
+ $this->error("$this->{filename} is locked by another process: $!");
+ last;
+ }
}
+ else {
+ # fallthrough to readonly mode
+ $this->{readonly}=1;
+ }
}
- if (! open ($this->{_fh}, $openmode, $this->{filename})) {
- $this->error("could not open $this->{filename}: $!");
- return; # always abort, even if not throwing fatal error
- }
-
- if (! $this->{readonly}) {
- # Now lock the file with flock locking. I don't wait on
- # locks, just error out. Since I open a lexical filehandle,
- # the lock is dropped when this object is destroyed.
- while (! flock($this->{_fh}, LOCK_EX | LOCK_NB)) {
- next if $! == &POSIX::EINTR;
- $this->error("$this->{filename} is locked by another process: $!");
- last;
+ if ($this->{readonly}) {
+ if (! open ($this->{_fh}, "<", $this->{filename})) {
+ $this->error("could not open $this->{filename}: $!");
+ return; # always abort, even if not throwing fatal error
}
}
--
see shy jo
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 828 bytes
Desc: Digital signature
URL: <http://lists.alioth.debian.org/pipermail/debconf-devel/attachments/20100413/ec4f685d/attachment.pgp>
More information about the Debconf-devel
mailing list