Skip to content

Commit e8c9c3d

Browse files
committed
New upstream version 1.14.3
2 parents 68f4d8d + ccafd8c commit e8c9c3d

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

46 files changed

+5820
-3721
lines changed

NEWS

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,30 @@
1+
Changes in 1.14.3
2+
~~~~~~~~~~~~~~~~~
3+
Released: 2023-02-27
4+
5+
Bug fixes:
6+
7+
* When splitting an upgrade into two steps (download without installing, and
8+
then upgrade without allowing further downloads) like GNOME Software does,
9+
if an app is marked EOL and superseded by a replacement, don't remove the
10+
superseded app in the first step, which would result in the replacement
11+
incorrectly not being installed (#5172)
12+
* Fix a crash when --socket=gpg-agent is used (#5095)
13+
* Fix a crash when listing apps if one of them is broken or misconfigured
14+
(#5293)
15+
* If an app has invalid syntax in its overrides or metadata, mention the
16+
filename in the error message (#5293)
17+
* Unset $GDK_BACKEND for apps, ensuring GTK apps with --socket=fallback-x11
18+
can work (#5303)
19+
* Never try to export a parent of reserved directories as a --filesystem,
20+
for example /run, which would prevent the app from starting (#5205, #5207)
21+
* Never try to export a --filesystem below /run/flatpak or /run/host,
22+
which could similarly prevent the app from starting
23+
* The above change also fixes apps not starting if a --filesystem is a
24+
symlink to the root directory (#1357)
25+
* Show a warning when the --filesystem exists but cannot be shared with
26+
the sandbox (#1357, #5035, #5205, #5207)
27+
128
Changes in 1.14.2
229
~~~~~~~~~~~~~~~~~
330
Released: 2023-02-06

app/flatpak-builtins-list.c

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -154,6 +154,7 @@ print_table_for_refs (gboolean print_apps,
154154
const char *repo = NULL;
155155
g_autoptr(FlatpakDeploy) deploy = NULL;
156156
g_autoptr(GBytes) deploy_data = NULL;
157+
g_autoptr(GError) local_error = NULL;
157158
const char *active;
158159
const char *alt_id;
159160
const char *eol;
@@ -171,10 +172,25 @@ print_table_for_refs (gboolean print_apps,
171172
if (arch != NULL && !flatpak_decomposed_is_arch (ref, arch))
172173
continue;
173174

174-
deploy = flatpak_dir_load_deployed (dir, ref, NULL, cancellable, NULL);
175-
deploy_data = flatpak_deploy_get_deploy_data (deploy, FLATPAK_DEPLOY_VERSION_CURRENT, cancellable, NULL);
175+
deploy = flatpak_dir_load_deployed (dir, ref, NULL, cancellable, &local_error);
176+
177+
if (deploy == NULL)
178+
{
179+
g_warning (_("Unable to load details of %s: %s"),
180+
partial_ref, local_error->message);
181+
g_clear_error (&local_error);
182+
continue;
183+
}
184+
185+
deploy_data = flatpak_deploy_get_deploy_data (deploy, FLATPAK_DEPLOY_VERSION_CURRENT, cancellable, &local_error);
186+
176187
if (deploy_data == NULL)
177-
continue;
188+
{
189+
g_warning (_("Unable to inspect current version of %s: %s"),
190+
partial_ref, local_error->message);
191+
g_clear_error (&local_error);
192+
continue;
193+
}
178194

179195
runtime = flatpak_deploy_data_get_runtime (deploy_data);
180196

common/flatpak-context.c

Lines changed: 149 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -2435,10 +2435,65 @@ flatpak_context_make_sandboxed (FlatpakContext *context)
24352435
}
24362436

24372437
const char *dont_mount_in_root[] = {
2438-
".", "..", "lib", "lib32", "lib64", "bin", "sbin", "usr", "boot", "efi",
2439-
"root", "tmp", "etc", "app", "run", "proc", "sys", "dev", "var", NULL
2438+
".",
2439+
"..",
2440+
"app",
2441+
"bin",
2442+
"boot",
2443+
"dev",
2444+
"efi",
2445+
"etc",
2446+
"lib",
2447+
"lib32",
2448+
"lib64",
2449+
"proc",
2450+
"root",
2451+
"run",
2452+
"sbin",
2453+
"sys",
2454+
"tmp",
2455+
"usr",
2456+
"var",
2457+
NULL
24402458
};
24412459

2460+
static void
2461+
log_cannot_export_error (FlatpakFilesystemMode mode,
2462+
const char *path,
2463+
const GError *error)
2464+
{
2465+
GLogLevelFlags level = G_LOG_LEVEL_MESSAGE;
2466+
2467+
/* By default we don't show a log message if the reason we are not sharing
2468+
* something with the sandbox is simply "it doesn't exist" (or something
2469+
* very close): otherwise it would be very noisy to launch apps that
2470+
* opportunistically share things they might benefit from, like Steam
2471+
* having access to $XDG_RUNTIME_DIR/app/com.discordapp.Discord if it
2472+
* happens to exist. */
2473+
if (g_error_matches (error, G_IO_ERROR, G_IO_ERROR_NOT_FOUND))
2474+
level = G_LOG_LEVEL_INFO;
2475+
/* Some callers specifically suppress warnings for particular errors
2476+
* by setting this code. */
2477+
else if (g_error_matches (error, G_IO_ERROR, G_IO_ERROR_FAILED_HANDLED))
2478+
level = G_LOG_LEVEL_INFO;
2479+
2480+
switch (mode)
2481+
{
2482+
case FLATPAK_FILESYSTEM_MODE_NONE:
2483+
g_log (G_LOG_DOMAIN, level, _("Not replacing \"%s\" with tmpfs: %s"),
2484+
path, error->message);
2485+
break;
2486+
2487+
case FLATPAK_FILESYSTEM_MODE_CREATE:
2488+
case FLATPAK_FILESYSTEM_MODE_READ_ONLY:
2489+
case FLATPAK_FILESYSTEM_MODE_READ_WRITE:
2490+
g_log (G_LOG_DOMAIN, level,
2491+
_("Not sharing \"%s\" with sandbox: %s"),
2492+
path, error->message);
2493+
break;
2494+
}
2495+
}
2496+
24422497
static void
24432498
flatpak_context_export (FlatpakContext *context,
24442499
FlatpakExports *exports,
@@ -2453,6 +2508,7 @@ flatpak_context_export (FlatpakContext *context,
24532508
FlatpakFilesystemMode fs_mode, os_mode, etc_mode, home_mode;
24542509
GHashTableIter iter;
24552510
gpointer key, value;
2511+
g_autoptr(GError) local_error = NULL;
24562512

24572513
if (xdg_dirs_conf_out != NULL)
24582514
xdg_dirs_conf = g_string_new ("");
@@ -2478,11 +2534,30 @@ flatpak_context_export (FlatpakContext *context,
24782534
continue;
24792535

24802536
path = g_build_filename ("/", dirent->d_name, NULL);
2481-
flatpak_exports_add_path_expose (exports, fs_mode, path);
2537+
2538+
if (!flatpak_exports_add_path_expose (exports, fs_mode, path, &local_error))
2539+
{
2540+
/* Failure to share something like /lib32 because it's
2541+
* actually a symlink to /usr/lib32 is less of a problem
2542+
* here than it would be for an explicit
2543+
* --filesystem=/lib32, so the warning that would normally
2544+
* be produced in that situation is downgraded to a
2545+
* debug message. */
2546+
if (g_error_matches (local_error, G_IO_ERROR, G_IO_ERROR_NOT_MOUNTABLE_FILE))
2547+
local_error->code = G_IO_ERROR_FAILED_HANDLED;
2548+
2549+
log_cannot_export_error (fs_mode, path, local_error);
2550+
g_clear_error (&local_error);
2551+
}
24822552
}
24832553
closedir (dir);
24842554
}
2485-
flatpak_exports_add_path_expose (exports, fs_mode, "/run/media");
2555+
2556+
if (!flatpak_exports_add_path_expose (exports, fs_mode, "/run/media", &local_error))
2557+
{
2558+
log_cannot_export_error (fs_mode, "/run/media", local_error);
2559+
g_clear_error (&local_error);
2560+
}
24862561
}
24872562

24882563
os_mode = MAX (GPOINTER_TO_INT (g_hash_table_lookup (context->filesystems, "host-os")),
@@ -2503,7 +2578,16 @@ flatpak_context_export (FlatpakContext *context,
25032578
g_debug ("Allowing homedir access");
25042579
home_access = TRUE;
25052580

2506-
flatpak_exports_add_path_expose (exports, MAX (home_mode, fs_mode), g_get_home_dir ());
2581+
if (!flatpak_exports_add_path_expose (exports, MAX (home_mode, fs_mode), g_get_home_dir (), &local_error))
2582+
{
2583+
/* Even if the error is one that we would normally silence, like
2584+
* the path not existing, it seems reasonable to make more of a fuss
2585+
* about the home directory not existing or otherwise being unusable,
2586+
* so this is intentionally not using cannot_export() */
2587+
g_warning (_("Not allowing home directory access: %s"),
2588+
local_error->message);
2589+
g_clear_error (&local_error);
2590+
}
25072591
}
25082592

25092593
g_hash_table_iter_init (&iter, context->filesystems);
@@ -2553,7 +2637,11 @@ flatpak_context_export (FlatpakContext *context,
25532637
g_string_append_printf (xdg_dirs_conf, "%s=\"%s\"\n",
25542638
config_key, path);
25552639

2556-
flatpak_exports_add_path_expose_or_hide (exports, mode, subpath);
2640+
if (!flatpak_exports_add_path_expose_or_hide (exports, mode, subpath, &local_error))
2641+
{
2642+
log_cannot_export_error (mode, subpath, local_error);
2643+
g_clear_error (&local_error);
2644+
}
25572645
}
25582646
}
25592647
else if (g_str_has_prefix (filesystem, "~/"))
@@ -2568,8 +2656,11 @@ flatpak_context_export (FlatpakContext *context,
25682656
g_debug ("Unable to create directory %s", path);
25692657
}
25702658

2571-
if (g_file_test (path, G_FILE_TEST_EXISTS))
2572-
flatpak_exports_add_path_expose_or_hide (exports, mode, path);
2659+
if (!flatpak_exports_add_path_expose_or_hide (exports, mode, path, &local_error))
2660+
{
2661+
log_cannot_export_error (mode, path, local_error);
2662+
g_clear_error (&local_error);
2663+
}
25732664
}
25742665
else if (g_str_has_prefix (filesystem, "/"))
25752666
{
@@ -2579,8 +2670,11 @@ flatpak_context_export (FlatpakContext *context,
25792670
g_debug ("Unable to create directory %s", filesystem);
25802671
}
25812672

2582-
if (g_file_test (filesystem, G_FILE_TEST_EXISTS))
2583-
flatpak_exports_add_path_expose_or_hide (exports, mode, filesystem);
2673+
if (!flatpak_exports_add_path_expose_or_hide (exports, mode, filesystem, &local_error))
2674+
{
2675+
log_cannot_export_error (mode, filesystem, local_error);
2676+
g_clear_error (&local_error);
2677+
}
25842678
}
25852679
else
25862680
{
@@ -2593,18 +2687,42 @@ flatpak_context_export (FlatpakContext *context,
25932687
g_autoptr(GFile) apps_dir = g_file_get_parent (app_id_dir);
25942688
int i;
25952689
/* Hide the .var/app dir by default (unless explicitly made visible) */
2596-
flatpak_exports_add_path_tmpfs (exports, flatpak_file_get_path_cached (apps_dir));
2690+
if (!flatpak_exports_add_path_tmpfs (exports,
2691+
flatpak_file_get_path_cached (apps_dir),
2692+
&local_error))
2693+
{
2694+
log_cannot_export_error (FLATPAK_FILESYSTEM_MODE_NONE,
2695+
flatpak_file_get_path_cached (apps_dir),
2696+
local_error);
2697+
g_clear_error (&local_error);
2698+
}
2699+
25972700
/* But let the app write to the per-app dir in it */
2598-
flatpak_exports_add_path_expose (exports, FLATPAK_FILESYSTEM_MODE_READ_WRITE,
2599-
flatpak_file_get_path_cached (app_id_dir));
2701+
if (!flatpak_exports_add_path_expose (exports, FLATPAK_FILESYSTEM_MODE_READ_WRITE,
2702+
flatpak_file_get_path_cached (app_id_dir),
2703+
&local_error))
2704+
{
2705+
log_cannot_export_error (FLATPAK_FILESYSTEM_MODE_READ_WRITE,
2706+
flatpak_file_get_path_cached (apps_dir),
2707+
local_error);
2708+
g_clear_error (&local_error);
2709+
}
26002710

26012711
if (extra_app_id_dirs != NULL)
26022712
{
26032713
for (i = 0; i < extra_app_id_dirs->len; i++)
26042714
{
26052715
GFile *extra_app_id_dir = g_ptr_array_index (extra_app_id_dirs, i);
2606-
flatpak_exports_add_path_expose (exports, FLATPAK_FILESYSTEM_MODE_READ_WRITE,
2607-
flatpak_file_get_path_cached (extra_app_id_dir));
2716+
if (!flatpak_exports_add_path_expose (exports,
2717+
FLATPAK_FILESYSTEM_MODE_READ_WRITE,
2718+
flatpak_file_get_path_cached (extra_app_id_dir),
2719+
&local_error))
2720+
{
2721+
log_cannot_export_error (FLATPAK_FILESYSTEM_MODE_READ_WRITE,
2722+
flatpak_file_get_path_cached (extra_app_id_dir),
2723+
local_error);
2724+
g_clear_error (&local_error);
2725+
}
26082726
}
26092727
}
26102728
}
@@ -2668,13 +2786,27 @@ flatpak_context_get_exports_full (FlatpakContext *context,
26682786
if (include_default_dirs)
26692787
{
26702788
g_autoptr(GFile) user_flatpak_dir = NULL;
2789+
g_autoptr(GError) local_error = NULL;
26712790

26722791
/* Hide the flatpak dir by default (unless explicitly made visible) */
26732792
user_flatpak_dir = flatpak_get_user_base_dir_location ();
2674-
flatpak_exports_add_path_tmpfs (exports, flatpak_file_get_path_cached (user_flatpak_dir));
2793+
if (!flatpak_exports_add_path_tmpfs (exports,
2794+
flatpak_file_get_path_cached (user_flatpak_dir),
2795+
&local_error))
2796+
{
2797+
log_cannot_export_error (FLATPAK_FILESYSTEM_MODE_NONE,
2798+
flatpak_file_get_path_cached (user_flatpak_dir),
2799+
local_error);
2800+
g_clear_error (&local_error);
2801+
}
26752802

26762803
/* Ensure we always have a homedir */
2677-
flatpak_exports_add_path_dir (exports, g_get_home_dir ());
2804+
if (!flatpak_exports_add_path_dir (exports, g_get_home_dir (), &local_error))
2805+
{
2806+
g_warning (_("Unable to provide a temporary home directory in the sandbox: %s"),
2807+
local_error->message);
2808+
g_clear_error (&local_error);
2809+
}
26782810
}
26792811

26802812
return g_steal_pointer (&exports);

common/flatpak-dir-private.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -562,6 +562,7 @@ FlatpakDeploy * flatpak_dir_load_deployed (Fla
562562
char * flatpak_dir_load_override (FlatpakDir *dir,
563563
const char *app_id,
564564
gsize *length,
565+
GFile **file_out,
565566
GError **error);
566567
OstreeRepo * flatpak_dir_get_repo (FlatpakDir *self);
567568
gboolean flatpak_dir_ensure_path (FlatpakDir *self,

common/flatpak-dir.c

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2799,6 +2799,7 @@ char *
27992799
flatpak_dir_load_override (FlatpakDir *self,
28002800
const char *app_id,
28012801
gsize *length,
2802+
GFile **file_out,
28022803
GError **error)
28032804
{
28042805
g_autoptr(GFile) override_dir = NULL;
@@ -2820,6 +2821,9 @@ flatpak_dir_load_override (FlatpakDir *self,
28202821
return NULL;
28212822
}
28222823

2824+
if (file_out != NULL)
2825+
*file_out = g_object_ref (file);
2826+
28232827
return metadata_contents;
28242828
}
28252829

@@ -2828,20 +2832,21 @@ flatpak_load_override_keyfile (const char *app_id, gboolean user, GError **error
28282832
{
28292833
g_autofree char *metadata_contents = NULL;
28302834
gsize metadata_size;
2835+
g_autoptr(GFile) file = NULL;
28312836
g_autoptr(GKeyFile) metakey = g_key_file_new ();
28322837
g_autoptr(FlatpakDir) dir = NULL;
28332838

28342839
dir = user ? flatpak_dir_get_user () : flatpak_dir_get_system_default ();
28352840

2836-
metadata_contents = flatpak_dir_load_override (dir, app_id, &metadata_size, error);
2841+
metadata_contents = flatpak_dir_load_override (dir, app_id, &metadata_size, &file, error);
28372842
if (metadata_contents == NULL)
28382843
return NULL;
28392844

28402845
if (!g_key_file_load_from_data (metakey,
28412846
metadata_contents,
28422847
metadata_size,
28432848
0, error))
2844-
return NULL;
2849+
return glnx_prefix_error_null (error, "%s", flatpak_file_get_path_cached (file));
28452850

28462851
return g_steal_pointer (&metakey);
28472852
}
@@ -2978,7 +2983,7 @@ flatpak_dir_load_deployed (FlatpakDir *self,
29782983

29792984
metakey = g_key_file_new ();
29802985
if (!g_key_file_load_from_data (metakey, metadata_contents, metadata_size, 0, error))
2981-
return NULL;
2986+
return glnx_prefix_error_null (error, "%s", flatpak_file_get_path_cached (metadata));
29822987

29832988
deploy = flatpak_deploy_new (deploy_dir, ref, metakey, self->repo);
29842989

@@ -3628,7 +3633,7 @@ upgrade_deploy_data (GBytes *deploy_data,
36283633
&metadata_contents, &metadata_size, NULL, error))
36293634
return NULL;
36303635
if (!g_key_file_load_from_data (keyfile, metadata_contents, metadata_size, 0, error))
3631-
return NULL;
3636+
return glnx_prefix_error_null (error, "%s", flatpak_file_get_path_cached (metadata_file));
36323637
add_metadata_to_deploy_data (&metadata_dict, keyfile);
36333638

36343639
/* Add fields from appdata to deploy, since appdata-content-rating wasn't

0 commit comments

Comments
 (0)