Bug: SetFileTime error for '<image>.JPG_exiftool_tmp'

Started by Louis Strous, April 07, 2016, 11:15:14 AM

Previous topic - Next topic

Louis Strous

When I attempt to modify the DateTimeOriginal and FileModifyDate values with a single WriteInfo call, then I consistently get "SetFileTime error for '<image>.JPG_exiftool_tmp'" messages in the value of the "Warning" tag, and the FileModifyDate value is not adjusted.  It looks like it is attempted to set the FileModifyDate of the temporary (*.JPG_exiftool_tmp) file after that file has already been renamed (to *.JPG).

I'm using Image::ExifTool version 10.13 with Strawberry Perl 5.18.2 (yes, old) on Windows 7 (64 bits).  The command line and console output are


C:\Users\Louis\Pictures>perl image-exiftool-bug.pl IMG_0938.JPG
WriteInfo        success = 1, error = , warning = SetFileTime error for 'IMG_0938.JPG_exiftool_tmp'


and I attach the (1 kB) image-exiftool-bug.pl script and (8 kB) IMG_0938.JPG.

I traced the problem to the neighborhood of line 2224 of Image/ExifTool/Writer.pm.  The file renaming happens just before that line, and the FileModifyDate setting happens just after it.  The $target that is used in the SetFileModifyDate calls is wrong in my case, but I don't know how to change the code that picks $target in such as way that it is correct for all use cases.

Regards,
Louis Strous

Phil Harvey

Thanks for this detailed bug report.

I can reproduce this bug (thanks to the script you posted), and it will be fixed in ExifTool 10.14 when it is released.

Until then, you may work around this problem by writing to a different output file:

my $tmp = $file . '_my_tmp';
$success = $et->WriteInfo($file, $tmp);
rename $tmp, $file if $success;


- Phil
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux/PowerShell, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).

Phil Harvey

ExifTool 10.14 is now available, and should fix this problem.

Thanks again for the bug report.

- Phil
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux/PowerShell, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).

Louis Strous

Version 10.14 solves the problem.  Thank you very much!

Regards,
Louis Strous