After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 730347 - Cleanup signalling of mounts and volumes (causes duplicate icons in file managers)
Cleanup signalling of mounts and volumes (causes duplicate icons in file mana...
Status: RESOLVED OBSOLETE
Product: gvfs
Classification: Core
Component: udisks2 volume monitor
1.20.x
Other Linux
: Normal normal
: ---
Assigned To: gvfs-maint
gvfs-maint
Depends on:
Blocks:
 
 
Reported: 2014-05-18 23:41 UTC by Alister
Modified: 2018-09-21 17:41 UTC
See Also:
GNOME target: ---
GNOME version: ---



Description Alister 2014-05-18 23:41:37 UTC
If I loop mount a filesystem image, it is listed twice in the "Places" side pane in both pcmanfm and thunar.
e.g. if I do `mount -o loop -t ext4 pup_save2.2fs /mnt/puppy` it shows up twice in pcmanfm as "134 MB Volume". It shows up once in thunar as "134 MB Volume", and once as "Puppy".
Similarly, if I insert an audio CD it shows up twice in PCmanfm as "Audio Disc", and in thunar once as "Audio Disc" under "Devices", and once as "/ on sr0" under "Network"!

Comments from one of the Pcmanfm developers:
https://sourceforge.net/p/pcmanfm/bugs/850/

> So it is another gvfs regression bug, that happens again and again, it appeared around 1.10 then fixed, then appeared again around 1.14, and it's here again now. :(

> I've traced down the issue - when signal "mount-added" is emitted by GVolumeMonitor, the g_mount_get_volume() for new GMount returns NULL, it's why it cannot be compared to GVolume which is already present in Places at that time. It is the same problem that was present back in GVFS 1.10.
Comment 1 Ross Lagerwall 2014-05-19 05:28:57 UTC
Doing the same thing here doesn't show any output in Nautilus which is as expected.  Mounts in /mnt aren't usually shown at all (https://git.gnome.org/browse/gvfs/tree/monitor/udisks2/what-is-shown.txt).

Do you have any special environment variables set like GIO_USE_VOLUME_MONITOR?

Try running gvfs-mount -io, mount the image and paste the output here.
Comment 2 Alister 2014-05-19 05:36:25 UTC
Yes, sorry, I forgot:
- /mnt is a symlink to /media
- things mount to /media because I use this rule:

sh-4.3#  cat /etc/udev/rules.d/99-udisks2.rules
# Alister: mount removable disks in /media instead of /run/media/username
ENV{ID_FS_USAGE}=="filesystem|other|crypto", ENV{UDISKS_FILESYSTEM_SHARED}="1"
Comment 3 Alister 2014-05-19 05:38:12 UTC
sh-4.3#   gvfs-mount -io
Monitoring events. Press Ctrl+C to quit.
Mount added: 'puppy'
  Mount(0): puppy -> file:///media/puppy
    Type: GProxyMount (GProxyVolumeMonitorUDisks2)
    default_location=file:///media/puppy
    themed icons:  [drive-removable-media]  [drive-removable]  [drive]
    symbolic themed icons:  [drive-removable-media-symbolic]  [drive-removable-symbolic]  [drive-symbolic]  [drive-removable-media]  [drive-removable]  [drive]
    can_unmount=1
    can_eject=0
    is_shadowed=0
    sort_key=gvfs.time_detected_usec.1400477925289506

Mount changed: '134 MB Volume'
  Mount(0): 134 MB Volume -> file:///media/puppy
    Type: GProxyMount (GProxyVolumeMonitorUDisks2)
    default_location=file:///media/puppy
    themed icons:  [drive-removable-media]  [drive-removable]  [drive]
    symbolic themed icons:  [drive-removable-media-symbolic]  [drive-removable-symbolic]  [drive-symbolic]  [drive-removable-media]  [drive-removable]  [drive]
    can_unmount=1
    can_eject=0
    is_shadowed=0
    sort_key=gvfs.time_detected_usec.1400477925289506

Volume added:       '134 MB Volume'
  Volume(0): 134 MB Volume
    Type: GProxyVolume (GProxyVolumeMonitorUDisks2)
    ids:
     class: 'device'
     unix-device: '/dev/loop0'
     uuid: '5ac1532d-ac53-4ea4-8122-cce4373c53a6'
    themed icons:  [drive-removable-media]  [drive-removable]  [drive]
    symbolic themed icons:  [drive-removable-media-symbolic]  [drive-removable-symbolic]  [drive-symbolic]  [drive-removable-media]  [drive-removable]  [drive]
    can_mount=1
    can_eject=0
    should_automount=1
    sort_key=gvfs.time_detected_usec.1400477925417663
    Mount(0): 134 MB Volume -> file:///media/puppy
      Type: GProxyMount (GProxyVolumeMonitorUDisks2)
      default_location=file:///media/puppy
      themed icons:  [drive-removable-media]  [drive-removable]  [drive]
      symbolic themed icons:  [drive-removable-media-symbolic]  [drive-removable-symbolic]  [drive-symbolic]  [drive-removable-media]  [drive-removable]  [drive]
      can_unmount=1
      can_eject=0
      is_shadowed=0
      sort_key=gvfs.time_detected_usec.1400477925289506
Comment 4 A.G. 2014-05-19 11:52:51 UTC
Well, on Debian it works just fine with audio CD. Debian has gvfs version 1.20.1, glib version is 2.40.0. Unfortunately 'gvfs-mount -io' does not show associated volume for the mount so I see no possibility to diagnose the problem. The log for convenience is below. The Ubuntu machine shows the problem though, I'll test the problem and show output of 'gvfs-mount -io' when I get to it later.

Volume added:       'Audio 1'
  Volume(0): Audio 1
    Type: GProxyVolume (GProxyVolumeMonitorUDisks2)
    ids:
     class: 'device'
     unix-device: '/dev/sr0'
     label: 'Audio 1'
    themed icons:  [media-optical-cd-r]  [media-optical-cd]  [media-optical]  [media]
    symbolic themed icons:  [media-optical-symbolic]  [media-symbolic]  [media-optical]  [media]
    can_mount=1
    can_eject=1
    should_automount=1
    sort_key=gvfs.time_detected_usec.1400497876246870

Volume changed:     'Audio 1'
  Volume(0): Audio 1
    Type: GProxyVolume (GProxyVolumeMonitorUDisks2)
    ids:
     class: 'device'
     unix-device: '/dev/sr0'
     label: 'Audio 1'
    themed icons:  [media-optical-cd-r]  [media-optical-cd]  [media-optical]  [media]
    symbolic themed icons:  [media-optical-symbolic]  [media-symbolic]  [media-optical]  [media]
    can_mount=1
    can_eject=1
    should_automount=1
    sort_key=gvfs.time_detected_usec.1400497876246870

Mount added: 'Audio 1'
  Mount(0): Audio 1 -> file:///media/andrej/Audio%201
    Type: GProxyMount (GProxyVolumeMonitorUDisks2)
    default_location=file:///media/andrej/Audio%201
    themed icons:  [media-optical-cd-r]  [media-optical-cd]  [media-optical]  [media]
    symbolic themed icons:  [media-optical-symbolic]  [media-symbolic]  [media-optical]  [media]
    can_unmount=1
    can_eject=1
    is_shadowed=0
    sort_key=gvfs.time_detected_usec.1400497876467526
Comment 5 A.G. 2014-05-19 20:53:32 UTC
Under Ubuntu log from gvfs-mount -io, as promised:

Volume added:       'Звуковий диск'
  Volume(0): Звуковий диск
    Type: GProxyVolume (GProxyVolumeMonitorUDisks2)
    ids:
     class: 'device'
     unix-device: '/dev/sr0'
    activation_root=cdda://sr0/
    themed icons:  [media-optical-cd-rom]  [media-optical-cd]  [media-optical]  [media]
    symbolic themed icons:  [media-optical-symbolic]  [media-symbolic]  [media-optical]  [media]
    can_mount=1
    can_eject=1
    should_automount=1
    sort_key=gvfs.time_detected_usec.1400527112122749

Mount added: 'Звуковий диск'
  Mount(0): Звуковий диск -> cdda://sr0/
    Type: GDaemonMount
    default_location=cdda://sr0/
    themed icons:  [media-optical-audio]  [media-optical]  [media]
    symbolic themed icons:  [media-optical-symbolic]  [media-symbolic]  [media-optical]  [media]
    x_content_types: x-content/audio-cdda
    can_unmount=1
    can_eject=0
    is_shadowed=0

Mount changed: 'Звуковий диск'
  Mount(0): Звуковий диск -> cdda://sr0/
    Type: GDaemonMount
    default_location=cdda://sr0/
    themed icons:  [media-optical-audio]  [media-optical]  [media]
    symbolic themed icons:  [media-optical-symbolic]  [media-symbolic]  [media-optical]  [media]
    x_content_types: x-content/audio-cdda
    can_unmount=1
    can_eject=0
    is_shadowed=1

Mount added: 'Звуковий диск'
  Mount(0): Звуковий диск -> cdda://sr0/
    Type: GProxyShadowMount (GProxyVolumeMonitorUDisks2)
    default_location=cdda://sr0/
    themed icons:  [media-optical-cd-rom]  [media-optical-cd]  [media-optical]  [media]
    symbolic themed icons:  [media-optical-symbolic]  [media-symbolic]  [media-optical]  [media]
    x_content_types: x-content/audio-cdda
    can_unmount=1
    can_eject=1
    is_shadowed=0

Mount changed: 'Звуковий диск'
  Mount(0): Звуковий диск -> cdda://sr0/
    Type: GProxyShadowMount (GProxyVolumeMonitorUDisks2)
    default_location=cdda://sr0/
    themed icons:  [media-optical-cd-rom]  [media-optical-cd]  [media-optical]  [media]
    symbolic themed icons:  [media-optical-symbolic]  [media-symbolic]  [media-optical]  [media]
    x_content_types: x-content/audio-cdda
    can_unmount=1
    can_eject=1
    is_shadowed=0

It reports the same audio CD twice, it's why it is shown twice. The appropriate events log from GVolumeMonitor is:

on_volume_added: 0x972e5f8 found:0
  (first icon: the volume added to the sidebar)
on_mount_added: 0xb4103c00 (volume (nil)) found:0
  (second icon: the mount added to the sidebar)
on_mount_changed: 0xb4103c00 found:1
on_mount_added: 0x96a44f0 (volume 0x972e5f8) found:1
on_mount_changed: 0x96a44f0 found:1

The version of gvfs on my Ubuntu is 1.19.5 though, either it's fixed in 1.20.1, or something else is different.
Comment 6 Alister 2014-05-19 22:01:43 UTC
> either it's fixed in 1.20.1

No, because those are the same events I get, and I have 1.20.1
But I noticed that is_shadowed=1 gets set on the first mount, so I'm guessing that is supposed to hide it.  Or am I completely misunderstanding all this? ;)
Comment 7 A.G. 2014-05-19 22:55:12 UTC
If you mean that 'Mount changed' event where it was changed from 0 to 1 then I should admit this is a very, very bad redesign introduced lately. Because between those two events the file manager will do:
- allocate a data block for a new complex subwidget;
- retrieve data for new mount from the filesytem;
- render all new data into subwidget (a mount icon/label/etc.);
- shift all other subwidgets within Places sidebar.
Then (OOPS!) we get change for is_shadowed - so all the data we carefully gathered and rendered were just for nothing, therefore we should free data, destroy subwidget and shift all other Places items back where they once were. Just imagine it on a slow low-powered notebook or tablet - it will be literally very good visible, all that processing. And let me remind you, as a lightweight file manager developer I more than worry about such things that are far from being lightweight. That is very bad when GNOME people do their redesign which is oriented on high-end hardware only. And people blame file managers for being slow, not undelying libraries, you know.

That audio CD duplication never happened before so I still consider this behavior as a regression bug.

For loop mounts I probably can add a workaround into pcmanfm to give people proper behavior, just because that problem seems to be around for a while.
Comment 8 Ross Lagerwall 2014-05-20 06:53:25 UTC
(In reply to comment #7)
> file manager developer I more than worry about such things that are far from
> being lightweight. That is very bad when GNOME people do their redesign which
> is oriented on high-end hardware only. And people blame file managers for being
> slow, not undelying libraries, you know.
> 
> That audio CD duplication never happened before so I still consider this
> behavior as a regression bug.
> 

This isn't about GNOME people ignoring other file managers and only running high end hardware... I've been using a netbook for the last 6 months after all (which doesn't have a CD drive :-) ).  It's more that this stuff doesn't get noticed or reported since the udisks2 volume monitor code is pretty much unchanged since 2012.

To summarize: this bug is about ensuring that the signals that the udisks2 volume monitor sends appear in a correct and logical order and with the correct information such that clients do not have to jump through hoops to deal with it.

Also see bug 730423 which is about a specific race that I found while looking through the code.

Thanks!
Comment 9 A.G. 2014-05-20 11:06:04 UTC
Thank you very much for working on this. I really lost my hope since there are 2 tickets here nobody even tried to work on - 687003 and 706222. You've restored my hope now. I'm sorry if my words were harsh. I look forward to see this fixed. Thanks!
Comment 10 GNOME Infrastructure Team 2018-09-21 17:41:36 UTC
-- GitLab Migration Automatic Message --

This bug has been migrated to GNOME's GitLab instance and has been closed from further activity.

You can subscribe and participate further through the new bug through this link to our GitLab instance: https://gitlab.gnome.org/GNOME/gvfs/issues/232.