Skip to content

Commit

Permalink
Merge branch 'jb48442' into 'master'
Browse files Browse the repository at this point in the history
[glib2] detect removable storage properly. JB#48442

See merge request mer-core/glib2!10
  • Loading branch information
Matti Kosola committed Jan 16, 2020
2 parents 8aa7e2a + 09e1964 commit 2db1d5a
Show file tree
Hide file tree
Showing 4 changed files with 55 additions and 41 deletions.

This file was deleted.

53 changes: 53 additions & 0 deletions rpm/0001-glib2-detect-removable-storage-properly.-JB-48442.patch
@@ -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

6 changes: 2 additions & 4 deletions rpm/glib2.spec
Expand Up @@ -12,9 +12,8 @@ Source0: %{name}-%{version}.tar.xz
Source2: glib2.sh
Source3: glib2.csh
Source4: %{name}-rpmlintrc
Patch1: 0001-Add-dev-mmcblk-to-the-list-of-devices-to-be-detected.patch
Patch1: 0001-glib2-detect-removable-storage-properly.-JB-48442.patch
Patch2: glib-replace-some-criticals-with-warnings.patch
Patch3: use-mtab-instead-of-fstab.patch
Requires(post): /sbin/ldconfig
Requires(postun): /sbin/ldconfig
BuildRequires: pkgconfig(libpcre)
Expand Down Expand Up @@ -60,11 +59,10 @@ version 2 of the GLib library.
%prep
%setup -q -n %{name}-%{version}/upstream

# 0001-Add-dev-mmcblk-to-the-list-of-devices-to-be-detected.patch
# 0001-glib2-paths-in-run-media-frajo-are-generally-user-mo.patch
%patch1 -p1
# glib-replace-some-criticals-with-warnings.patch
%patch2 -p1
%patch3 -p1

%build
#
Expand Down
23 changes: 0 additions & 23 deletions rpm/use-mtab-instead-of-fstab.patch

This file was deleted.

0 comments on commit 2db1d5a

Please sign in to comment.