Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F157811657
D56224.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
7 KB
Referenced Files
None
Subscribers
None
D56224.diff
View Options
diff --git a/filesystems/gvfs/Makefile b/filesystems/gvfs/Makefile
--- a/filesystems/gvfs/Makefile
+++ b/filesystems/gvfs/Makefile
@@ -1,5 +1,6 @@
PORTNAME= gvfs
DISTVERSION= 1.58.4
+PORTREVISION= 1
CATEGORIES= filesystems devel gnome
MASTER_SITES= GNOME
DIST_SUBDIR= gnome
@@ -19,8 +20,7 @@
libgudev-1.0.so:devel/libgudev \
libudisks2.so:sysutils/libudisks \
libsecret-1.so:security/libsecret
-RUN_DEPENDS= bsdisks>0:sysutils/bsdisks \
- lsof:sysutils/lsof
+RUN_DEPENDS= bsdisks>0:sysutils/bsdisks
USES= cpe gettext-tools gnome libarchive localbase meson \
pkgconfig python:build tar:xz
@@ -36,12 +36,13 @@
PORTSCOUT= limitw:1,even
-OPTIONS_DEFINE= AFC AVAHI BLURAY CDDA FUSE GOA GOOGLE GPHOTO MTP NFS ONEDRIVE SMB
-OPTIONS_DEFAULT= AVAHI BLURAY CDDA GPHOTO MTP NFS SMB
+OPTIONS_DEFINE= AFC AVAHI BLURAY CDDA FUSE FUSER GOA GOOGLE GPHOTO MTP NFS ONEDRIVE SMB
+OPTIONS_DEFAULT= AVAHI BLURAY CDDA FUSER GPHOTO MTP NFS SMB
OPTIONS_SUB= yes
AFC_DESC= Apple device support
BLURAY_DESC= Blu-ray metadata support
+FUSER_DESC= Use fuser(1) instead of lsof(1) external dependency
GOA_DESC= GNOME Online Accounts volume monitor support
GOOGLE_DESC= Google backend
ONEDRIVE_DESC= OneDrive backend
@@ -64,6 +65,9 @@
FUSE_USES= fuse:3
FUSE_MESON_TRUE= fuse
+FUSER_MESON_TRUE= use_fuser
+FUSER_RUN_DEPENDS_OFF= lsof:sysutils/lsof
+
GOA_LIB_DEPENDS= libgoa-1.0.so:net/gnome-online-accounts
GOA_MESON_TRUE= goa
diff --git a/filesystems/gvfs/files/patch-use_fuser b/filesystems/gvfs/files/patch-use_fuser
new file mode 100644
--- /dev/null
+++ b/filesystems/gvfs/files/patch-use_fuser
@@ -0,0 +1,168 @@
+From 117f90f834eed84af6f93f1c91add245fd0bf0bf Mon Sep 17 00:00:00 2001
+From: Guido Falsi <mad@madpilot.net>
+Date: Tue, 31 Mar 2026 18:20:01 +0200
+Subject: [PATCH] Add option to use fuser(1) in place of lsof(1)
+
+---
+ meson.build | 5 +++
+ meson_options.txt | 1 +
+ monitor/udisks2/gvfsudisks2mount.c | 58 +++++++++++++++++++++++++++---
+ 3 files changed, 60 insertions(+), 4 deletions(-)
+
+diff --git a/meson.build b/meson.build
+index 369e55f1..aea92ad9 100644
+--- meson.build
++++ meson.build
+@@ -343,6 +343,10 @@ if enable_udisks2
+ udisks2_dep = dependency('udisks2', version: '>= 1.97')
+ endif
+
++# *** Check if fuser(1) should be used in place of lsof(1) ***
++enable_use_fuser = get_option('use_fuser')
++config_h.set('USE_FUSER', enable_use_fuser)
++
+ # *** Check for libsystemd-login ***
+ enable_logind = get_option('logind')
+ if enable_logind
+@@ -543,6 +547,7 @@ summary({
+ }, section: 'Dependencies')
+
+ summary({
++ 'use_fuser': enable_use_fuser,
+ 'deprecated_apis': enable_deprecated_apis,
+ 'devel_utils': enable_devel_utils,
+ 'installed_tests': enable_installed_tests,
+diff --git a/meson_options.txt b/meson_options.txt
+index 16de561a..2f78bda6 100644
+--- meson_options.txt
++++ meson_options.txt
+@@ -30,6 +30,7 @@ option('keyring', type: 'boolean', value: true, description: 'build with keyring
+ option('logind', type: 'boolean', value: true, description: 'build with logind support')
+ option('libusb', type: 'boolean', value: true, description: 'build with libusb interruption support')
+
++option('use_fuser', type: 'boolean', value: false, description: 'Use fuser(1) instad of lsof(1) to check processes using files')
+ option('deprecated_apis', type: 'boolean', value: false, description: 'install deprecated api headers')
+ option('devel_utils', type: 'boolean', value: false, description: 'build with development utility programs')
+ option('installed_tests', type: 'boolean', value: false, description: 'enable installed unit tests')
+diff --git a/monitor/udisks2/gvfsudisks2mount.c b/monitor/udisks2/gvfsudisks2mount.c
+index 14e0717e..977bd2d4 100644
+--- monitor/udisks2/gvfsudisks2mount.c
++++ monitor/udisks2/gvfsudisks2mount.c
+@@ -661,10 +661,17 @@ on_mount_op_reply (GMountOperation *mount_operation,
+ mount_op_reply_handle (task);
+ }
+
++#ifdef USE_FUSER
++static void
++fuser_command_cb (GObject *source_object,
++ GAsyncResult *res,
++ gpointer user_data)
++#else
+ static void
+ lsof_command_cb (GObject *source_object,
+ GAsyncResult *res,
+ gpointer user_data)
++#endif
+ {
+ GTask *task = G_TASK (user_data);
+ UnmountData *data = g_task_get_task_data (task);
+@@ -685,19 +692,48 @@ lsof_command_cb (GObject *source_object,
+ NULL, /* gchar **out_standard_error */
+ &error))
+ {
++#ifdef USE_FUSER
++ g_printerr ("Error launching fuser(1): %s (%s, %d)\n",
++ error->message, g_quark_to_string (error->domain), error->code);
++#else
+ g_printerr ("Error launching lsof(1): %s (%s, %d)\n",
+- error->message, g_quark_to_string (error->domain), error->code);
++ error->message, g_quark_to_string (error->domain), error->code);
++#endif
+ g_error_free (error);
+ goto out;
+ }
+
+ if (!(WIFEXITED (exit_status) && WEXITSTATUS (exit_status) == 0))
+ {
++#ifdef USE_FUSER
++ g_printerr ("fuser(1) did not exit normally\n");
++#else
+ g_printerr ("lsof(1) did not exit normally\n");
++#endif
+ goto out;
+ }
+
+ p = standard_output;
++#ifdef USE_FUSER
++ gchar **tokens, **tok;
++
++ tokens = g_strsplit_set(p, " \n", 0);
++
++ tok = tokens;
++ while (*tok)
++ {
++ if (strlen(*tok) > 0)
++ {
++ GPid pid = strtol (*tok, NULL, 10);
++
++ if (pid != 0)
++ g_array_append_val (processes, pid);
++ }
++ tok++;
++ }
++
++ g_strfreev (tokens);
++#else
+ while (TRUE)
+ {
+ GPid pid;
+@@ -714,6 +750,7 @@ lsof_command_cb (GObject *source_object,
+
+ p = endp;
+ }
++#endif
+
+ out:
+ if (!g_task_get_completed (task))
+@@ -725,9 +762,9 @@ lsof_command_cb (GObject *source_object,
+ is_stop = unmount_operation_is_stop (data->mount_operation);
+
+ /* We want to emit the 'show-processes' signal even if launching
+- * lsof(1) failed or if it didn't return any PIDs. This is because
+- * it won't show e.g. root-owned processes operating on files
+- * on the mount point.
++ * lsof(1) or fuser(1) failed or if it didn't return any PIDs. This
++ * is because it won't show e.g. root-owned processes operating on
++ * files on the mount point.
+ *
+ * (unfortunately there's no way to convey that it failed)
+ */
+@@ -791,12 +828,25 @@ unmount_show_busy (GTask *task,
+ }
+
+ escaped_mount_point = g_strescape (mount_point, NULL);
++#ifdef USE_FUSER
++ gvfs_udisks2_utils_spawn (10, /* timeout in seconds */
++ g_task_get_cancellable (task),
++ fuser_command_cb,
++ g_object_ref (task),
++#ifdef __FreeBSD__
++ "fuser -m \"%s\"",
++#else
++ "fuser \"%s\"",
++#endif
++ escaped_mount_point);
++#else
+ gvfs_udisks2_utils_spawn (10, /* timeout in seconds */
+ g_task_get_cancellable (task),
+ lsof_command_cb,
+ g_object_ref (task),
+ "lsof -t \"%s\"",
+ escaped_mount_point);
++#endif
+ g_free (escaped_mount_point);
+ }
+
+--
+GitLab
+
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Tue, May 26, 11:18 AM (11 h, 41 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
33529554
Default Alt Text
D56224.diff (7 KB)
Attached To
Mode
D56224: filesystems/gvfs: Add option to use fuser(1) in place of lsof(1)
Attached
Detach File
Event Timeline
Log In to Comment