[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#142481: boot-floppies: tries to mount partition as XFS even after reinitialisation



Package: boot-floppies
Version: N/A; reported 2002-04-12
Severity: normal

See subject. mke2fs and mkreiserfs do not touch the first 100 bytes of
the partition, but exactly this area (first 4 chars) is used to detect
the XFS filesystem. So you can reinitialise an ex-XFS partition as often as
you want, dbootstrap detects the old XFS header and runs mount with -t xfs.

I tried to make a workaround (attachment), though I did not work and
have not much time this weekend. If someone wants to fix and test, go
ahead.

Gruss/Regards,
Eduard.
-- System Information
Debian Release: 3.0
Architecture: i386
Kernel: Linux zombie 2.4.18 #2 Mit Apr 10 11:14:30 CEST 2002 i686
Locale: LANG=de_DE@euro, LC_CTYPE=de_DE@euro

-- 
<Zomb> kennt jemand eine DAU-freundliche Möglichkeit, die Uhrzeit einzustellen?
<roots-> zomb: date --set
<Zomb> roots-: muss ich da auf diese DOS-Ebene? Igit, da muss man ja tippen...
                                        -- #debian.de
Index: utilities/dbootstrap/partition_config.c
===================================================================
RCS file: /cvs/debian-boot/boot-floppies/utilities/dbootstrap/partition_config.c,v
retrieving revision 1.164
diff -u -r1.164 partition_config.c
--- utilities/dbootstrap/partition_config.c	2002/04/06 20:29:40	1.164
+++ utilities/dbootstrap/partition_config.c	2002/04/11 23:01:33
@@ -766,8 +766,8 @@
       char xfsmagic[6];
       char e2fsmagic[4];
       char shfsmagic[11];
+      int e2notfound;
 
-
       bzero(xfsmagic, sizeof(xfsmagic));
       bzero(e2fsmagic, sizeof(e2fsmagic));
       bzero(shfsmagic, sizeof(shfsmagic));
@@ -780,6 +780,9 @@
       fread (xfsmagic, 5, 1, fd);
       fseek (fd, 65588, SEEK_SET);
       fread (shfsmagic, 10, 1, fd);
+      fseek (fd, 1080, SEEK_SET);
+      fread (e2fsmagic, 2, 1, fd);
+      e2notfound = (strncmp("\x53\xef", e2fsmagic, 2));
       fseek (fd, 1116, SEEK_SET);
       fread (e2fsmagic, 1, 4, fd);
 
@@ -789,18 +792,8 @@
       else
          strcpy(e2fsmagic, "2");
 
-      if (!(strcmp(xfsmagic, "XFSB"))) { /* XFS */
-#if #cpu(powerpc)
-	if (verify_powerpc_mount(mount_point, "xfs"))
-	  return 1;
-#endif
-	INFOMSG("Mounting XFS partition %s on %s", partition->name, mount_point);
-	snprintf(prtbuf, sizeof(prtbuf), "mount -t xfs %s %s", partition->name, real_mount_point);
-	status = execlog(prtbuf, LOG_INFO);
-      }
-
       /* thanks to journey@jps.net for the clue about the reiserfs magic number */
-      else if (!(strcmp(shfsmagic, "ReIsErFs") && strcmp(shfsmagic, "ReIsEr2Fs"))) /* reiserfs */
+      if (!(strcmp(shfsmagic, "ReIsErFs") && strcmp(shfsmagic, "ReIsEr2Fs"))) /* reiserfs */
 	{
 #if #cpu (powerpc)
 	if (verify_powerpc_mount(mount_point, "reiserfs"))
@@ -828,6 +821,15 @@
 		   partition->name, real_mount_point);
 	  status = execlog(prtbuf, LOG_INFO);
 	}
+      else if (e2notfound && !(strcmp(xfsmagic, "XFSB"))) { /* XFS */
+#if #cpu(powerpc)
+	if (verify_powerpc_mount(mount_point, "xfs"))
+	  return 1;
+#endif
+	INFOMSG("Mounting XFS partition %s on %s", partition->name, mount_point);
+	snprintf(prtbuf, sizeof(prtbuf), "mount -t xfs %s %s", partition->name, real_mount_point);
+	status = execlog(prtbuf, LOG_INFO);
+      }
       else if (is_ext3) { /* ext2/ext3 */
 	if (!strcmp(mount_point, "/boot")) {
 	  if (

Reply to: