Error adding metadata to small files on windows

Started by Archive, May 12, 2010, 08:54:40 AM

Previous topic - Next topic

Archive

[Originally posted by tbraber on 2009-09-23 09:05:11-07]


 When I add metadata in a perl script with Image::ExifTool on WIndows XP or server 2003 it is unable to add metadata to small files (gif, jpeg).

The error is: Error renaming temporary file after deleting original.

What is left is the temp file.

I do not know the exact size below it it going to fail but larger files > 100k work fine.

Even if I do it my self:
Code:
unless ( $exifTool->WriteInfo($self->{sourcefile}, $tmpfile) ){
   
   undef $exifTool;
   if ( unlink $self->{sourcefile} ){
      unless (rename $tmpfile, $self->{sourcefile}){
         $status .= "Rename: $!";
         sleep 1;
         unless (rename $tmpfile, $self->{sourcefile}){
            $status .= " Rename(2) Error: $!";
            $self->{statusid} = 'error';
         } else {
            $status .= " Rename could only be preformed after 1 sec. of sleep";
            $self->{statusid} = 'warn';
         }
      }
   } else {
      $self->{statusid} = 'error';
      return "Delete: $!";
   }
}

Will give the same kind of error.
It looks like the file is still open even after deleting the exiftool object.

The sleep 1 also did not work (you never know).

Hope you can help,

Thomas

Archive

[Originally posted by tbraber on 2009-09-23 09:33:52-07]

Found some clues

It only happends if I uploaded the file with libapreq2 and edit the metadata with exiftool right after uploading.

It looks like Apache keeps small files open and closes them only if the request is finished.

I looks like it is not related to Exiftool.

So Exiftool is still my number one.

Archive

[Originally posted by exiftool on 2009-09-23 10:51:05-07]

Yes, Windows has this underlying problem in its filesystem (can't
edit a file which is opened by another process).  This "feature"
makes Windows prone to denial-of-service attacks.  You won't
have this problem on any other operating system.

- Phil