Re: rfc: test whether a device has a partition table

From: Linus Torvalds
Date: Wed Sep 24 2003 - 19:19:00 EST



On Thu, 25 Sep 2003, Andries Brouwer wrote:
>
> Ha, Linus - didn't you know I am always right?

Yeah, sure. But ...

> But being right in theory - like you say, I have repeated these
> things for many years - is not enough to submit a kernel patch.
> The post of today was prompted by a mail about
> certain USB devices:
>
> > On closer examination it seems to be the partition table
> > which is read ok (as one partition) on W2K and XP
> > but Linux (both 2.4 and 2.6) gets really confused and
> > thinks there are 4 malformed partitions.

So? There's a bug, and we'll fix it.

The _worst_ thing that can happen is that you have four extra (totally
bogus) partitions, and you end up using the whole device.

That's my point about partitioning - not that it's necessarily perfect,
but even when it _isn't_ perfect, it's no worse than not partitioning at
all.

I know you don't want the kernel to partition at all. But I don't see your
point.

> > Linux probably needs to handle this situation more
> > gracefully. A local police force bought a bunch of
> > these devices for Linux based forensic work. They
> > are a bit disappointed at the moment.
>
> So, now not only theory but also practice is involved, and
> we must do something.

Why don't they just read the whole device, if that is what they want to
do?

So we have two cases:
a) we have a bug in the partitioning code, and don't parse the partition
table right:
- let's fix the bug
b) people don't want to read the partition info at all, as it's bogus
- use the whole-device node.

In neither case is your "the kernel shouldn't guess" argument the answer,
as far as I can see. And in both cases you _can_ fix it up in user mode if
you know how, so clearly the kernel was no worse off guessing.

Linus

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/