Skip to contentSkip to conversation

os-prober: Fix translating device to mach format

PATCH In review Samuel Thibault 2 participants 5 messages Mar 14, 2018 – Apr 16, 2018

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 os-prober: Fix translating device to mach format

grub-probe --device /dev/sda --target=drive

would currently print on Linux x86 "hostdisk//dev/sda,msdos1", i.e. not something we can translate easily. We can instead use compatibility_hint which have more well-defined format (hd0,1)

---
new in v2: Fix typo and be more verbose in changelog

---
 util/grub.d/30_os-prober.in | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
util/grub.d/30_os-prober.in +2 -2
index 515a68c7a..38444fe65 100644
@@ -297,8 +297,8 @@ menuentry '$(echo "${LONGNAME} $onstr" | grub_quote)' --class hurd --class gnu -
 EOF
       save_default_entry | grub_add_tab
       prepare_grub_to_access_device ${DEVICE} | grub_add_tab
-      grub_device="`${grub_probe} --device ${DEVICE} --target=drive`"
-      mach_device="`echo "${grub_device}" | sed -e 's/(\(hd.*\),msdos\(.*\))/\1s\2/'`"
+      grub_device="`${grub_probe} --device ${DEVICE} --target=compatibility_hint`"
+      mach_device="`echo "${grub_device}" | sed -e 's/\(hd.*\),msdos\(.*\)/\1s\2/'`"
       grub_fs="`${grub_probe} --device ${DEVICE} --target=fs`"
       case "${grub_fs}" in
 	*fs)	hurd_fs="${grub_fs}" ;;
Signature · 1 line
2.16.1
#1 lore raw
Quoted 3 lines · Samuel Thibault

grub-probe --device /dev/sda --target=drive

would currently print on Linux x86 "hostdisk//dev/sda,msdos1", i.e. not

I have a feeling that grub-probe should be fixed instead of that. Probably it was broken at some point because e.g. Debian GRUB2 1.99-27+deb7u3 produces: (hd0) Hmmmm... Could you double check it?

Quoted 16 lines

something we can translate easily. We can instead use compatibility_hint which have more well-defined format (hd0,1)

---
new in v2: Fix typo and be more verbose in changelog

---
 util/grub.d/30_os-prober.in | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
util/grub.d/30_os-prober.in +0 -0
index 515a68c7a..38444fe65 100644

util/grub.d/30_os-prober.in menuentry '$(echo "${LONGNAME} $onstr" | grub_quote)' --class hurd --class gnu - · line 301

Quoted 7 lines
util/grub.d/30_os-prober.in +2 -2
@@ -297,8 +297,8 @@ menuentry '$(echo "${LONGNAME} $onstr" | grub_quote)' --class hurd --class gnu -
 EOF
       save_default_entry | grub_add_tab
       prepare_grub_to_access_device ${DEVICE} | grub_add_tab
-      grub_device="`${grub_probe} --device ${DEVICE} --target=drive`"
-      mach_device="`echo "${grub_device}" | sed -e 's/(\(hd.*\),msdos\(.*\))/\1s\2/'`"
+      grub_device="`${grub_probe} --device ${DEVICE} --target=compatibility_hint`"
+      mach_device="`echo "${grub_device}" | sed -e 's/\(hd.*\),msdos\(.*\)/\1s\2/'`"

Why do you drop parentheses here?

Daniel

#2 lore raw
Quoted 11 lines · Daniel Kiper, on jeu. 22 mars 2018 15:16:46 +0100, wrote:

util/grub.d/30_os-prober.in menuentry '$(echo "${LONGNAME} $onstr" | grub_quote)' --class hurd --class gnu - · line 301

Quoted 8 lines · Samuel Thibault
util/grub.d/30_os-prober.in +2 -2
@@ -297,8 +297,8 @@ menuentry '$(echo "${LONGNAME} $onstr" | grub_quote)' --class hurd --class gnu -
 EOF
       save_default_entry | grub_add_tab
       prepare_grub_to_access_device ${DEVICE} | grub_add_tab
-      grub_device="`${grub_probe} --device ${DEVICE} --target=drive`"
-      mach_device="`echo "${grub_device}" | sed -e 's/(\(hd.*\),msdos\(.*\))/\1s\2/'`"
+      grub_device="`${grub_probe} --device ${DEVICE} --target=compatibility_hint`"
+      mach_device="`echo "${grub_device}" | sed -e 's/\(hd.*\),msdos\(.*\)/\1s\2/'`"

Why do you drop parentheses here?

Well, because there are none in the compatibility_hint output :)

Samuel

#3 lore raw
Quoted 13 lines · Samuel Thibault
Quoted 11 lines · Daniel Kiper, on jeu. 22 mars 2018 15:16:46 +0100, wrote:

util/grub.d/30_os-prober.in menuentry '$(echo "${LONGNAME} $onstr" | grub_quote)' --class hurd --class gnu - · line 301

Quoted 8 lines · Samuel Thibault
util/grub.d/30_os-prober.in +2 -2
@@ -297,8 +297,8 @@ menuentry '$(echo "${LONGNAME} $onstr" | grub_quote)' --class hurd --class gnu -
 EOF
       save_default_entry | grub_add_tab
       prepare_grub_to_access_device ${DEVICE} | grub_add_tab
-      grub_device="`${grub_probe} --device ${DEVICE} --target=drive`"
-      mach_device="`echo "${grub_device}" | sed -e 's/(\(hd.*\),msdos\(.*\))/\1s\2/'`"
+      grub_device="`${grub_probe} --device ${DEVICE} --target=compatibility_hint`"
+      mach_device="`echo "${grub_device}" | sed -e 's/\(hd.*\),msdos\(.*\)/\1s\2/'`"

Why do you drop parentheses here?

Quoted 1 line

Well, because there are none in the compatibility_hint output :)

This is more or less what I expected. Anyway, please take a look at grub-probe and tell me is possible to fix there or not.

Daniel

#4 lore raw

Well, to be honest, I don't think I'll have the time to dive into grub-probe to see where the breakage comes from etc. so as far as I'm concerned, I'll just archive the discussion.

If people really want to see the Hurd work for them, they'll have to do a bit of the work. People can't just rely on my finding the time to do everything, that'll just not work.

Samuel