Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 28 additions & 3 deletions libdnf/dnf-context.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1825,9 +1825,34 @@ dnf_context_set_os_release(DnfContext *context, GError **error) try
"os-release",
"VERSION_ID",
error);
if (maybe_quoted_version == NULL)
return FALSE;
version = g_shell_unquote(maybe_quoted_version, error);
if (maybe_quoted_version == NULL) {
/* rolling releases like Arch or Debian Unstable have no VERSION_ID */
g_clear_error(error);
g_autofree gchar *maybe_quoted_id = NULL;
maybe_quoted_id = g_key_file_get_string(key_file,
"os-release",
"ID",
error);
if (!maybe_quoted_id)
Comment thread
dcantrell marked this conversation as resolved.
return FALSE;

g_autofree gchar *id = g_shell_unquote(maybe_quoted_id, error);
if (!id)
return FALSE;
if (g_ascii_strncasecmp(id, "debian", strlen("debian")) != 0 &&
Comment thread
bluca marked this conversation as resolved.
g_ascii_strncasecmp(id, "arch", strlen("arch")) != 0) {
g_set_error(error, DNF_ERROR, DNF_ERROR_FAILED,
"'VERSION_ID' not found in os-release and source root "
"'%s' is not a known rolling release (debian or arch)",
source_root);
return FALSE;
Comment thread
bluca marked this conversation as resolved.
}

/* Fake a high version number */
version = g_strdup("9999");
} else {
version = g_shell_unquote(maybe_quoted_version, error);
Comment thread
dcantrell marked this conversation as resolved.
}
if (!version)
return FALSE;
dnf_context_set_release_ver(context, version);
Expand Down