Skip to contentSkip to conversation

iso uuid created vs modified

PATCH In review Robert Millan 1 participant 2 messages Sep 28, 2008

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 iso uuid created vs modified

Hi,

It seems our ISO UUID code was checking for modified date rather than created date as the source suggests. I believe this is the right thing to do (since theoretically two different images could share creation date), so my patch just renames it (and adds the real field for creation date while at it).

Signature · 5 lines
Robert Millan

  The DRM opt-in fallacy: "Your data belongs to us. We will decide when (and
  how) you may access your data; but nobody's threatening your freedom: we
  still allow you to remove your data and not access it at all."
iso9660.c +18 -17
Index: fs/iso9660.c
===================================================================
@@ -93,8 +93,9 @@
   grub_uint32_t path_table;
   grub_uint8_t unused5[12];
   struct grub_iso9660_dir rootdir;
-  grub_uint8_t unused6[641];
+  grub_uint8_t unused6[624];
   struct grub_iso9660_date created;
+  struct grub_iso9660_date modified;
 } __attribute__ ((packed));
 
 /* A single entry in the path table.  */
@@ -840,14 +841,14 @@
   data = grub_iso9660_mount (disk);
   if (data)
     {
-      if (! data->voldesc.created.year[0] && ! data->voldesc.created.year[1]
-	  && ! data->voldesc.created.year[2] && ! data->voldesc.created.year[3]
-	  && ! data->voldesc.created.month[0] && ! data->voldesc.created.month[1]
-	  && ! data->voldesc.created.day[0] && ! data->voldesc.created.day[1]
-	  && ! data->voldesc.created.hour[0] && ! data->voldesc.created.hour[1]
-	  && ! data->voldesc.created.minute[0] && ! data->voldesc.created.minute[1]
-	  && ! data->voldesc.created.second[0] && ! data->voldesc.created.second[1]
-	  && ! data->voldesc.created.hundredth[0] && ! data->voldesc.created.hundredth[1])
+      if (! data->voldesc.modified.year[0] && ! data->voldesc.modified.year[1]
+	  && ! data->voldesc.modified.year[2] && ! data->voldesc.modified.year[3]
+	  && ! data->voldesc.modified.month[0] && ! data->voldesc.modified.month[1]
+	  && ! data->voldesc.modified.day[0] && ! data->voldesc.modified.day[1]
+	  && ! data->voldesc.modified.hour[0] && ! data->voldesc.modified.hour[1]
+	  && ! data->voldesc.modified.minute[0] && ! data->voldesc.modified.minute[1]
+	  && ! data->voldesc.modified.second[0] && ! data->voldesc.modified.second[1]
+	  && ! data->voldesc.modified.hundredth[0] && ! data->voldesc.modified.hundredth[1])
 	{
 	  grub_error (GRUB_ERR_BAD_NUMBER, "No creation date in filesystem to generate UUID.");
 	  *uuid = NULL;
@@ -856,14 +857,14 @@
 	{
 	  *uuid = grub_malloc (sizeof ("YYYY-MM-DD-HH-mm-ss-hh"));
 	  grub_sprintf (*uuid, "%c%c%c%c-%c%c-%c%c-%c%c-%c%c-%c%c-%c%c",
-			data->voldesc.created.year[0], data->voldesc.created.year[1], 
-			data->voldesc.created.year[2], data->voldesc.created.year[3],
-			data->voldesc.created.month[0], data->voldesc.created.month[1],
-			data->voldesc.created.day[0], data->voldesc.created.day[1],
-			data->voldesc.created.hour[0], data->voldesc.created.hour[1],
-			data->voldesc.created.minute[0], data->voldesc.created.minute[1],
-			data->voldesc.created.second[0], data->voldesc.created.second[1],
-			data->voldesc.created.hundredth[0], data->voldesc.created.hundredth[1]);
+			data->voldesc.modified.year[0], data->voldesc.modified.year[1], 
+			data->voldesc.modified.year[2], data->voldesc.modified.year[3],
+			data->voldesc.modified.month[0], data->voldesc.modified.month[1],
+			data->voldesc.modified.day[0], data->voldesc.modified.day[1],
+			data->voldesc.modified.hour[0], data->voldesc.modified.hour[1],
+			data->voldesc.modified.minute[0], data->voldesc.modified.minute[1],
+			data->voldesc.modified.second[0], data->voldesc.modified.second[1],
+			data->voldesc.modified.hundredth[0], data->voldesc.modified.hundredth[1]);
 	}
     }
   else
#1 lore raw
Quoted 7 lines · Robert Millan

Hi,

It seems our ISO UUID code was checking for modified date rather than created date as the source suggests. I believe this is the right thing to do (since theoretically two different images could share creation date), so my patch just renames it (and adds the real field for creation date while at it).

Committed (after ack from Felix)

Signature · 5 lines
Robert Millan

  The DRM opt-in fallacy: "Your data belongs to us. We will decide when (and
  how) you may access your data; but nobody's threatening your freedom: we
  still allow you to remove your data and not access it at all."