Show quoted text> -----Original Message-----
> From: Bugs in RRD-Simple via RT [mailto:bug-RRD-Simple@rt.cpan.org]
> Sent: Wednesday, June 03, 2009 11:32
> To: Jacques, Olivier (PD&E IT Test)
> Subject: [rt.cpan.org #46638] AutoReply: Temporary files not deleted on
> win32 - patch included
>
>
> Greetings,
>
> This message has been automatically generated in response to the
> creation of a trouble ticket regarding:
> "Temporary files not deleted on win32 - patch included",
> a summary of which appears below.
>
> There is no need to reply to this message right now. Your ticket has
> been
> assigned an ID of [rt.cpan.org #46638]. Your ticket is accessible
> on the web at:
>
>
https://rt.cpan.org/Ticket/Display.html?id=46638
>
> Please include the string:
>
> [rt.cpan.org #46638]
>
> in the subject line of all future correspondence about this issue. To
> do so,
> you may reply to this message.
>
> Thank you,
> bug-RRD-Simple@rt.cpan.org
>
> -----------------------------------------------------------------------
> --
> This transaction appears to have no content
The original ticket had no content. Here it is:
When using "update" for RRD data sources that are not already in the rrd, RRD::Simple adds a new data source. It is done by exporting to XML the current RRD, do the necessary changes to add a new data source and re-import it as a new rrd.
The problem is that this process does not completely work under win32. The "unlink" used to clean the temporary files fails with "Permission denied" error. I tracked this to be a file handle that was still opened on those temporary files.
Here is the patch in order not to open a file handle when generating the temporary file name, which removes the issue. An alternative would be to close the additional file handles (tempImportXmlFileFH/ tempXmlFileFH) - but has those file handles are unused, the patch below is the best method:
--- Simple.pm.orig 2009-05-27 19:08:31.056090500 +0200
+++ Simple.pm 2009-06-03 11:49:55.312517200 +0200
@@ -1302,10 +1295,11 @@
# Generate an XML dump of the RRD file
# - Added "tmpdir" support in 1.44
my $tmpdir = defined $stor->{tmpdir} ? $stor->{tmpdir} : File::Spec->tmpdir();
- my ($tempXmlFileFH,$tempXmlFile) = File::Temp::tempfile(
+ my (undef,$tempXmlFile) = File::Temp::tempfile(
DIR => $tmpdir,
TEMPLATE => 'rrdXXXXX',
SUFFIX => '.tmp',
+ OPEN => 0
);
# Check that we managed to get a sane temporary filename
@@ -1337,10 +1331,11 @@
# Open XML output file
# my $tempImportXmlFile = File::Temp::tmpnam();
# - Added "tmpdir" support in 1.44
- my ($tempImportXmlFileFH,$tempImportXmlFile) = File::Temp::tempfile(
+ my (undef,$tempImportXmlFile) = File::Temp::tempfile(
DIR => $tmpdir,
TEMPLATE => 'rrdXXXXX',
SUFFIX => '.tmp',
+ OPEN => 0
);
open(OUT, ">$tempImportXmlFile")
|| croak "Unable to open '$tempImportXmlFile': $!";
Thanks,
Olivier.