help-grub
[Top][All Lists]
Advanced

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

Re: Negation in a condition triggers error message


From: Adam Vodopjan
Subject: Re: Negation in a condition triggers error message
Date: Fri, 16 Jun 2023 14:52:53 +0300
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.12.0

> It looks like the error is shown only when the whole condition is true,
assuming that the non-number argument is evaluated as 0.

Indeed, here is what I see in grub-core/commands/test.c

426 static grub_err_t
427 grub_cmd_test (grub_command_t cmd __attribute__ ((unused)),
428            int argc, char **args)
429 {
430   int argn = 0;
431
432   if (argc >= 1 && grub_strcmp (args[argc - 1], "]") == 0)
433     argc--;
434
435   return test_parse (args, &argn, argc) ? GRUB_ERR_NONE
436     : grub_error (GRUB_ERR_TEST_FAILURE, N_("false"));
437 }

It discards any error messages in case test_parse() returns true





reply via email to

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