Page MenuHomeFreeBSD

D56224.diff
No OneTemporary

D56224.diff

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
@@ -37,11 +37,15 @@
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_RADIO= BUSYCOMMAND
+OPTIONS_RADIO_BUSYCOMMAND= FUSER LSOF
+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) to check processes blocking umount
+LSOF_DESC= Use lsof(1) to check processes blocking umount
GOA_DESC= GNOME Online Accounts volume monitor support
GOOGLE_DESC= Google backend
ONEDRIVE_DESC= OneDrive backend
@@ -64,6 +68,8 @@
FUSE_USES= fuse:3
FUSE_MESON_TRUE= fuse
+FUSER_MESON_ON= -Dbusy_processes_command=fuser
+
GOA_LIB_DEPENDS= libgoa-1.0.so:net/gnome-online-accounts
GOA_MESON_TRUE= goa
@@ -74,6 +80,9 @@
GPHOTO_LIB_DEPENDS= libgphoto2.so:graphics/libgphoto2
GPHOTO_MESON_TRUE= gphoto2
+LSOF_MESON_ON= -Dbusy_processes_command=lsof
+LSOF_RUN_DEPENDS= lsof:sysutils/lsof
+
MTP_LIB_DEPENDS= libmtp.so:multimedia/libmtp
MTP_MESON_TRUE= mtp
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,128 @@
+diff --git a/meson.build b/meson.build
+index 04214bff..352ac3b3 100644
+--- meson.build
++++ meson.build
+@@ -343,6 +343,15 @@ if enable_udisks2
+ udisks2_dep = dependency('udisks2', version: '>= 1.97')
+ endif
+
++# *** Check which command should be used to check processes blocking umount ***
++busy_processes_command = get_option('busy_processes_command')
++config_h.set_quoted('BUSY_PROCESS_COMMAND', busy_processes_command)
++if busy_processes_command == 'lsof'
++ config_h.set('BUSY_PROCESS_SPAWN', '"lsof -t \"%s\""')
++elif busy_processes_command == 'fuser'
++ config_h.set('BUSY_PROCESS_SPAWN', '"fuser -m \"%s\""')
++endif
++
+ # *** Check for libsystemd-login ***
+ enable_logind = get_option('logind')
+ if enable_logind
+@@ -500,6 +509,7 @@ gnome.post_install(
+ )
+
+ summary({
++ 'busy_processes_command': busy_processes_command,
+ 'systemduserunitdir': systemd_systemduserunitdir,
+ 'tmpfilesdir': systemd_tmpfilesdir,
+ 'privileged_group': privileged_group,
+diff --git a/meson_options.txt b/meson_options.txt
+index c68fcf3c..60ca4935 100644
+--- meson_options.txt
++++ meson_options.txt
+@@ -1,3 +1,4 @@
++option('busy_processes_command', type: 'combo', choices: ['lsof', 'fuser'], value: 'lsof', description: 'Command used to detect processes blocking unmount')
+ option('systemduserunitdir', type: 'string', value: '', description: 'custom directory for systemd user units, or \'no\' to disable')
+ option('tmpfilesdir', type: 'string', value: '', description: 'custom directory for tmpfiles.d config files, or \'no\' to disable')
+ option('privileged_group', type: 'string', value: 'wheel', description: 'custom name for group that has elevated permissions')
+diff --git a/monitor/udisks2/gvfsudisks2mount.c b/monitor/udisks2/gvfsudisks2mount.c
+index 466ecabc..f3781406 100644
+--- monitor/udisks2/gvfsudisks2mount.c
++++ monitor/udisks2/gvfsudisks2mount.c
+@@ -648,9 +648,9 @@ on_mount_op_reply (GMountOperation *mount_operation,
+ }
+
+ static void
+-lsof_command_cb (GObject *source_object,
+- GAsyncResult *res,
+- gpointer user_data)
++busy_processes_command_cb (GObject *source_object,
++ GAsyncResult *res,
++ gpointer user_data)
+ {
+ GTask *task = G_TASK (user_data);
+ UnmountData *data = g_task_get_task_data (task);
+@@ -671,15 +671,24 @@ lsof_command_cb (GObject *source_object,
+ NULL, /* gchar **out_standard_error */
+ &error))
+ {
+- g_printerr ("Error launching lsof(1): %s (%s, %d)\n",
+- error->message, g_quark_to_string (error->domain), error->code);
++ g_warning ("Error launching %s(1): %s (%s, %d)\n",
++ BUSY_PROCESS_COMMAND,
++ error->message,
++ g_quark_to_string (error->domain),
++ error->code);
+ g_error_free (error);
+ goto out;
+ }
+
+- if (!(WIFEXITED (exit_status) && WEXITSTATUS (exit_status) == 0))
++ if (!WIFEXITED (exit_status))
+ {
+- g_printerr ("lsof(1) did not exit normally\n");
++ g_warning ("%s(1) killed by signal %d\n", BUSY_PROCESS_COMMAND, WTERMSIG (exit_status));
++ goto out;
++ }
++ if (WEXITSTATUS (exit_status) != 0)
++ {
++ /* A non-zero exit is expected when no processes are using the mount */
++ g_debug ("%s(1) exited with status %d\n", BUSY_PROCESS_COMMAND, WEXITSTATUS (exit_status));
+ goto out;
+ }
+
+@@ -693,10 +702,16 @@ lsof_command_cb (GObject *source_object,
+ break;
+
+ pid = strtol (p, &endp, 10);
+- if (pid == 0 && p == endp)
+- break;
++ if (p == endp)
++ {
++ /* strtol made no progress: skip one non-numeric character so the
++ * loop doesn't stall and subsequent PIDs are not lost. */
++ p++;
++ continue;
++ }
+
+- g_array_append_val (processes, pid);
++ if (pid != 0)
++ g_array_append_val (processes, pid);
+
+ p = endp;
+ }
+@@ -711,9 +726,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)
+ */
+@@ -779,9 +794,9 @@ unmount_show_busy (GTask *task,
+ escaped_mount_point = g_strescape (mount_point, NULL);
+ gvfs_udisks2_utils_spawn (10, /* timeout in seconds */
+ g_task_get_cancellable (task),
+- lsof_command_cb,
++ busy_processes_command_cb,
+ g_object_ref (task),
+- "lsof -t \"%s\"",
++ BUSY_PROCESS_SPAWN,
+ escaped_mount_point);
+ g_free (escaped_mount_point);
+ }

File Metadata

Mime Type
text/plain
Expires
Sun, Jul 12, 8:42 AM (16 h, 7 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
34991451
Default Alt Text
D56224.diff (7 KB)

Event Timeline