From mboxrd@z Thu Jan 1 00:00:00 1970 From: ludo@gnu.org (Ludovic =?utf-8?Q?Court=C3=A8s?=) Subject: Re: File Managers shows many devices that are not drives, in i3 but not in GNOME Date: Tue, 21 Nov 2017 14:16:57 +0100 Message-ID: <87k1yjn54m.fsf@gnu.org> References: <20171120145020.787EA4E004E@mta-1.openmailbox.og> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:51724) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eH8QF-0008Jc-6g for help-guix@gnu.org; Tue, 21 Nov 2017 08:17:08 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eH8QA-0003Ba-HK for help-guix@gnu.org; Tue, 21 Nov 2017 08:17:07 -0500 Received: from hera.aquilenet.fr ([2a01:474::1]:43616) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1eH8QA-0003AD-4s for help-guix@gnu.org; Tue, 21 Nov 2017 08:17:02 -0500 In-Reply-To: <20171120145020.787EA4E004E@mta-1.openmailbox.og> (brendan tildesley's message of "Mon, 20 Nov 2017 14:50:20 -0000") List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-guix-bounces+gcggh-help-guix=m.gmane.org@gnu.org Sender: "Help-Guix" To: brendan.tildesley@openmailbox.org Cc: help-guix@gnu.org Hi, brendan.tildesley@openmailbox.org skribis: > In i3-wm my pcmanfm and nautilus, and probably other file systems display= all these devices like: > > pts > shm > store > systemd > user > cgroup > blkio > ... > > which browse to /dev/pts, /dev/sdm, /gnu/store, ... when clicked on. > > These things shouldn't appear at all That=E2=80=99s weird indeed. Nautilus intends to display mount points (thi= s is from nautilusgtkplacesview.c): --8<---------------cut here---------------start------------->8--- static void update_places (NautilusGtkPlacesView *view) { [...] /* Add currently connected drives */ drives =3D g_volume_monitor_get_connected_drives (priv->volume_monitor); [...] /* * Since all volumes with an associated GDrive were already added with * add_drive before, add all volumes that aren't associated with a * drive. */ volumes =3D g_volume_monitor_get_volumes (priv->volume_monitor); for (l =3D volumes; l !=3D NULL; l =3D l->next) [...] /* * Now that all necessary drives and volumes were already added, add moun= ts * that have no volume, such as /etc/mtab mounts, ftp, sftp, etc. */ mounts =3D g_volume_monitor_get_mounts (priv->volume_monitor); for (l =3D mounts; l !=3D NULL; l =3D l->next) { GMount *mount; GVolume *volume; mount =3D l->data; volume =3D g_mount_get_volume (mount); if (volume) { g_object_unref (volume); continue; } add_mount (view, mount); } /* load saved servers */ populate_servers (view); [...] } --8<---------------cut here---------------end--------------->8--- However, =E2=80=98g_mount_get_volume=E2=80=99 is expected to return NULL fo= r =E2=80=9Csystem mounts=E2=80=9D. GLib=E2=80=99s gunixmounts.c attempts to determine whethe= r a mount point is a system mount by checking its file system type and mount point: --8<---------------cut here---------------start------------->8--- gboolean g_unix_is_mount_path_system_internal (const char *mount_path) { const char *ignore_mountpoints[] =3D { /* Includes all FHS 2.3 toplevel dirs and other specialized * directories that we want to hide from the user. */ "/", /* we already have "Filesystem root" in Nautilus */=20 "/bin", "/boot", "/compat/linux/proc", "/compat/linux/sys", "/dev", [...] NULL }; if (is_in (mount_path, ignore_mountpoints)) return TRUE; =20=20 if (g_str_has_prefix (mount_path, "/dev/") || g_str_has_prefix (mount_path, "/proc/") || g_str_has_prefix (mount_path, "/sys/")) return TRUE; if (g_str_has_suffix (mount_path, "/.gvfs")) return TRUE; return FALSE; } static gboolean guess_system_internal (const char *mountpoint, const char *fs, const char *device) { const char *ignore_fs[] =3D { "auto", "autofs", "devfs", "devpts", "ecryptfs", "fdescfs", "kernfs", "linprocfs", "mfs", "nullfs", "proc", "procfs", "ptyfs", "rootfs", "selinuxfs", "sysfs", "tmpfs", "usbfs", "nfsd", "rpc_pipefs", "zfs", NULL }; const char *ignore_devices[] =3D { "none", "sunrpc", "devpts", "nfsd", "/dev/loop", "/dev/vn", NULL }; =20=20 if (is_in (fs, ignore_fs)) return TRUE; =20=20 if (is_in (device, ignore_devices)) return TRUE; if (g_unix_is_mount_path_system_internal (mountpoint)) return TRUE; =20=20 return FALSE; } --8<---------------cut here---------------end--------------->8--- This rule should let /gnu/store through, but it should clearly exclude /proc, /sys, /run/systemd (tmpfs), etc. I think we=E2=80=99ll have to attach gdb to nautilus to understand what=E2= =80=99s going on. > , additionally, my usb drives and extra hard drive are not automounted > or recognised in pcmanfm/nautilus. I don't know how to begin debugging > this so I'm wondering if anyone else understands what's going on. Regarding auto-mount, I=E2=80=99ve noticed that =E2=80=9Ctouching=E2=80=9D = the device node (as in =E2=80=9Ccat /dev/sr0 > /dev/null=E2=80=9D) triggers the auto-mount and = UI notification. Does anyone know the big picture better? > My OS config is here: https://paste.debian.net/996688/ > It occurs when my config is launched in a VM too so it isn't caused by my= config files in HOME. Thanks, Ludo=E2=80=99.