ImageMagick sets date:create incorrectly

Post any defects you find in the released or beta versions of the ImageMagick software here. Include the ImageMagick version, OS, and any command-line required to reproduce the problem. Got a patch for a bug? Post it here.
Post Reply
User avatar
AGWA
Posts: 1
Joined: 2014-10-25T14:33:41-07:00
Authentication code: 6789

ImageMagick sets date:create incorrectly

Post by AGWA »

ImageMagick currently sets the "date:create" property of images to the st_ctime field of the source image's stat struct. However, per the stat(2) man page, st_ctime contains not the creation time of a file, but the change time, which is the time that a file's inode information (permissions, link count, etc.) was last changed.

Consequentially, images produced by ImageMagick contain misleading information. It also means that if you rename or change the permissions
of a file, images converted from that file are no longer byte-for-byte identical with images previously produced from that file, even though the file didn't actually change.

Unfortunately, Unix doesn't provide any way to get a file's creation time. I therefore propose that ImageMagick simply stop setting the "date:create" property. The following patch accomplishes this. Could it be applied to ImageMagick? Cheers!

Code: Select all

Index: MagickCore/constitute.c
===================================================================
--- MagickCore/constitute.c	(revision 16820)
+++ MagickCore/constitute.c	(working copy)
@@ -721,9 +721,6 @@
     (void) FormatMagickTime(GetBlobProperties(next)->st_mtime,MaxTextExtent,
       timestamp);
     (void) SetImageProperty(next,"date:modify",timestamp,exception);
-    (void) FormatMagickTime(GetBlobProperties(next)->st_ctime,MaxTextExtent,
-      timestamp);
-    (void) SetImageProperty(next,"date:create",timestamp,exception);
     option=GetImageOption(image_info,"delay");
     if (option != (const char *) NULL)
       {
Post Reply