Hi,

On Sat, Apr 11, 2026 at 12:20:45PM +0300, Timo Lindfors wrote:
> Hi,
> 
> it seems tboot (hg 728:54ea68a98aef) still depends on the function 
> 'version_find_latest' that is no longer included in grub (removed in git 
> commit a79c567f6b5820a8795c273a9eaabd06a1f92b29)

meanwhile we've been running into the same issue. To keep tboot on life
support until there is something available upstream I came up with a
drop-in replacement for the missing function. I'm sharing the patch
attached to this mail.

A proper fix is more tricky than it looks at first, since the tboot
script maintains a space-separated list of full file paths while the new
`version_sort` expects newline-separated list of RPM-like names. Thus I
decided to go for a drop-in replacement as a low-risk quick fix.

It would also be helpful for tboot to introduce some common shell
library to be used by both grub drop-in shell files, to avoid
redundancy.

Cheers

Matthias

-- 
Matthias Gerstner <[email protected]>
Security Engineer
https://www.suse.com/security
GPG Key ID: 0x14C405C971923553
 
SUSE Software Solutions Germany GmbH
HRB 36809, AG Nürnberg
Geschäftsführer: Jochen Jaser, Andrew McDonald, Werner Knoblich
--- tboot-1.11.12.orig/tboot/20_linux_tboot     2026-06-24 12:39:41.510323209 
+0200
+++ tboot-1.11.12/20_linux_tboot        2026-06-24 12:39:12.747557424 +0200
@@ -210,6 +210,20 @@
 fi
 prepare_boot_cache=
 
+# version_find_latest was dropped from the grub shell utility functions, we
+# now have to use version_sort(). It expects newline-separated basenames.
+version_find_latest()
+{
+       local list="$1"
+       # translate space separated list into newline separated list
+       list=`echo $list | tr ' ' '\n'`
+       # drop the /boot prefix
+       list=`echo $list | grep -o "[^/]\+$"`
+       list=`echo $list | version_sort`
+       latest=`echo $list | tail -n 1`
+       echo "/boot/${latest}"
+}
+
 while [ "x${tboot_list}" != "x" ] && [ "x$linux_list" != "x" ] ; do
     list="${linux_list}"
     current_tboot=`version_find_latest $tboot_list`
--- tboot-1.11.12.orig/tboot/20_linux_xen_tboot 2026-06-24 12:39:41.510551291 
+0200
+++ tboot-1.11.12/tboot/20_linux_xen_tboot      2026-06-24 12:39:12.747708992 
+0200
@@ -254,6 +254,20 @@
 fi
 prepare_boot_cache=
 
+# version_find_latest was dropped from the grub shell utility functions, we
+# now have to use version_sort(). It expects newline-separated basenames.
+version_find_latest()
+{
+       local list="$1"
+       # translate space separated list into newline separated list
+       list=`echo $list | tr ' ' '\n'`
+       # drop the /boot prefix
+       list=`echo $list | grep -o "[^/]\+$"`
+       list=`echo $list | version_sort`
+       latest=`echo $list | tail -n 1`
+       echo "/boot/${latest}"
+}
+
 while [ "x${xen_list}" != "x" ] ; do
     current_xen=`version_find_latest $xen_list`
     xen_basename=`basename ${current_xen}`

Attachment: signature.asc
Description: PGP signature

_______________________________________________
tboot-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/tboot-devel

Reply via email to