Bug#735169: os-prober cannot work with the latest upstream blkid (util-linux-2.24)
Hi,
This patch works good for me.
-kcao
On Sat, Jul 12, 2014 at 12:55:08AM +0200, Andreas Henriksson wrote:
> Control: tags -1 + patch
>
> Hello!
>
> I'm working on an updated util-linux package (v2.24.2) and was pointed
> to this os-prober bug report.
>
> In my limited testing I haven't been able to reproduce any problems
> here with os-prober and util-linux 2.24.2.
>
> I can confirm though that the behaviour of running blkid against
> an extended dos partition has changed. In the new version information
> is correctly reported for those instead of just erroring out.
>
> The old blkid version (2.20.1) returns error code 2 when running
> against an extended dos partition.
>
> $ sudo blkid -V
> blkid from util-linux 2.24.2 (libblkid 2.24.0, 24-Apr-2014)
>
> $ sudo blkid -o export /dev/sda2
> DEVNAME=/dev/sda2
> PTUUID=dd6e951b
> PTTYPE=dos
> PARTUUID=000ae69f-02
>
> $ sudo blkid /dev/sda2
> /dev/sda2: PTUUID="dd6e951b" PTTYPE="dos" PARTUUID="000ae69f-02"
>
>
> I'm attaching a patch that should hopefully help. It tries to make the
> executed codepath similar to what it was by adding an extra check on the
> case where value of TYPE is "" and then exits 0 if it looks like an
> extended dos partition.
>
> Any feedback would be greatly appreciated.
>
> Regards,
> Andreas Henriksson
> diff --git a/common.sh b/common.sh
> index 30e245e..8734b62 100644
> --- a/common.sh
> +++ b/common.sh
> @@ -116,6 +116,29 @@ fs_type () {
> fi
> }
>
> +is_dos_extended_partition() {
> + if type blkid >/dev/null 2>&1; then
> + local output
> +
> + output="$(blkid -o export $1)"
> +
> + # old blkid (util-linux << 2.24) errors out on extended p.
> + if [ "$?" = "2" ]; then
> + return 0
> + fi
> +
> + # dos partition type and no filesystem type?...
> + if echo $output | grep -q ' PTTYPE=dos ' &&
> + ! echo $output | grep -q ' TYPE='; then
> + return 0
> + else
> + return 1
> + fi
> + fi
> +
> + return 1
> +}
> +
> parse_proc_mounts () {
> while read -r line; do
> set -f
> diff --git a/linux-boot-probes/common/50mounted-tests b/linux-boot-probes/common/50mounted-tests
> index 41e26e6..91b6dd9 100755
> --- a/linux-boot-probes/common/50mounted-tests
> +++ b/linux-boot-probes/common/50mounted-tests
> @@ -20,6 +20,10 @@ elif [ "$types" = ntfs ]; then
> types='ntfs-3g ntfs'
> fi
> elif [ -z "$types" ]; then
> + if is_dos_extended_partition "$partition"; then
> + debug "$1 looks like an extended dos partition; skipping"
> + exit 0
> + fi
> if type cryptsetup >/dev/null 2>&1 && \
> cryptsetup luksDump "$partition" >/dev/null 2>&1; then
> debug "$1 is a LUKS partition; skipping"
Reply to: