#850 Loop mounted filesystem is listed twice in "Places" side pane

1.2
pending-fixed
libfm (279)
5
2014-06-09
2014-03-20
alister.hood
No

Similar to #796
If I loop mount a filesystem image, it is listed twice in the "Places" side pane.
e.g. if I do mount -o loop -t ext4 sda1.4fs /mnt/sda1.4fs
It is not affected by whether the option "mount removable media automatically when they are inserted" is enabled or not.

Discussion

  • alister.hood
    alister.hood
    2014-04-10

    Oh, I see if I insert an audio CD it shows up twice as well.

     
  • Is it shown twice still if you restart pcmanfm? Is it shown twice in any other file manager or only in pcmanfm? What is your OS, and Glib/gvfs versions?
    Thank you very much.

     
  • alister.hood
    alister.hood
    2014-05-17

    Is it shown twice still if you restart pcmanfm?

    No, it is shown once (in both pcmanfm and thunar) if I kill them off and mount the image before restarting them.

    Is it shown twice in any other file manager or only in pcmanfm?

    OK, so I installed thunar to test. When I mount an image file to /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".

    OS=Arch
    Glib=2.40.0
    GVFS=1.20.1

     
  • 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.
    Just as a bit of info to add if you file a bug to GVFS. If you don't do then I can do it.

     
    • labels: --> isn't related to libfm or pcmanfm
     
  • Ross Lagerwall
    Ross Lagerwall
    2014-05-19

    From what I can tell, the behavior is as follows (can be seen with gvfs-mount -io):
    1. gvfs detects from /proc/mounts a new mount and emits mount-added.
    2. gvfs detects a volume being added from udisks, updates the mount's name and sets its volume. It emits mount-changed for the mount.
    3. gvfs emits volume-added for the new volume.

    Sample output from gvfs-mount -io with some extra printing added:
    Mount added: 'puppy'
    Mount(0): puppy -> file:///run/media/ross/puppy
    Type: GProxyMount (GProxyVolumeMonitorUDisks2)
    volume is null *
    default_location=file:///run/media/ross/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.1400479445950317


    Mount changed: '2.1 GB Volume'
    Mount(0): 2.1 GB Volume -> file:///run/media/ross/puppy
    Type: GProxyMount (GProxyVolumeMonitorUDisks2)
    volume name = 2.1 GB Volume
    *
    default_location=file:///run/media/ross/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.1400479445950317

    Volume added: '2.1 GB Volume'
    Volume(0): 2.1 GB Volume
    Type: GProxyVolume (GProxyVolumeMonitorUDisks2)
    ids:
    class: 'device'
    unix-device: '/dev/loop0'
    uuid: 'f51c716b-fa7a-4ee1-b511-86cfdbd8fb3d'
    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=0
    sort_key=gvfs.time_detected_usec.1400479446056373
    Mount(0): 2.1 GB Volume -> file:///run/media/ross/puppy
    Type: GProxyMount (GProxyVolumeMonitorUDisks2)
    default_location=file:///run/media/ross/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.1400479445950317

    Since gvfs receives the mount added and volume added signals from two different sources, I don't think it's practical to order it so that every mount has a volume when mount-added is emitted.

    It should be possible for pcmanfm to get the mount's volume from the mount-changed signal and update appropriately.

    Cheers

     
  • Ross Lagerwall
    Ross Lagerwall
    2014-05-19

    Ah, the formatting got a bit messed up... well it's still somewhat readable.

     
  • @Ross Lagerwall, thanks for the comment. Well, in my tests with audio CD, the sequence was not as mentioned by you but as follows:
    - a volume added
    - the volume changed
    - a mount added
    I cannot show you the log of gvfs-mount -io at the moment, I'll do it in your bugzilla when I can. The case when "mount-added" comes before "volume-added" is handled very well in LibFM, it was always the same for loop file systems and it works just fine using gvfs 1.12.3 so that is not a problem. The exact problem is g_mount_get_volume() for GMount in "mount-added" callback returns NULL while it should not if volume exists.

     
  • Ross Lagerwall
    Ross Lagerwall
    2014-05-19

    Well perhaps there's more than one issue here. I put some debug prints in libfm to show what happens when mounting a loopback filesystem:
    In on_mount_added, vol=(nil)
    In on_mount_changed, vol = 0x1e82430
    In on_volume_added, vol=0x1e82430

    So this corresponds to the situation described previously and yet pcmanfm still showed two entries in the places side pane.

    I also noticed that sometimes in the second line, vol = NULL. This is probably the gvfs bug you're talking about and I'll follow that up on the gvfs bug tracker.

     
  • Yes, it seems audio CD and loop volume duplicates are two different issues.
    About CD problem I wrote the logs into gvfs bug tracker.

    About loop device I still think it is incorrect to return volume NULL first and report that volume later. And I believe it worked with earlier versions of glib/gbfs since that was never reported before and I tested it on debian wheezy and it worked fine but I cannot test it right now again so I cannot give you any proof on it so may be I have to add a workaround. To be honest, I hate all those workarounds because if workaround is required then it means workarounded code is bad. Unfortunately glib and gtk usage needs a lot of workarounds. :(

     
    • Ross Lagerwall
      Ross Lagerwall
      2014-05-19

      To be honest, I don't know enough about the volume monitor part of gio/gvfs to say whether this loop mount breaks the expectations of how a volume monitor should behave, but it is certainly worth investigating.

      I agree that fixes should go upstream as much as possible to avoid duplication of effort and benfit all users. And if glib and gtk usage needs a lot of workarounds, then maybe we just need more patches sent upstream :-)

       
  • alister.hood
    alister.hood
    2014-05-19

    To be honest, I hate all those workarounds because if workaround is required then it means workarounded code is bad

    It's also pretty annoying if things need to be worked around in every different program as well. If a workaround is the answer I'll have to go report these issues to thunar as well, to be a good citizen. And then I guess there are other programs we didn't test...

     
    • labels: isn't related to libfm or pcmanfm --> libfm
    • status: open --> pending-fixed
    • assigned_to: Lonely Stranger
     
  • Fix for loop device duplication is added to libfm GIT sources. For CD duplication regression let wait GLib to fix it. Check it when possible. Thank you very much.