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-changelog

[Xen-changelog] Improve pygrub error reporting when opening ext2 fs is n

To: xen-changelog@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-changelog] Improve pygrub error reporting when opening ext2 fs is not possible
From: Xen patchbot -unstable <patchbot-unstable@xxxxxxxxxxxxxxxxxxx>
Date: Tue, 04 Apr 2006 15:24:09 +0000
Delivery-date: Tue, 04 Apr 2006 08:54:33 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-id: BK change log <xen-changelog.lists.xensource.com>
List-post: <mailto:xen-changelog@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
Reply-to: xen-devel@xxxxxxxxxxxxxxxxxxx
Sender: xen-changelog-bounces@xxxxxxxxxxxxxxxxxxx
# HG changeset patch
# User mip@xxxxxxxxxxxxxxxxxxxxxx
# Node ID c5a833aec2abec5436038377aa2fb6be50dfafad
# Parent  7df5921af7e43cbee99b5aa85c021910ae91b05d
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 7df5921af7e4 -r c5a833aec2ab tools/pygrub/src/fsys/ext2/ext2module.c
--- a/tools/pygrub/src/fsys/ext2/ext2module.c   Mon Apr  3 17:23:00 2006
+++ b/tools/pygrub/src/fsys/ext2/ext2module.c   Mon Apr  3 17:28:54 2006
@@ -213,7 +213,9 @@
     int flags = 0, superblock = 0, offset = 0, err;
     unsigned int block_size = 0;
     ext2_filsys efs;
+#ifdef HAVE_EXT2FS_OPEN2
     char offsetopt[30];
+#endif
 
     if (!PyArg_ParseTupleAndKeywords(args, kwargs, "s|iiii", kwlist, 
                                      &name, &flags, &superblock, 
@@ -225,19 +227,24 @@
         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-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog

<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-changelog] Improve pygrub error reporting when opening ext2 fs is not possible, Xen patchbot -unstable <=