BUG OF THE MONTH | A typo
V501 There are identical sub-expressions ‘cmdline_state != GRUB_PARSER_STATE_QUOTE’ to the left and to the right of the ‘&&’ operator. completion.c 502
typedef enum { GRUB_PARSER_STATE_TEXT = 1, GRUB_PARSER_STATE_ESC, GRUB_PARSER_STATE_QUOTE, GRUB_PARSER_STATE_DQUOTE, .... } grub_parser_state_t; char * grub_normal_do_completion (....) { .... if (*escstr == ' ' && cmdline_state != GRUB_PARSER_STATE_QUOTE && cmdline_state != GRUB_PARSER_STATE_QUOTE) *(newstr++) = '\\'; .... }
Typos in similarly looking names of constants are quite a common issue. In the example above, the programmer must have intended to compare the value of cmdline_state with the GRUB_PARSER_STATE_DQUOTE constant instead of comparing it with GRUB_PARSER_STATE_QUOTE one more time.
Please click here to see more bugs from this project.