Page 2 of 5

Posted: Sat 21 Apr 2012, 16:09
by jemimah
This seems interesting. I'm definitely looking forward to testing it. I think replacing pup_event_frontend_d with something more flexible and extensible is a big step toward making puppy a "real" distro" (there are a few more places with a lot of ad hoc hard coded stuff that need work as well).

Getting gvfs volume monitoring to work is a separate (but important if you are not using rox) issue.

Posted: Sun 22 Apr 2012, 23:41
by jemimah
Ok so I've spent the entire weekend banging my head against getting drives to show up in thunar.

I've got no dice with either gvfs/udisks or the simple volume monitor posted here. :(

Getting errors like "Could not detect the volume corresponding to the device"

Akash_rawal, have you had any success with anything like this so far?

Posted: Mon 23 Apr 2012, 00:26
by gcmartin
jemimah wrote:Ok so I've spent the entire weekend banging my head against getting drives to show up in thunar. ...
Jemimah, as everyone knows I am no developer. But, could the visibility drives problems that have been an issue in Puppies over the past 8 months be related to what you are seeing?

If this yield a clue, to you or any of the developers, it may help.

Posted: Mon 23 Apr 2012, 00:32
by jemimah
Ok I figured out to set the PUP_VOLUME_MONITOR_USE environment variable and have now progressed to segfaults - yay, finally something that I understand how to debug!

Code: Select all

0  0x00000000 in ?? ()
#1  0xb78ab4d5 in g_drive_is_media_removable () from /usr/lib/libgio-2.0.so.0
#2  0x0808b0b5 in thunar_g_volume_is_removable (volume=0x8221660) at thunar-gio-extensions.c:487
#3  0x080c2c18 in thunar_shortcuts_model_init (model=0x8221240) at thunar-shortcuts-model.c:300
#4  0xb785e35e in g_type_create_instance () from /usr/lib/libgobject-2.0.so.0
#5  0xb784868e in ?? () from /usr/lib/libgobject-2.0.so.0
#6  0xb7847b25 in g_object_newv () from /usr/lib/libgobject-2.0.so.0
#7  0xb784795e in g_object_new () from /usr/lib/libgobject-2.0.so.0
I'm guessing this is because the implementation is not complete yet. I'd be really psyched if we could get this working.

Posted: Mon 23 Apr 2012, 00:43
by technosaurus
jemimah, it may help to make a symlink to /media from /mnt ... but iirc, you already fixed that. aside from that all I can think of to add for dynamic drives would be to use inotify_add_watch for an IN_CREATE in /sys/block/ (i'm pretty sure most recent puppies after 4.3.X have inotify ) ... although I believe glib has a similar function - it may be gvfs based

Posted: Mon 23 Apr 2012, 00:49
by jemimah
I did fix the /media thing in both glib and in udisks (when I was playing with that - but I've given up on it since the dbus stuff makes debugging it nearly impossible).

I'm pretty sure the problem is that the gio is not returning enough information. Like with udisks, it would get a volume list but it could not figure out the device path names or filesystems.

I think with udisks, either udisks itself, udev, or glib is broken - but I can't figure out which.

I think a simple volume monitor like this one is a far nicer solution - though thunar stills needs gvfs if you want a trashcan.

Posted: Mon 23 Apr 2012, 03:41
by technosaurus
all block devices get symlinks in /sys/block/<drive>
if you follow that symlink, the directory contains a directory(ies) representing the partition(s), but don't tell the fs type (however blkid will, along with UUID - or the deprecated guessfstype - no UUID)
/proc/partitions is a good alternative though - gives quite a bit of info

SpaceFM, the fork of PCManFM 0.5.X (not the one used by LXDE), has an implementation if you need some code to borrow - I posted a pet, but it is a bit outdated - the homepage has moved to:
http://ignorantguru.github.com/spacefm/
SpaceFM 0.7.5 does not require udisks (only udev). However, in order to mount or unmount devices as a non-root user, you will need pmount or udisks installed, or will need to specify a custom program to be used. A custom mount solution is currently under development. Also, enabling kernel polling ...
... this one is actually pretty nice

Another one that has support for mount/unmount-ing removable drives is rodent file manager (a fork of xffm)
http://xffm.org/
it monitors /proc/partitions, but it must be enabled at compile time with --enable-fstab-plugin ... that may actually make it easier to find the code (by grepping for ifdefs)
I like a lot of the ideas of this project, but the implementation of the ideas didn't seem to be polished yet.

Posted: Tue 24 Apr 2012, 14:03
by jemimah
I've tracked the problem to this function:

Code: Select all

GDrive *pup_volume_get_drive(GVolume *volume)
{
	PupVolume *self = PUP_VOLUME(volume);
	PVM_LOCK(self);
	Drive *drive = g_hash_table_lookup(self->monitor->drives, self->data->drv_sysname);
	GDrive *ret =  G_DRIVE(pup_drive_get(self->monitor, drive));
	PVM_UNLOCK(self);
	
	return ret;
}

drive ends up null and causes the segfault. But any fix I make here ends up with a segfault somewhere else.

Posted: Tue 24 Apr 2012, 14:08
by jemimah
technosaurus wrote:all block devices get symlinks in /sys/block/<drive>
if you follow that symlink, the directory contains a directory(ies) representing the partition(s), but don't tell the fs type (however blkid will, along with UUID - or the deprecated guessfstype - no UUID)
/proc/partitions is a good alternative though - gives quite a bit of info

SpaceFM, the fork of PCManFM 0.5.X (not the one used by LXDE), has an implementation if you need some code to borrow - I posted a pet, but it is a bit outdated - the homepage has moved to:
http://ignorantguru.github.com/spacefm/
SpaceFM 0.7.5 does not require udisks (only udev). However, in order to mount or unmount devices as a non-root user, you will need pmount or udisks installed, or will need to specify a custom program to be used. A custom mount solution is currently under development. Also, enabling kernel polling ...
... this one is actually pretty nice

Another one that has support for mount/unmount-ing removable drives is rodent file manager (a fork of xffm)
http://xffm.org/
it monitors /proc/partitions, but it must be enabled at compile time with --enable-fstab-plugin ... that may actually make it easier to find the code (by grepping for ifdefs)
I like a lot of the ideas of this project, but the implementation of the ideas didn't seem to be polished yet.
Any udisks implemntation doesn't help me since udisks doesn't even work from the command line. Can't figure out why.

Posted: Tue 24 Apr 2012, 15:05
by akash_rawal
At last! My volume monitor GIO module is almost complete. See first post.

I have tested GTK file chooser and pcmanfm2. pcmanfm2 works fine. GTK shows some assertion failures after unmounting a drive, but it still works.

For the GIO module to work, as jemimah had already figured out, you need to set PUP_VOLUME_MONITOR_USE environment variable. I set up this mechanism to protect 'innocent' programs from crashing.

Image

Posted: Tue 24 Apr 2012, 15:33
by jemimah
Dude! You are my new hero. Let me know how I can help you with this project!

Posted: Tue 24 Apr 2012, 15:50
by jemimah
Mounting is working (maybe some issues with ntfs).
EDIT: nevermind about ntfs - it seems fine now.

But unmounting is segfaulting

Code: Select all

Program received signal SIGSEGV, Segmentation fault.
0x0809e8f3 in ?? ()
(gdb) bt
#0  0x0809e8f3 in ?? ()
#1  0xb78ecac5 in g_simple_async_result_complete () from /usr/lib/libgio-2.0.so.0
#2  0xb7144524 in pup_volume_monitor_generic_cb (conv=0x8220b80, rcvd_data=0x8183f10, is_new=0, user_data=0x0, conv_user_data=0xb5e07598)
    at volume_monitor.c:324
#3  0xb713e3f9 in ps_conv_mgr_sorter_cb (sock=0x812f120, data=0xbffff514, user_data=0x81364c0) at conv.c:156
#4  0xb713be02 in pup_sock_common_marshaller (hook=0x0, marshal_data=0xbffff458) at core.c:250
#5  0xb774d91e in g_hook_list_marshal_check () from /usr/lib/libglib-2.0.so.0
#6  0xb713c22b in pup_sock_raise (sock=0x812f120, event=1, has_data=1, cb_data=0xbffff514) at core.c:240
#7  0xb713cff9 in pup_sock_try_receive_block (sock=0x812f120, timer=0x8183f90, data_read=0xbffff558, error=0xbffff5a8) at transfer.c:262
#8  0xb713d172 in pup_sock_receive (sock=0x812f120, timeout=0, num_blocks=4294967295, error=0xbffff5a8) at transfer.c:296
#9  0xb713d33f in pup_sock_input_callback (sock=0x812f120) at transfer.c:324
#10 0xb713c0e9 in pup_sock_event_source_dispatch (source=0x81467e8, callback=0, data=0x0) at core.c:376
#11 0xb775d2cd in g_main_dispatch () from /usr/lib/libglib-2.0.so.0
#12 0xb775def4 in g_main_context_dispatch () from /usr/lib/libglib-2.0.so.0
#13 0xb775e0dc in g_main_context_iterate () from /usr/lib/libglib-2.0.so.0
#14 0xb775e54d in g_main_loop_run () from /usr/lib/libglib-2.0.so.0

Posted: Tue 24 Apr 2012, 17:03
by akash_rawal
jemimah wrote: Mounting is working (maybe some issues with ntfs).
EDIT: nevermind about ntfs - it seems fine now.
If you are getting errors like "Error code 4 (Some other error)", then it is a known problem.

This occurs when drive is mounted, but /proc/mounts is not updated in time.

Do you know how to wait for kernel to update /proc/mounts? inotify doesn't seem to work.
jemimah wrote:

Code: Select all

(gdb) bt 
#0  0x0809e8f3 in ?? () 
It looks like problem of invalid function pointer.

I hope you are testing on Thunar?

I will now download thunar-volman to test it myself now. Thanks for info.

Posted: Tue 24 Apr 2012, 17:33
by akash_rawal
Well I'm unable to get Thunar running on GIO.

After installing thunar-volman from Ubuntu Lucid repository, and now I get this.
Image

How do you get Thunar use GIO instead of hal?

Posted: Tue 24 Apr 2012, 18:40
by jemimah
Thunar-volman is not needed.

Thunar itself can handle mounting/unmounting. You might need a pretty new version of thunar.

Posted: Tue 24 Apr 2012, 19:19
by jemimah
I'm getting these now. I don't think I saw them previously.

Code: Select all

(Thunar:1744): GLib-GObject-WARNING **: invalid uninstantiatable type `(null)' in cast to `GMount'

(Thunar:1744): GLib-GIO-CRITICAL **: g_mount_unmount_finish: assertion `G_IS_MOUNT (mount)' failed
Segmentation fault
The unmounting operation actually does complete, by the way.

Posted: Tue 24 Apr 2012, 19:43
by technosaurus
PUP_VOLUME_SET_MOUNT is a macro that sets object->mount to mnt by casting mnt as a gpointer ... if gpointer points to a NULL...

could either replace it with a function that checks for null (or mod the macro) or check for null prior to each PUP_VOLUME_SET_MOUNT

Posted: Tue 24 Apr 2012, 20:01
by jemimah
I recompiled Thunar with debug symbols so you could see the complete stack.

Code: Select all

(gdb) bt
#0  0x0809e8f3 in thunar_shortcuts_view_unmount_finish (object=0x8173350, result=0x82791a8, user_data=0x81cc000) at thunar-shortcuts-view.c:1448
#1  0xb78ecac5 in g_simple_async_result_complete () from /usr/lib/libgio-2.0.so.0
#2  0xb7144524 in pup_volume_monitor_generic_cb (conv=0x8220560, rcvd_data=0x8165560, is_new=0, user_data=0x0, conv_user_data=0x82791a8)
    at volume_monitor.c:324
#3  0xb713e3f9 in ps_conv_mgr_sorter_cb (sock=0x812f120, data=0xbffff504, user_data=0x81364c0) at conv.c:156
#4  0xb713be02 in pup_sock_common_marshaller (hook=0x0, marshal_data=0xbffff448) at core.c:250
#5  0xb774d91e in g_hook_list_marshal_check () from /usr/lib/libglib-2.0.so.0
#6  0xb713c22b in pup_sock_raise (sock=0x812f120, event=1, has_data=1, cb_data=0xbffff504) at core.c:240
#7  0xb713cff9 in pup_sock_try_receive_block (sock=0x812f120, timer=0x8161c00, data_read=0xbffff548, error=0xbffff598) at transfer.c:262
#8  0xb713d172 in pup_sock_receive (sock=0x812f120, timeout=0, num_blocks=4294967295, error=0xbffff598) at transfer.c:296
#9  0xb713d33f in pup_sock_input_callback (sock=0x812f120) at transfer.c:324
#10 0xb713c0e9 in pup_sock_event_source_dispatch (source=0x8145c00, callback=0, data=0x0) at core.c:376
#11 0xb775d2cd in g_main_dispatch () from /usr/lib/libglib-2.0.so.0
#12 0xb775def4 in g_main_context_dispatch () from /usr/lib/libglib-2.0.so.0
#13 0xb775e0dc in g_main_context_iterate () from /usr/lib/libglib-2.0.so.0
#14 0xb775e54d in g_main_loop_run () from /usr/lib/libglib-2.0.so.0
#15 0xb7cd3ae9 in gtk_main () from /usr/lib/libgtk-x11-2.0.so.0
#16 0x08062a76 in main (argc=1, argv=0x822cad0) at main.c:294

Posted: Wed 25 Apr 2012, 02:42
by sunburnt
If I may... a suggestion for your suggestion.

I don`t care for partition icons on the desktop, maybe rewrite HotPup too?

Putting the icons on a slide-out panel would cleanup the desktop.

Posted: Wed 25 Apr 2012, 17:17
by akash_rawal
jemimah wrote: I'm getting these now. I don't think I saw them previously.

Code: Select all

(Thunar:1744): GLib-GObject-WARNING **: invalid uninstantiatable type `(null)' in cast to `GMount'

(Thunar:1744): GLib-GIO-CRITICAL **: g_mount_unmount_finish: assertion `G_IS_MOUNT (mount)' failed
Segmentation fault
The unmounting operation actually does complete, by the way.
Thanks, I think I got to the root of the problem.

When a drive is unmounted, the daemon first sends a message that a drive is unmounted so that data is kept up-to-date. In this process the GMount object is destroyed. After that message arrives stating unmount operation has completed, and then thunar tries to access the destroyed object and crashes.

Now the mount function references the object, so that it is destroyed only after message arrives stating unmount operation has completed. Hope this solves the issue. Please test. (See first post)