grub-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: grub shell: unkown commands alwasy exit with zero code


From: Michael Chang
Subject: Re: grub shell: unkown commands alwasy exit with zero code
Date: Tue, 16 Jan 2024 16:32:45 +0800

On Fri, Jan 12, 2024 at 05:58:02PM +0100, Itxaka serrano wrote:
> Hey all,
> 
> I opened a bug because this behaviour doesnt seem correct to me:
> 
> https://savannah.gnu.org/bugs/?65154
> 
> 
> Example:
> 
> grub> hello
> error: ../../grub-core/script/function.c:119:can't find command `hello'.
> grub> echo $?
> 0
> 
> 
> Kind of weird because on the code it seems like its returning a
> GRUB_ERR_UNKNOWN_COMMAND which should not be zero. I had a quick look and
> maybe its becuase on line 1018 of grub-core/script/execute.c we print the
> error but always return 0
> https://git.savannah.gnu.org/cgit/grub.git/tree/grub-core/script/execute.c#n1018
> 
> Is this expected behaviour or is it a mistake and we should not only print
> the error but return the actual error?

The behavior is expected: 

https://git.savannah.gnu.org/cgit/grub.git/commit/?id=bc028f2f86.

Given the limited context, it remains unclear if the rationale behind
this change can be easily retraced today.

My take is that this modification may have been implemented to support
the continued functionality of older `grub.cfg` files, even after
certain commands have been removed. This ensures compatibility with the
latest version of GRUB. Alternatively, it seems reasonable to halt
execution when encountering a missing command, considering the potential
consequence of such situations.

Thanks,
Michael

> 
> Cheers,
> Itxaka

> _______________________________________________
> Grub-devel mailing list
> Grub-devel@gnu.org
> https://lists.gnu.org/mailman/listinfo/grub-devel




reply via email to

[Prev in Thread] Current Thread [Next in Thread]