All of lore.kernel.org
 help / color / mirror / Atom feed
* submenu fails to see variables
@ 2021-09-06 10:46 Olaf Hering
  2021-09-06 13:39 ` Vladimir 'phcoder' Serbinenko
  0 siblings, 1 reply; 5+ messages in thread
From: Olaf Hering @ 2021-09-06 10:46 UTC (permalink / raw)
  To: grub-devel

[-- Attachment #1: Type: text/plain, Size: 325 bytes --]

For some reason global variables are not seen in a submenu {} section.
Does anyone happen to know why this behavior is useful?

Pseudocode:

set var=val
menuentry "me" {
 set
 echo "var ${var}"
 sleep 3
}

submenu "sm" {
 set
 echo "var ${var}"
 sleep 3
}

Seen with grub 2.02 and 2.04.


Thanks,
Olaf

[-- Attachment #2: Digitale Signatur von OpenPGP --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: submenu fails to see variables
  2021-09-06 10:46 submenu fails to see variables Olaf Hering
@ 2021-09-06 13:39 ` Vladimir 'phcoder' Serbinenko
  2021-09-07  9:30   ` Olaf Hering
  0 siblings, 1 reply; 5+ messages in thread
From: Vladimir 'phcoder' Serbinenko @ 2021-09-06 13:39 UTC (permalink / raw)
  To: The development of GNU GRUB

[-- Attachment #1: Type: text/plain, Size: 659 bytes --]

Le lun. 6 sept. 2021 à 12:49, Olaf Hering <olaf@aepfle.de> a écrit :

> For some reason global variables are not seen in a submenu {} section.
> Does anyone happen to know why this behavior is useful?
>
You need to export variable to make it visible in submenu

>
> Pseudocode:
>
> set var=val
> menuentry "me" {
>  set
>  echo "var ${var}"
>  sleep 3
> }
>
> submenu "sm" {
>  set
>  echo "var ${var}"
>  sleep 3
> }
>
> Seen with grub 2.02 and 2.04.
>
>
> Thanks,
> Olaf
> _______________________________________________
> Grub-devel mailing list
> Grub-devel@gnu.org
> https://lists.gnu.org/mailman/listinfo/grub-devel
>

[-- Attachment #2: Type: text/html, Size: 1398 bytes --]

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: submenu fails to see variables
  2021-09-06 13:39 ` Vladimir 'phcoder' Serbinenko
@ 2021-09-07  9:30   ` Olaf Hering
  2021-09-07 10:54     ` Dimitri John Ledkov
  0 siblings, 1 reply; 5+ messages in thread
From: Olaf Hering @ 2021-09-07  9:30 UTC (permalink / raw)
  To: Vladimir 'phcoder' Serbinenko; +Cc: The development of GNU GRUB

On Mon, Sep 06, Vladimir 'phcoder' Serbinenko wrote:

> Le lun. 6 sept. 2021 à 12:49, Olaf Hering <olaf@aepfle.de> a écrit :
>     For some reason global variables are not seen in a submenu {} section.
>     Does anyone happen to know why this behavior is useful?
> You need to export variable to make it visible in submenu

Thanks. This was less than obvious. I did not expect a command named 'export' in the context of grub.

The documentation needs to be updated to state what the difference between 'set key=val', 'export key=val' and plain 'key=val' actually is.

Olaf


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: submenu fails to see variables
  2021-09-07  9:30   ` Olaf Hering
@ 2021-09-07 10:54     ` Dimitri John Ledkov
  2021-09-08 19:24       ` Daniel Kiper
  0 siblings, 1 reply; 5+ messages in thread
From: Dimitri John Ledkov @ 2021-09-07 10:54 UTC (permalink / raw)
  To: The development of GNU GRUB

On Tue, Sep 7, 2021 at 10:30 AM Olaf Hering <olaf@aepfle.de> wrote:
>
> On Mon, Sep 06, Vladimir 'phcoder' Serbinenko wrote:
>
> > Le lun. 6 sept. 2021 à 12:49, Olaf Hering <olaf@aepfle.de> a écrit :
> >     For some reason global variables are not seen in a submenu {} section.
> >     Does anyone happen to know why this behavior is useful?
> > You need to export variable to make it visible in submenu
>
> Thanks. This was less than obvious. I did not expect a command named 'export' in the context of grub.
>
> The documentation needs to be updated to state what the difference between 'set key=val', 'export key=val' and plain 'key=val' actually is.

I have seen somewhere that some distros applied a patch to simply
export all variables always; or like not to create new contexts for
submenus, to keep the variable space the same.

Imho keeping variable space global, and exported by default seems to
lead to least surprises. But it is a behaviour change/break.


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: submenu fails to see variables
  2021-09-07 10:54     ` Dimitri John Ledkov
@ 2021-09-08 19:24       ` Daniel Kiper
  0 siblings, 0 replies; 5+ messages in thread
From: Daniel Kiper @ 2021-09-08 19:24 UTC (permalink / raw)
  To: Dimitri John Ledkov, olaf; +Cc: The development of GNU GRUB, phcoder

On Tue, Sep 07, 2021 at 11:54:13AM +0100, Dimitri John Ledkov wrote:
> On Tue, Sep 7, 2021 at 10:30 AM Olaf Hering <olaf@aepfle.de> wrote:
> >
> > On Mon, Sep 06, Vladimir 'phcoder' Serbinenko wrote:
> >
> > > Le lun. 6 sept. 2021 à 12:49, Olaf Hering <olaf@aepfle.de> a écrit :
> > >     For some reason global variables are not seen in a submenu {} section.
> > >     Does anyone happen to know why this behavior is useful?
> > > You need to export variable to make it visible in submenu
> >
> > Thanks. This was less than obvious. I did not expect a command named 'export' in the context of grub.
> >
> > The documentation needs to be updated to state what the difference between 'set key=val', 'export key=val' and plain 'key=val' actually is.
>
> I have seen somewhere that some distros applied a patch to simply
> export all variables always; or like not to create new contexts for
> submenus, to keep the variable space the same.
>
> Imho keeping variable space global, and exported by default seems to
> lead to least surprises. But it is a behaviour change/break.

I would prefer to keep behavior as is and document it.

Dimitri, Olaf, could one of you do it?

Daniel


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2021-09-08 19:25 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-09-06 10:46 submenu fails to see variables Olaf Hering
2021-09-06 13:39 ` Vladimir 'phcoder' Serbinenko
2021-09-07  9:30   ` Olaf Hering
2021-09-07 10:54     ` Dimitri John Ledkov
2021-09-08 19:24       ` Daniel Kiper

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.