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

Bug#353432: partman-server as some trouble in setting the prep partition.



reassign 353432 partman-base
tags 353432 + patch help
thanks
On Sat, Feb 18, 2006 at 11:31:46AM +0100, Sven Luther wrote:

> parted_server: command_change_file_system(32256-8225279,prep)
> parted_server: partition_with_id(32256-8225279)
> parted_server: Bad file system type:
> parted_server: Line 1579. CRITICAL ERROR!!! EXITING
> /lib/partman/update.d/50filesystems: error_handler: expection with type
> /lib/partman/update.d/50filesystems: error_handler: reading message
> /lib/partman/update.d/50filesystems: error_handler: reading options

Ok, i found out why this fails. I must say that lvm and raid are probably ok,
but partman-palo will probably also be broken.

The issue is that palo and prep are both just plain partition types, which are
used as flags in libparted. This is not the best way of handling this, and
this will hopefully be fixed in futur versions of libparted, but right now
there is a prep and a palo flag, but no corresponding filesystem type.

parted-server.c at line 1579 contains :

void
command_change_file_system()
{
        char *id;
        PedPartition *part;
        char *s_fstype;
        PedFileSystemType *fstype;
        scan_device_name();
        if (dev == NULL)
                critical_error("The device %s is not opened.", device_name);
        open_out();
        if (2 != iscanf("%as %as", &id, &s_fstype))
                critical_error("Expected partition id and file system");
        log("command_change_file_system(%s,%s)", id, s_fstype);
        part = partition_with_id(disk, id);
        free(id);
        fstype = ped_file_system_type_get(s_fstype);
        free(s_fstype);
        if (fstype == NULL)
                critical_error("Bad file system type: %s", s_fstype);	<= line 1579
        ped_partition_set_system(part, fstype);
        oprintf("OK\n");
}

This will obviously fail. I ivaguely remember that there used to be some stuff
which made partman believe that prep was a filesystem, but i guess given the above
that this was lost sometime in the few past month.

So, what solution can we find to this ? Would we list somewhere the
'pseudo-filesystems', and then do something differently here ? Would we try to
set the filesystem, and if it fails, see if there is a flag of that name
around ? 

I guess the following solution is better, i implemented the below patch, which
is also checked in SVN as r34986.

This is still not clean enough, as it doesn't handle cases like someone trying
to use a boot or hidden filesystem, but i see no good way to deal with this
one way or the other without having the full list of flags listed, either for
the flags-that-are-partition-types, or for the real flags.

Friendly,

Sven Luther
Index: debian/changelog
===================================================================
--- debian/changelog	(revision 34248)
+++ debian/changelog	(working copy)
@@ -1,3 +1,12 @@
+partman-base (79) UNRELEASED; urgency=low
+
+  [ Sven Luther ]
+  * prep and palo are flags, not filesystem. Fix parted-server so that
+    command_change_file_system does try to set the flag if setting the
+    filesystem failed. (Closes: #353432)
+
+ -- Sven Luther <luther@debian.org>  Sat, 18 Feb 2006 21:50:45 +0000
+
 partman-base (78) unstable; urgency=low
 
   [ Martin Michlmayr ]
Index: parted_server.c
===================================================================
--- parted_server.c	(revision 34248)
+++ parted_server.c	(working copy)
@@ -1564,6 +1564,7 @@
         PedPartition *part;
         char *s_fstype;
         PedFileSystemType *fstype;
+	PedPartitionFlag flag;
         scan_device_name();
         if (dev == NULL)
                 critical_error("The device %s is not opened.", device_name);
@@ -1572,12 +1573,23 @@
                 critical_error("Expected partition id and file system");
         log("command_change_file_system(%s,%s)", id, s_fstype);
         part = partition_with_id(disk, id);
+	if (part == NULL) {
+		critical_error("Partition not found: %s", id);
+	}
         free(id);
         fstype = ped_file_system_type_get(s_fstype);
         free(s_fstype);
-        if (fstype == NULL)
-                critical_error("Bad file system type: %s", s_fstype);
-        ped_partition_set_system(part, fstype);
+        if (fstype == NULL) {
+		log("Filesystem %s not found, let's see if it is a flag", s_fstype);
+		flag = ped_partition_flag_get_by_name(s_fstype);
+		if (ped_partition_is_flag_available(part, flag)) {
+			ped_partition_set_flag(part, flag, 1);
+		} else {
+                	critical_error("Bad file system or flag type: %s", s_fstype);
+		}
+	} else {
+        	ped_partition_set_system(part, fstype);
+	}
         oprintf("OK\n");
 }
 

Reply to: