Skip to content

Commit

Permalink
Fix bootchooser for the output of efibootmgr 18
Browse files Browse the repository at this point in the history
Since efibootmgr 18, the default output of `efibootmgr` is now more
verbose [1], which breaks the assumptions made by RAUC in regards to
parsing the output. This issue is also affecting others [2].

Fix the parsing logic by unconditionally splitting on a tab in the
detected name part of the boot entry, so that the unused data part can
be discarded.
Emit a debug message for each found boot entry, as this helps in
detecting issues in the future.

[1] rhboot/efibootmgr@8ec3e9d
[2] rhboot/efibootmgr#169

Signed-off-by: David Runge <[email protected]>
  • Loading branch information
dvzrv committed Jul 28, 2023
1 parent 720e400 commit 663017c
Showing 1 changed file with 16 additions and 1 deletion.
17 changes: 16 additions & 1 deletion src/bootchooser.c
Original file line number Diff line number Diff line change
Expand Up @@ -1159,11 +1159,26 @@ static gboolean efi_bootorder_get(GList **bootorder_entries, GList **all_entries
}

while (g_match_info_matches(match)) {
gchar **name_data_splits = NULL;
efi_bootentry *entry = g_new0(efi_bootentry, 1);

name_data_splits = g_strsplit(g_match_info_fetch(match, 2), "\t", 0);
if (g_strv_length (name_data_splits) == 0) {
g_set_error(
error,
R_BOOTCHOOSER_ERROR,
R_BOOTCHOOSER_ERROR_FAILED,
"Extracting a boot entry name failed!");
res = FALSE;
goto out;
}

entry->num = g_match_info_fetch(match, 1);
entry->name = g_match_info_fetch(match, 2);
entry->name = g_strdup(name_data_splits[0]);
entries = g_list_append(entries, entry);
g_match_info_next(match, NULL);
g_debug("Detected boot entry %s: %s", entry->num, entry->name);
g_strfreev(name_data_splits);
}

g_clear_pointer(&regex, g_regex_unref);
Expand Down

0 comments on commit 663017c

Please sign in to comment.