Date: Wed, 01 Jul 2026 16:20:01 +0000 From: Guido Falsi <madpilot@FreeBSD.org> To: ports-committers@FreeBSD.org, dev-commits-ports-all@FreeBSD.org, dev-commits-ports-main@FreeBSD.org Subject: git: 90b054438b58 - main - filesystems/gvfs: Use fuser(1) in place of lsof(1) by default Message-ID: <6a453e31.18d03.4d26718e@gitrepo.freebsd.org>
index | next in thread | raw e-mail
The branch main has been updated by madpilot: URL: https://cgit.FreeBSD.org/ports/commit/?id=90b054438b588d1a25fc4da6d97ea9217f4f01d6 commit 90b054438b588d1a25fc4da6d97ea9217f4f01d6 Author: Guido Falsi <madpilot@FreeBSD.org> AuthorDate: 2026-07-01 16:17:51 +0000 Commit: Guido Falsi <madpilot@FreeBSD.org> CommitDate: 2026-07-01 16:19:55 +0000 filesystems/gvfs: Use fuser(1) in place of lsof(1) by default - Import patch accepted upstream to allow using fuser(1) to check for busy mountpoints [1] - Add option to allow choosing between fuser and lsof (fuser by default This removes an hard dependency on lsof for this very commonly used port. [1] https://gitlab.gnome.org/GNOME/gvfs/-/merge_requests/321 Reviewed by: gnome (fluffy) Approved by: gnome (fluffy) Differential Revision: https://reviews.freebsd.org/D56224 --- filesystems/gvfs/Makefile | 15 +++- filesystems/gvfs/files/patch-use_fuser | 128 +++++++++++++++++++++++++++++++++ 2 files changed, 140 insertions(+), 3 deletions(-) diff --git a/filesystems/gvfs/Makefile b/filesystems/gvfs/Makefile index c3be1e721d7a..02f2c86c9ab3 100644 --- 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 @@ LIB_DEPENDS= libgcrypt.so:security/libgcrypt \ 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 @@ MESON_ARGS= -Dsystemduserunitdir=no \ 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 @@ CDDA_MESON_TRUE= cdda 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 @@ GOOGLE_MESON_TRUE= google 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 index 000000000000..a00ba0e9265c --- /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); + }home | help
Want to link to this message? Use this
URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?6a453e31.18d03.4d26718e>
