all messages for Guix-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: ludo@gnu.org (Ludovic Courtès)
To: brendan.tildesley@openmailbox.org
Cc: help-guix@gnu.org
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	[thread overview]
Message-ID: <87k1yjn54m.fsf@gnu.org> (raw)
In-Reply-To: <20171120145020.787EA4E004E@mta-1.openmailbox.og> (brendan tildesley's message of "Mon, 20 Nov 2017 14:50:20 -0000")

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’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);
          continue;
        }

      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
point:

--8<---------------cut here---------------start------------->8---
gboolean
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 */ 
    "/bin",
    "/boot",
    "/compat/linux/proc",
    "/compat/linux/sys",
    "/dev",

[...]

    NULL
  };

  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[] = {
    "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[] = {
    "none",
    "sunrpc",
    "devpts",
    "nfsd",
    "/dev/loop",
    "/dev/vn",
    NULL
  };
  
  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
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’.

  parent reply	other threads:[~2017-11-21 13:17 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-11-20 14:50 File Managers shows many devices that are not drives, in i3 but not in GNOME brendan.tildesley
2017-11-20 16:04 ` ng0
2017-11-21 13:16 ` Ludovic Courtès [this message]
2017-12-23  0:14 ` Stefan Stefanović
  -- strict thread matches above, loose matches on Subject: below --
2017-11-21 11:46 brendan.tildesley

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87k1yjn54m.fsf@gnu.org \
    --to=ludo@gnu.org \
    --cc=brendan.tildesley@openmailbox.org \
    --cc=help-guix@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/guix.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.