Skip to content
Snippets Groups Projects
Commit 44d0c3e8 authored by Simon McVittie's avatar Simon McVittie
Browse files

Merge branch 'wip/denittis/t25216' into 'master'

steam: Diagnose STEAM_COMPAT_CLIENT_INSTALL_PATH mismatch

Closes #41

See merge request !190
parents c1c2511c 614b38fa
No related branches found
No related tags found
1 merge request!190steam: Diagnose STEAM_COMPAT_CLIENT_INSTALL_PATH mismatch
Pipeline #5815 passed
......@@ -391,6 +391,7 @@ _srt_steam_check (const GStrv my_environ,
const char *commandline = NULL;
const char *executable = NULL;
const char *app_id = NULL;
const char *steam_compat_client_install_path = NULL;
gboolean in_flatpak = FALSE;
GStrv env = NULL;
GError *error = NULL;
......@@ -693,6 +694,24 @@ _srt_steam_check (const GStrv my_environ,
}
}
steam_compat_client_install_path = g_environ_getenv (env, "STEAM_COMPAT_CLIENT_INSTALL_PATH");
/* Is not an issue if STEAM_COMPAT_CLIENT_INSTALL_PATH is missing */
if (steam_compat_client_install_path != NULL)
{
/* We expect STEAM_COMPAT_CLIENT_INSTALL_PATH to be equivalent to
* "~/.steam/root" */
g_autofree gchar *steam_compat_resolved = realpath (steam_compat_client_install_path, NULL);
g_autofree gchar *dot_steam_root_resolved = realpath (dot_steam_root, NULL);
if (g_strcmp0 (steam_compat_resolved, dot_steam_root_resolved) != 0)
{
g_debug ("\"STEAM_COMPAT_CLIENT_INSTALL_PATH\" points to \"%s\", "
"that is different from the expected \"%s\" pointed by "
"\"~/.steam/root\"", steam_compat_resolved,
dot_steam_root_resolved);
issues |= SRT_STEAM_ISSUES_UNEXPECTED_STEAM_COMPAT_CLIENT_INSTALL_PATH;
}
}
steam_script_version = g_environ_getenv (env, "STEAMSCRIPT_VERSION");
if (more_details_out != NULL)
......
......@@ -88,6 +88,9 @@ GType srt_steam_get_type (void);
* one `STEAMSCRIPT` points to.
* @SRT_STEAM_ISSUES_UNEXPECTED_STEAM_DESKTOP_ID: The default Steam desktop
* application ID is not what we expected.
* @SRT_STEAM_ISSUES_UNEXPECTED_STEAM_COMPAT_CLIENT_INSTALL_PATH: If the
* environment `STEAM_COMPAT_CLIENT_INSTALL_PATH` is set, its realpath() is
* not the equivalent of `~/.steam/root`.
* @SRT_STEAM_ISSUES_UNKNOWN: The Steam problems are not known
*
* A bitfield with flags representing problems with the Steam
......@@ -109,6 +112,7 @@ typedef enum
SRT_STEAM_ISSUES_MISSING_STEAM_URI_HANDLER = (1 << 8),
SRT_STEAM_ISSUES_UNEXPECTED_STEAM_URI_HANDLER = (1 << 9),
SRT_STEAM_ISSUES_UNEXPECTED_STEAM_DESKTOP_ID = (1 << 10),
SRT_STEAM_ISSUES_UNEXPECTED_STEAM_COMPAT_CLIENT_INSTALL_PATH = (1 << 11),
SRT_STEAM_ISSUES_NONE = 0
} SrtSteamIssues;
......
......@@ -1214,6 +1214,57 @@ steam_symlink (Fixture *f,
g_free (ubuntu12_32);
}
static void
steam_compat_environment_variable (Fixture *f,
gconstpointer context)
{
g_autoptr(SrtSystemInfo) info = NULL;
SrtSteamIssues issues;
g_autofree gchar *dot_steam_root = NULL;
g_autofree gchar *dot_steam_root_resolved = NULL;
g_autofree gchar *dot_steam_bin32 = NULL;
FakeHome *fake_home;
fake_home = fake_home_new (fake_home_path);
fake_home_create_structure (fake_home);
info = srt_system_info_new (NULL);
dot_steam_root = g_build_filename (fake_home->home, ".steam", "root", NULL);
dot_steam_bin32 = g_build_filename (fake_home->home, ".steam", "bin32", NULL);
fake_home->env = g_environ_unsetenv (fake_home->env,
"STEAM_COMPAT_CLIENT_INSTALL_PATH");
fake_home_apply_to_system_info (fake_home, info);
issues = srt_system_info_get_steam_issues (info);
g_assert_cmpint (issues, ==, SRT_STEAM_ISSUES_NONE);
fake_home->env = g_environ_setenv (fake_home->env,
"STEAM_COMPAT_CLIENT_INSTALL_PATH",
dot_steam_root, TRUE);
fake_home_apply_to_system_info (fake_home, info);
issues = srt_system_info_get_steam_issues (info);
g_assert_cmpint (issues, ==, SRT_STEAM_ISSUES_NONE);
dot_steam_root_resolved = realpath (dot_steam_root, NULL);
fake_home->env = g_environ_setenv (fake_home->env,
"STEAM_COMPAT_CLIENT_INSTALL_PATH",
dot_steam_root_resolved, TRUE);
fake_home_apply_to_system_info (fake_home, info);
issues = srt_system_info_get_steam_issues (info);
g_assert_cmpint (issues, ==, SRT_STEAM_ISSUES_NONE);
/* Set STEAM_COMPAT_CLIENT_INSTALL_PATH to an unexpected value */
fake_home->env = g_environ_setenv (fake_home->env,
"STEAM_COMPAT_CLIENT_INSTALL_PATH",
dot_steam_bin32, TRUE);
fake_home_apply_to_system_info (fake_home, info);
issues = srt_system_info_get_steam_issues (info);
g_assert_cmpint (issues, ==,
SRT_STEAM_ISSUES_UNEXPECTED_STEAM_COMPAT_CLIENT_INSTALL_PATH);
fake_home_clean_up (fake_home);
}
/* Recreate the conditions that triggered the Debian bug 916303.
* Steam was installed into "~/.steam", which meant that the "steam/"
* directory inside the Steam installation collided with the "~/.steam/steam"
......@@ -3707,6 +3758,8 @@ main (int argc,
setup, runtime_unexpected_location, teardown);
g_test_add ("/system-info/steam_symlink", Fixture, NULL,
setup, steam_symlink, teardown);
g_test_add ("/system-info/steam_compat_environment_variable", Fixture, NULL,
setup, steam_compat_environment_variable, teardown);
g_test_add ("/system-info/debian_bug_916303", Fixture, NULL,
setup, debian_bug_916303, teardown);
g_test_add ("/system-info/testing_beta_client", Fixture, NULL,
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment