WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-users

Re: [PATCH] Re: [Xen-users] Problems with pygrub: ValueError: unableto o

To: "Michael Paesold" <mpaesold@xxxxxx>
Subject: Re: [PATCH] Re: [Xen-users] Problems with pygrub: ValueError: unableto open file
From: "Michael Paesold" <mpaesold@xxxxxx>
Date: Fri, 31 Mar 2006 09:18:53 +0200
Cc: Xen Users <xen-users@xxxxxxxxxxxxxxxxxxx>
Delivery-date: Fri, 31 Mar 2006 07:20:43 +0000
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-users-request@lists.xensource.com?subject=help>
List-id: Xen user discussion <xen-users.lists.xensource.com>
List-post: <mailto:xen-users@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-users>, <mailto:xen-users-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-users>, <mailto:xen-users-request@lists.xensource.com?subject=unsubscribe>
References: <011601c64eb4$39a8a030$0f01a8c0@zaphod> <442C27D1.5060800@xxxxxx> <442C2BEA.9080109@xxxxxx>
Sender: xen-users-bounces@xxxxxxxxxxxxxxxxxxx
I am sorry, this patches produces a warning if HAVE_EXT2FS_OPEN2 is not defined (unused variable) and will break the build with -Werror. I will send a new patch.

Best Regards,
Michael Paesold

I wrote:
Improve pygrub error reporting when opening ext2 fs is not possible

As reported in the thread:
http://lists.xensource.com/archives/html/xen-users/2006-03/msg00721.html,
pygrub does not open ext2 file systems in partitioned images or sub
partitions on e.g. CentOS/RHEL 4, because e2fsprogs ext2fs_open does not
support an offset into the file to be opened.

With this patch, the error is correctly reported instead of a generic
"unable to open file" (and leaving the user searching in the dark).

Signed-off-by: Michael Paesold <mpaesold@xxxxxx>

diff -r f0e14b4e535c tools/pygrub/src/fsys/ext2/ext2module.c
--- a/tools/pygrub/src/fsys/ext2/ext2module.c Thu Mar 30 14:37:22 2006 +0100 +++ b/tools/pygrub/src/fsys/ext2/ext2module.c Thu Mar 30 20:52:41 2006 +0200
@@ -225,19 +225,24 @@ ext2_fs_open (Ext2Fs *fs, PyObject *args
         return NULL;
     }

+#ifdef HAVE_EXT2FS_OPEN2
     if (offset != 0) {
         snprintf(offsetopt, 29, "offset=%d", offset);
     }

-#ifdef HAVE_EXT2FS_OPEN2
     err = ext2fs_open2(name, offsetopt, flags, superblock, block_size,
                        unix_io_manager, &efs);
 #else
+    if (offset != 0) {
+ PyErr_SetString(PyExc_ValueError, "offset argument not supported");
+        return NULL;
+    }
+
     err = ext2fs_open(name, flags, superblock, block_size,
                       unix_io_manager, &efs);
 #endif
     if (err) {
-        PyErr_SetString(PyExc_ValueError, "unable to open file");
+        PyErr_SetString(PyExc_ValueError, "unable to open filesystem");
         return NULL;
     }


_______________________________________________
Xen-users mailing list
Xen-users@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-users





_______________________________________________
Xen-users mailing list
Xen-users@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-users