[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: File Managers shows many devices that are not drives, in i3 but not

From: Ludovic Courtès
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
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/25.3 (gnu/linux)


address@hidden 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’s weird indeed.  Nautilus intends to display mount points (this is
from nautilusgtkplacesview.c):

--8<---------------cut here---------------start------------->8---
static void
update_places (NautilusGtkPlacesView *view)


  /* Add currently connected drives */
  drives = 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 = g_volume_monitor_get_volumes (priv->volume_monitor);

  for (l = volumes; l != NULL; l = l->next)


   * Now that all necessary drives and volumes were already added, add mounts
   * that have no volume, such as /etc/mtab mounts, ftp, sftp, etc.
  mounts = g_volume_monitor_get_mounts (priv->volume_monitor);

  for (l = mounts; l != NULL; l = l->next)
      GMount *mount;
      GVolume *volume;

      mount = l->data;
      volume = g_mount_get_volume (mount);

      if (volume)
          g_object_unref (volume);

      add_mount (view, mount);

  /* load saved servers */
  populate_servers (view);


--8<---------------cut here---------------end--------------->8---

However, ‘g_mount_get_volume’ is expected to return NULL for “system
mounts”.  GLib’s gunixmounts.c attempts to determine whether a mount
point is a system mount by checking its file system type and mount

--8<---------------cut here---------------start------------->8---
g_unix_is_mount_path_system_internal (const char *mount_path)
  const char *ignore_mountpoints[] = {
    /* 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 */ 



  if (is_in (mount_path, ignore_mountpoints))
    return TRUE;
  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[] = {
  const char *ignore_devices[] = {
  if (is_in (fs, ignore_fs))
    return TRUE;
  if (is_in (device, ignore_devices))
    return TRUE;

  if (g_unix_is_mount_path_system_internal (mountpoint))
    return TRUE;
  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’ll have to attach gdb to nautilus to understand what’s 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’ve noticed that “touching” the device node (as
in “cat /dev/sr0 > /dev/null”) triggers the auto-mount and UI

Does anyone know the big picture better?

> My OS config is here:
> It occurs when my config is launched in a VM too so it isn't caused by my 
> config files in HOME.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]