[parted-devel] [PATCH] Don't fail if unable to reread partition table

Jim Meyering jim at meyering.net
Thu Aug 7 20:24:36 UTC 2008


Soren Hansen <soren at canonical.com> wrote:
> Parted fails if telling the kernel to reread the partition table for the device
> in question fails. However, for loop back devices and possibly other
> types of disk images, this makes little sense.
>
> This patch makes libparted consider (ioctl(fd, BLKRRPART) || errno
> == EINVAL) succesful, and provides a test script as well.
>
> Signed-off-by: Soren Hansen <soren at canonical.com>
>
> ---
>  libparted/arch/linux.c |    4 ++--
>  tests/Makefile.am      |    3 ++-
>  tests/t8000-loop.sh    |   45 +++++++++++++++++++++++++++++++++++++++++++++
>  3 files changed, 49 insertions(+), 3 deletions(-)
>  create mode 100755 tests/t8000-loop.sh

Thanks for the patch and the new test.
Since the part that changes libparted/arch/linux.c also modifies how
Parted reacts to a failed attempt to tell the kernel about the "add
partition" event, I'm omitting it.  In addition, I've seen people who've
found obvious value in the "EINVAL" failure message (they were trying
to partition a device that they didn't realize was not partitionable),
so that's another reason not to suppress the diagnostic and failure.
Alerting users to such a fundamental misconception is worthwhile.

I've modified your test script to expect the existing
behavior (i.e., the mkpart failure) but your name is still
on it, so will wait for your "ok" before pushing it.

Here's the adjusted patch:



More information about the parted-devel mailing list