templates/linux_xen: fix detecting xsm policy
PATCH 1/1 templates/linux_xen: fix detecting xsm policy
xsmpolicy variable was left set from previous function call. This resulted in all-but-first menu entries including XSM policy, even if it did not exist.
Fix this by initializing the xenpolicy variable.
--- util/grub.d/20_linux_xen.in | 1 + 1 file changed, 1 insertion(+)
util/grub.d/20_linux_xen.in +1 -0
@@ -105,6 +105,7 @@ linux_entry_xsm () xsm="$7" # If user wants to enable XSM support, make sure there's # corresponding policy file. + xenpolicy= if ${xsm} ; then xenpolicy="xenpolicy-$xen_version" if test ! -e "${xen_dirname}/${xenpolicy}" ; then
Signature · 1 line
2.37.3
Quoted 16 lines · Marek Marczykowski-Górecki
xsmpolicy variable was left set from previous function call. This resulted in all-but-first menu entries including XSM policy, even if it did not exist.
Fix this by initializing the xenpolicy variable.
Signed-off-by Marek Marczykowski-Górecki <[email protected]>--- util/grub.d/20_linux_xen.in | 1 + 1 file changed, 1 insertion(+)util/grub.d/20_linux_xen.in +0
-0
util/grub.d/20_linux_xen.in linux_entry_xsm () · line 108
Quoted 4 lines
util/grub.d/20_linux_xen.in +1
-0@@ -105,6 +105,7 @@ linux_entry_xsm () xsm="$7" # If user wants to enable XSM support, make sure there's # corresponding policy file. + xenpolicy=
Would not it be better to make this variable local? Or even better all variables (and arguments) which are used in this function only?
Daniel
Quoted 12 lines · Daniel Kiper
Quoted 11 lines · Marek Marczykowski-Górecki
xsmpolicy variable was left set from previous function call. This resulted in all-but-first menu entries including XSM policy, even if it did not exist.
Fix this by initializing the xenpolicy variable.
Signed-off-by Marek Marczykowski-Górecki <[email protected]>--- util/grub.d/20_linux_xen.in | 1 + 1 file changed, 1 insertion(+)
Quoted 12 lines
util/grub.d/20_linux_xen.in linux_entry_xsm () · line 108
Quoted 9 lines
util/grub.d/20_linux_xen.in +1
-0@@ -105,6 +105,7 @@ linux_entry_xsm () xsm="$7" # If user wants to enable XSM support, make sure there's # corresponding policy file. + xenpolicy=Would not it be better to make this variable local? Or even better all variables (and arguments) which are used in this function only?
I considered that, but the script has #!/bin/sh, not #!/bin/bash. Isn't local a bash-specific feature?
Signature · 3 lines
Best Regards, Marek Marczykowski-Górecki Invisible Things Lab
Quoted 26 lines · Marek Marczykowski-Górecki
Quoted 12 lines · Daniel Kiper
Quoted 11 lines · Marek Marczykowski-Górecki
xsmpolicy variable was left set from previous function call. This resulted in all-but-first menu entries including XSM policy, even if it did not exist.
Fix this by initializing the xenpolicy variable.
Signed-off-by Marek Marczykowski-Górecki <[email protected]>--- util/grub.d/20_linux_xen.in | 1 + 1 file changed, 1 insertion(+)Quoted 12 lines
util/grub.d/20_linux_xen.in linux_entry_xsm () · line 108
Quoted 9 lines
util/grub.d/20_linux_xen.in +1
-0@@ -105,6 +105,7 @@ linux_entry_xsm () xsm="$7" # If user wants to enable XSM support, make sure there's # corresponding policy file. + xenpolicy=Would not it be better to make this variable local? Or even better all variables (and arguments) which are used in this function only?
Quoted 2 lines
I considered that, but the script has #!/bin/sh, not #!/bin/bash. Isn't local a bash-specific feature?
Sadly you are right... :-( So, Reviewed-by: Daniel Kiper <[email protected]>...
Daniel