From e907d810e4b478528c651a6ebb0b0e7d3ea3fe09 Mon Sep 17 00:00:00 2001 From: Ondrej Holy Date: Tue, 3 Mar 2026 13:04:50 +0100 Subject: [PATCH] Do not count children for autofs mountpoints Resolves: RHEL-137198 --- ...ount-children-for-autofs-mountpoints.patch | 114 ++++++++++++++++++ nautilus.spec | 9 +- 2 files changed, 122 insertions(+), 1 deletion(-) create mode 100644 file-Do-not-count-children-for-autofs-mountpoints.patch diff --git a/file-Do-not-count-children-for-autofs-mountpoints.patch b/file-Do-not-count-children-for-autofs-mountpoints.patch new file mode 100644 index 0000000..2f31ce3 --- /dev/null +++ b/file-Do-not-count-children-for-autofs-mountpoints.patch @@ -0,0 +1,114 @@ +From 6eebbd90af4214dcb8848019caa35d0ee5e44274 Mon Sep 17 00:00:00 2001 +From: Ondrej Holy +Date: Tue, 20 Jan 2026 09:02:50 +0100 +Subject: [PATCH] file: Do not count children for autofs mountpoints + +Backport of the upstream commit 4eff235e2bc433519fecbaf136ab95b00a60b1c2. +--- + src/nautilus-file-utilities.c | 39 +++++++++++++++++++++++++++++++++++ + src/nautilus-file-utilities.h | 2 ++ + src/nautilus-file.c | 11 ++++++++++ + 3 files changed, 52 insertions(+) + +diff --git a/src/nautilus-file-utilities.c b/src/nautilus-file-utilities.c +index bab77c7f2..443d6faf9 100644 +--- a/src/nautilus-file-utilities.c ++++ b/src/nautilus-file-utilities.c +@@ -35,12 +35,14 @@ + #include + #include + #include ++#include + #include + #include + #include + #include + #include + #include ++#include + + #define NAUTILUS_USER_DIRECTORY_NAME "nautilus" + #define DEFAULT_NAUTILUS_DIRECTORY_MODE (0755) +@@ -289,6 +291,11 @@ error: + return FALSE; + } + ++/* From linux/magic.h */ ++#ifndef AUTOFS_SUPER_MAGIC ++#define AUTOFS_SUPER_MAGIC 0x0187 ++#endif ++ + char * + nautilus_compute_title_for_location (GFile *location) + { +@@ -1485,3 +1492,35 @@ location_settings_search_get_recursive_for_location (GFile *location) + + return recursive; + } ++ ++/* Checks if the location is an autofs mountpoint without triggering mount.*/ ++gboolean ++nautilus_location_is_autofs_mountpoint (GFile *location) ++{ ++ g_return_val_if_fail (G_IS_FILE (location), FALSE); ++ ++ g_autofree char *path = g_file_get_path (location); ++ struct statfs buf; ++ gint fd; ++ ++ if (path == NULL) ++ { ++ return FALSE; ++ } ++ ++ fd = g_open (path, O_PATH | O_NOFOLLOW, 0); ++ if (fd < 0) ++ { ++ return FALSE; ++ } ++ ++ if (fstatfs (fd, &buf) < 0) ++ { ++ close (fd); ++ return FALSE; ++ } ++ ++ close (fd); ++ ++ return (buf.f_type == AUTOFS_SUPER_MAGIC); ++} +diff --git a/src/nautilus-file-utilities.h b/src/nautilus-file-utilities.h +index 67df0e4d9..a0050dbbe 100644 +--- a/src/nautilus-file-utilities.h ++++ b/src/nautilus-file-utilities.h +@@ -141,3 +141,5 @@ gchar * nautilus_uri_to_native_uri (const gchar *uri); + + NautilusQueryRecursive location_settings_search_get_recursive (void); + NautilusQueryRecursive location_settings_search_get_recursive_for_location (GFile *location); ++ ++gboolean nautilus_location_is_autofs_mountpoint (GFile *location); +diff --git a/src/nautilus-file.c b/src/nautilus-file.c +index 280bbb9e3..55fbad922 100644 +--- a/src/nautilus-file.c ++++ b/src/nautilus-file.c +@@ -5687,6 +5687,17 @@ nautilus_file_should_show_directory_item_count (NautilusFile *file) + return FALSE; + } + ++ /* Don't count items in autofs directories to avoid triggering automount. */ ++ if (file->details->is_mountpoint) ++ { ++ g_autoptr (GFile) location = nautilus_file_get_location (file); ++ ++ if (nautilus_location_is_autofs_mountpoint (location)) ++ { ++ return FALSE; ++ } ++ } ++ + /* Add the callback once for the life of our process */ + if (!show_directory_item_count_callback_added) + { +-- +2.53.0 + diff --git a/nautilus.spec b/nautilus.spec index 9978145..702a902 100644 --- a/nautilus.spec +++ b/nautilus.spec @@ -6,7 +6,7 @@ Name: nautilus Version: 40.2 -Release: 15%{?dist} +Release: 16%{?dist} Summary: File manager for GNOME License: GPLv3+ @@ -54,6 +54,9 @@ Patch: window-slot-dnd-Stop-queueing-data-requests.patch Patch: window-slot-dnd-Fix-data-retrieval-failure-path.patch Patch: window-slot-dnd-Ignore-data-not-received-on-hover.patch +# https://gitlab.gnome.org/GNOME/nautilus/-/merge_requests/1928 +Patch: file-Do-not-count-children-for-autofs-mountpoints.patch + BuildRequires: desktop-file-utils BuildRequires: gcc BuildRequires: gettext @@ -184,6 +187,10 @@ desktop-file-validate $RPM_BUILD_ROOT%{_datadir}/applications/*.desktop %doc %{_datadir}/gtk-doc/html/libnautilus-extension/ %changelog +* Tue Mar 03 2026 Ondrej Holy - 40.2-16 +- Do not count children for autofs mountpoints + Resolves: RHEL-137198 + * Wed Oct 18 2023 Ondrej Holy - 40.2-15 - Fix crashes when dragging from another application (RHEL-12820)