Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'jb48442' into 'master'
[glib2] detect removable storage properly. JB#48442 See merge request mer-core/glib2!10
- Loading branch information
Showing
4 changed files
with
55 additions
and
41 deletions.
There are no files selected for viewing
14 changes: 0 additions & 14 deletions
14
rpm/0001-Add-dev-mmcblk-to-the-list-of-devices-to-be-detected.patch
This file was deleted.
Oops, something went wrong.
53 changes: 53 additions & 0 deletions
53
rpm/0001-glib2-detect-removable-storage-properly.-JB-48442.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
From ace4b91d16db30d658756e3367674f206d21e10d Mon Sep 17 00:00:00 2001 | ||
From: Frajo Haider <f_haider@gmx.at> | ||
Date: Wed, 15 Jan 2020 15:06:05 +0000 | ||
Subject: [PATCH 1/1] [glib2] detect removable storage properly. JB#48442 | ||
|
||
This is needed for Tracker to detect removable storage properly. Upstream | ||
by default already moved to libmount, but that seems to have problems with | ||
Tracker. Enabling commit (496cd8aac6402) does state that it returns slightly | ||
different results, namely with bind mounts. | ||
|
||
Additionally to using mtab instead of fstab also check whether the mount | ||
is in /run/media/$USER, in order to detect user removable storage | ||
properly. | ||
--- | ||
gio/gunixmounts.c | 14 +++++++++++++- | ||
1 file changed, 13 insertions(+), 1 deletion(-) | ||
|
||
diff --git a/gio/gunixmounts.c b/gio/gunixmounts.c | ||
index 0035d57..9afe957 100644 | ||
--- a/gio/gunixmounts.c | ||
+++ b/gio/gunixmounts.c | ||
@@ -1048,8 +1048,11 @@ _g_get_unix_mount_points (void) | ||
char *read_file; | ||
GUnixMountPoint *mount_point; | ||
GList *return_list; | ||
+ const char *mount_path; | ||
+ const gchar *user_name; | ||
+ gsize user_name_len; | ||
|
||
- read_file = get_fstab_file (); | ||
+ read_file = get_mtab_read_file (); | ||
|
||
file = setmntent (read_file, "r"); | ||
if (file == NULL) | ||
@@ -1105,6 +1108,15 @@ _g_get_unix_mount_points (void) | ||
) | ||
is_user_mountable = TRUE; | ||
|
||
+ /* Check /run/media/$USER/ */ | ||
+ mount_path = mntent->mnt_dir; | ||
+ user_name = g_get_user_name (); | ||
+ user_name_len = strlen (user_name); | ||
+ if (strncmp (mount_path, "/run/media/", sizeof ("/run/media/") - 1) == 0 | ||
+ && strncmp (mount_path + sizeof ("/run/media/") - 1, user_name, user_name_len) == 0 | ||
+ && mount_path[sizeof ("/run/media/") - 1 + user_name_len] == '/') | ||
+ is_user_mountable = TRUE; | ||
+ | ||
mount_point = create_unix_mount_point (device_path, | ||
mntent->mnt_dir, | ||
mntent->mnt_type, | ||
-- | ||
1.8.3-rc3 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.