diff --git a/filesystems/gvfs/Makefile b/filesystems/gvfs/Makefile index c3be1e721d7a..02f2c86c9ab3 100644 --- a/filesystems/gvfs/Makefile +++ b/filesystems/gvfs/Makefile @@ -1,96 +1,105 @@ PORTNAME= gvfs DISTVERSION= 1.58.4 +PORTREVISION= 1 CATEGORIES= filesystems devel gnome MASTER_SITES= GNOME DIST_SUBDIR= gnome MAINTAINER= gnome@FreeBSD.org COMMENT= GNOME virtual file system WWW= https://gitlab.gnome.org/GNOME/gvfs LICENSE= LGPL20+ LICENSE_FILE= ${WRKSRC}/COPYING BUILD_DEPENDS= docbook-xsl>=0:textproc/docbook-xsl LIB_DEPENDS= libgcrypt.so:security/libgcrypt \ libdbus-1.so:devel/dbus \ libgcr-4.so:security/gcr \ libsoup-3.0.so:devel/libsoup3 \ 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 CPE_VENDOR= gnome USE_GNOME= glib20 libxml2 libxslt:build GLIB_SCHEMAS= org.gnome.system.gvfs.enums.xml MESON_ARGS= -Dsystemduserunitdir=no \ -Dtmpfilesdir=no \ -Dadmin=false \ -Dlogind=false \ -Dlibusb=false \ -Dman=true 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 AFC_LIB_DEPENDS= libimobiledevice-1.0.so:comms/libimobiledevice \ libplist-2.0.so:devel/libplist AFC_MESON_TRUE= afc AVAHI_LIB_DEPENDS= libavahi-client.so:net/avahi-app AVAHI_MESON_TRUE= dnssd AVAHI_VARS= GLIB_SCHEMAS+=org.gnome.system.dns_sd.gschema.xml BLURAY_LIB_DEPENDS= libbluray.so:multimedia/libbluray BLURAY_MESON_TRUE= bluray CDDA_LIB_DEPENDS= libcdio_paranoia.so:sysutils/libcdio-paranoia \ libcdio.so:sysutils/libcdio 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 GOOGLE_IMPLIES= GOA GOOGLE_LIB_DEPENDS= libgdata.so:devel/libgdata 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 NFS_LIB_DEPENDS= libnfs.so:net/libnfs NFS_MESON_TRUE= nfs .if !exists(/usr/bin/ssh) BUILD_DEPENDS+= ${LOCALBASE}/bin/ssh:security/openssh-portable RUN_DEPENDS+= ${LOCALBASE}/bin/ssh:security/openssh-portable .endif ONEDRIVE_IMPLIES= GOA ONEDRIVE_LIB_DEPENDS= libmsgraph-1.so:net/msgraph ONEDRIVE_MESON_TRUE= onedrive SMB_USES= samba:lib SMB_MESON_TRUE= smb SMB_VARS= GLIB_SCHEMAS+=org.gnome.system.smb.gschema.xml .include 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); + }