Subject: | Storable crashes if /tmp is on another filesystem as cwd |
If /tmp (default directory used by File::Temp) is on another partition
than the current working directory, any attempt to store a value with
Storable as a backend results in a crash, with no useful error message.
This patch adds the actual error to the message, and forces File::Temp
to use the same directory as the final file to create its temporary file:
---
/usr/local/share/perl/5.10.1/Bot/BasicBot/Pluggable/Store/Storable.pm
2011-06-17 08:46:08.687423901 +0200
+++
/usr/local/share/perl/5.10.1/Bot/BasicBot/Pluggable/Store/Storable.pm*.save
2011-06-12 10:13:06.000000000 +0200
@@ -24,18 +24,18 @@
for my $name (@modules) {
my $filename = File::Spec->catfile( $self->{dir}, $name .
".storable" );
- my ( $fh, $tempfile ) = tempfile( DIR => $self->{dir}, UNLINK
=> 0 );
+ my ( $fh, $tempfile ) = tempfile( UNLINK => 0 );
nstore( $self->{store}{$name}, $tempfile )
or die "Cannot save to $tempfile\n";
rename $tempfile, $filename
- or die "Cannot create $filename: $!\n";
+ or die "Cannot create $filename\n";
}
}