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 143197 - gThumb does not support the GNOME virtual file-system
gThumb does not support the GNOME virtual file-system
Status: RESOLVED FIXED
Product: gthumb
Classification: Other
Component: general
2.9.x
Other Linux
: Normal normal
: ---
Assigned To: Paolo Bacchilega
Paolo Bacchilega
: 300808 308860 397308 (view as bug list)
Depends on:
Blocks:
 
 
Reported: 2004-05-26 11:23 UTC by q
Modified: 2007-02-08 13:17 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Patch to use gnome_gdk_pixbuf_new_from_uri in image_loader (972 bytes, patch)
2007-01-17 19:00 UTC, Michael Chudobiak
needs-work Details | Review
Rough patch to add vfs support (8.31 KB, patch)
2007-01-21 02:47 UTC, Michael Chudobiak
none Details | Review

Description q 2004-05-26 11:23:44 UTC
trying to acces an immage which is on a network share such as
smb://host/share/image.jpg or nfs://host/share/image.jpg
does not work.

gThumb should access files through libgnomevfs to be able to access 
all files that can be accessed with nautilus to integrate better
into the gnome desktop.
Comment 1 tom 2006-06-08 17:44:05 UTC
This is an absolute must-have for me too, especially because gThumb also doesn't threat mounted NFS shares correctly, which I tried as a work-around for this VFS issue. gThumb is absolutely unusable in a network environment this way!

Tom
Comment 2 Michael Chudobiak 2006-09-20 19:23:33 UTC
*** Bug 308860 has been marked as a duplicate of this bug. ***
Comment 3 Michael Chudobiak 2006-09-20 19:27:18 UTC
*** Bug 300808 has been marked as a duplicate of this bug. ***
Comment 4 Michael Chudobiak 2006-11-20 12:42:15 UTC
Fileroller has the same problem: bug 152920.
Comment 5 Michael Chudobiak 2007-01-10 19:42:10 UTC
Bumping version up to 2.9.x - still an issue. 

- Mike
Comment 6 Michael Chudobiak 2007-01-16 17:22:59 UTC
*** Bug 397308 has been marked as a duplicate of this bug. ***
Comment 7 28872d13 2007-01-16 19:46:00 UTC
I´ve seen that internally GnomeVFS is used, why doesn´t it work yet then?
Comment 8 Michael Chudobiak 2007-01-16 20:00:17 UTC
Philipp,

A quick test shows that I can open VFS URIs (like smb://....) if I select "Other..." in the pop-up folder bar, and enter the URI manually.

It doesn't work if I pass the URI as a command line parameter, however (gthumb smb://....).

So... VFS is semi-supported. I suggest taking a look at src/main.c, and see how command line arguments are being handled. The code is probably assuming simple file names, rather than VFS URIs.

- Mike
Comment 9 28872d13 2007-01-16 20:11:22 UTC
For me this doesn´t work, too. It just opens my homefolder. Instead, I made an additional gtk_file_chooser_set_local_only() call for the "Open location" filechooser. Now I can successfully open and browse remote directories, but images they contain are just not displayed (gthumb uses the default thumbnail and if I open them, I just get an empty image)
Comment 10 Michael Chudobiak 2007-01-16 20:31:59 UTC
Yes, lots of strange things seem to happen.

I can browse remote directories using the "Other..." tool, but I can never load images.

Some smb:// URIs do display thumbnails, but some don't. ssh:// ones never do. http:// doesn't work at all.

So I guess the VFS code is a mess at the moment.

Are you using svn trunk? I can review/commit patches for you, if you are in a position to write some.

- Mike
Comment 11 28872d13 2007-01-16 20:45:09 UTC
Yes, I´m using SVN trunk. But until I figured out what exactly is messed up (because it´s REALLY strange by now), making patches won´t make much sense. I´ll let you know as soon as I find something out.
Comment 12 Michael Chudobiak 2007-01-17 18:34:23 UTC
Philipp,

The basic problem is probably this: 

gThumb uses gdk_pixbuf_new_from_file to load the images, and gdk_pixbuf_new_from_file doesn't seem to support gnome_vfs! It just takes an "ordinary" file name.

http://developer.gnome.org/doc/API/2.4/gdk-pixbuf/gdk-pixbuf-file-loading.html

I'm not sure what to do about that.


- Mike

Comment 13 Michael Chudobiak 2007-01-17 18:37:50 UTC
Ah ha! We need:

gnome_gdk_pixbuf_new_from_uri

http://developer.gnome.org/doc/API/2.2/libgnomeui/libgnomeui-gnome-vfs-util.html#gnome-gdk-pixbuf-new-from-uri

- Mike
Comment 14 Michael Chudobiak 2007-01-17 19:00:19 UTC
Created attachment 80535 [details] [review]
Patch to use gnome_gdk_pixbuf_new_from_uri in image_loader

Here is a quick-and-dirty mini-patch that allows the image loader to open VFS URIs (using the "Other..." tool). I tested it using smb:// and ssh://, and it seemed to work, except for the occasional assertion error like:

** (gthumb:19275): CRITICAL **: do_load_internal: assertion `g_path_is_absolute (path)' failed

You can "grep gdk_pixbuf_.*_from_file */*.c" to see what needs to be changed, at a minimum (plus the argument parsing in src/main.c:initialize_data).

- Mike
Comment 15 Paolo Bacchilega 2007-01-17 19:13:30 UTC
libgnomeui is going to be deprecated, so I think we should reimplement that function locally (file-utils.c seems a good place)

For performance reasons I'd use gdk_pixbuf_new_from_file for local uris (uris with a file: method) and gdk_pixbuf_loader_write for remote ones
Comment 16 Michael Chudobiak 2007-01-17 19:24:06 UTC
Paolo,

Just an idea: do you think we can borrow anything from gegl or a different library, which would get us HDR and/or RAW support at the same time (bug 312896 and bug 145564)?

- Mike


Comment 17 Paolo Bacchilega 2007-01-18 10:03:06 UTC
it depends on how much code have to be imported, if the code is too big I don't think it's worth it
Comment 18 Michael Chudobiak 2007-01-20 11:50:29 UTC
To do:

- copy gnome_gdk_pixbuf_new_from_uri equivalent into file-utils.c
    - later: two loader methods, local/remote, for performance?
    - add assertions to check for URI format

- replace gdk_pixbuf_new_from_file instances

- modify do_load_internal to accept full URIs
    - add assertions to check for URI format

- modify main.c to accept URI arguments


- Mike
Comment 19 Michael Chudobiak 2007-01-21 00:14:39 UTC
also:

- resolve_all_symlinks is broken for VFS URIs
Comment 20 Michael Chudobiak 2007-01-21 02:47:43 UTC
Created attachment 80791 [details] [review]
Rough patch to add vfs support

This is a rough patch that adds VFS support through the "Other..." folder function. I've tested it with ssh:// URIs, and it loads both the thumbnails and the images. It is not ready for svn commit.

Issues: 
- it doesn't show GIFs on VFS
- the "animated" pixbuf functions aren't VFS enabled yet
- it doesn't accept command-line URIs yet
- resolve_all_symlinks has been modified, but not tested
- http:// URIs don't work - I don't know why. Anybody?
- I am using gnome_gdk_pixbuf_new_from_uri from libgnomeui. It should be re-implemented locally.
- I haven't added any gtk_file_chooser_set_local_only calls - where do they go?
- I imagine I've broken other things...

Notes:
- Two new functions have been added to file-utils.c
     - gth_pixbuf_new_from_uri
          - switches between gdk_pixbuf_new_from_file (local files)
            and gnome_gdk_pixbuf_new_from_uri (remote files)
     - gth_pixbuf_animation_new_from_uri
          - just returns gdk_pixbuf_animation_new_from_file
            for now. Rewrite to support VFS.

Feedback would be useful...

- Mike
Comment 21 Paolo Bacchilega 2007-01-21 10:49:22 UTC
I think the only big issue is saving images on a remote location, the only solution that comes to my mind is to save it in a temp directory and copy it with gnome_vfs_xfer to the destination.


> it doesn't show GIFs on VFS

if the location is remote we can simply use gth_pixbuf_new_from_uri and load the gif as a static image, it's sub-optiomal but at least you can view something.

> the "animated" pixbuf functions aren't VFS enabled yet

using a temp file can fix this issue as well, if the gif is remote copy it in a temp dir with gnome_vfs_xfer and then load it with gdk_pixbuf_animation_new_from_file

...

> I haven't added any gtk_file_chooser_set_local_only calls - where do they go?

After creating the dialog and before showing it.

> I imagine I've broken other things...

why don't you make a svn branch? this way it'll be easier to test the patch.
Comment 22 Michael Chudobiak 2007-01-21 13:49:07 UTC
Paolo,

Thanks, I hadn't thought about file saving yet.

I'll make a "vfs" branch in a while.

- Mike
Comment 23 Michael Chudobiak 2007-01-21 21:18:57 UTC
A "vfs-testing" branch has been added.

- Mike
Comment 24 Michael Chudobiak 2007-01-21 21:25:57 UTC
Note to self:

Check all gtk_file_chooser_dialog_new instances.

- Mike
Comment 25 Michael Chudobiak 2007-01-21 21:55:52 UTC
More todos:

- check copy/duplicate/rename functions
- implement tmpdir for animated gifs
Comment 26 Michael Chudobiak 2007-01-22 14:16:31 UTC
The vfs-testing branch works for smb:// and ssh://, but something odd is going on with the authentication dialogs - they aren't always offered.

For instance, if you view a ssh:// location and close gthumb, then re-start, it tries to go back to that location but fails with an authentication error. It doesn't offer an authentication dialog. Something to look into...

- Mike
Comment 27 Michael Chudobiak 2007-01-22 14:17:42 UTC
I just noticed these console errors:

connection_message_func(): Callback
CALLBACK: fill-authentication!!!

- Mike
Comment 28 Michael Chudobiak 2007-01-22 17:38:51 UTC
The authentication problems were fixed with:

#include <libgnomeui/gnome-authentication-manager.h>
gnome_authentication_manager_init ();

in src/main.c.

- Mike
Comment 29 Michael Chudobiak 2007-01-24 14:14:04 UTC
svn rev 1288 can launch single VFS files/directories from the command line now.

Multiple files (= command line catalog) do not work yet.

- Mike
Comment 30 Michael Chudobiak 2007-01-24 14:52:06 UTC
Paolo,

I can launch VFS files from the command line now, but if I browse to the remote VFS file location using Nautilus and use the "open with" right-click function it doesn't work.

The filename doesn't seem to be passed as an argument into src/main.c:initialize_data - it's being filtered out somewhere at a higher level. (If I use "open with" on a local filesystem folder, it works OK).

Any ideas where the problem might be?

- Mike
Comment 31 Michael Chudobiak 2007-01-24 16:32:16 UTC
Just to clarify: if I use "open with" on a remote Nautilus VFS file, the gthumb argc = 0.

- Mike
Comment 32 Michael Chudobiak 2007-01-24 16:48:42 UTC
Never mind, I figured it out. Use "Exec=gthumb %U" in gthumb.desktop.

- Mike
Comment 33 Michael Chudobiak 2007-01-24 19:44:36 UTC
Catalog support is broken currently in vfs-testing.

- Mike
Comment 34 Michael Chudobiak 2007-01-25 14:51:41 UTC
Catalog support has been fixed in vfs-testing branch.

Done:

- VFS browsing with "Other..." and Ctrl+L works
- VFS args on command line work, except if shell globs are present
- video thumbnailing and playing seems to work (bug 134366)

To do:

- should we manually process command line VFS shell globs?*
- fix remote animated gif display
- file saving, exporting, copying, renaming: not tested yet
- symlink handling: not tested yet


* I'm not sure what to do about this, if anything. Is it worth re-implementing the shell functions for vfs? Is there a handy function to do that? Suggestions?

- Mike
Comment 35 Michael Chudobiak 2007-01-25 18:28:49 UTC
Animated gifs work now.

No one else seems to support VFS "shell globs", so we'll forget about that.

To do:

- what happens in the folder browser when you go to the root of a remote URI?
- file saving, exporting, copying, renaming: not tested yet
- symlink handling: not tested yet
Comment 36 Michael Chudobiak 2007-01-26 19:48:32 UTC
Some functions that use "fopen" (and thus lack VFS support):

libgthumb/jpegutils/jpeg-data.c: 
    jpeg_data_load_file
    jpeg_data_save_file

libgthumb/jpegutils/jpegtran.c:
    jpegtran

libgthumb/pixbuf-utils.c:
    _gdk_pixbuf_savev
    _gdk_pixbuf_save_as_jpeg
    _gdk_pixbuf_save_as_tiff
    _gdk_pixbuf_save_as_tga

libgthumb/comments.c:
    save_iptc_data

src/catalog-web-exporter.c: 
    save_html_image_cb
    save_html_index_cb
    parse_theme_files

- Mike
Comment 37 Michael Chudobiak 2007-01-28 20:10:48 UTC
I'm trying to add VFS save/edit support, but I've run into some trouble and could use suggestions.

The problem is that GnomeVFSFileInfo reports these fields properly for local files:

GNOME_VFS_PERM_ACCESS_READABLE
GNOME_VFS_PERM_ACCESS_WRITABLE
GNOME_VFS_PERM_ACCESS_EXECUTABLE

but not for remote (ssh://, smb://) locations. Remote locations seem to report zero for each of the above permissions. (The other permissions, like GNOME_VFS_PERM_USER_READ or GNOME_VFS_PERM_GROUP_WRITE are reported correctly.)

gthumb checks these bits to see if we can edit files in a given folder.

Is there a known problem with these bits for remote URIs?

svn rev 1305 of vfs-testing prints out the permission bits to the console, for debugging. See libgthumb/file-utils.c: check_permissions.

- Mike
Comment 38 Michael Chudobiak 2007-01-29 13:15:40 UTC
VFS saving seems to be fraught with peril. Some bugs to study:

Bug 40644 – Untrustable uid & gid in file info
Bug 155866 – Respect GNOME_VFS_FILE_INFO_FIELDS_IDS
Bug 169726 – Connect to sever (SSH) file permissions are wrong (cannot save files)
Bug 110191 – Gedit can't save directly to a remote file (gnome-vfs write support)

- Mike
Comment 39 Michael Chudobiak 2007-01-29 13:26:51 UTC
Do we really need to check directory permissions beforehand, or should we just attempt to overwrite the file as required and report an error if it fails?

- Mike
Comment 40 28872d13 2007-01-29 13:43:19 UTC
I think simply trying it should be enough for now...

Regards,
pkerling
Comment 41 Michael Chudobiak 2007-01-29 15:38:43 UTC
OK, I've re-written src/dlg-jpegtran.c:apply_transformation to use local caching of remote VFS files, without directory-permission checks. So jpeg physical rotations can be done on VFS files now (svn rev 1306, vfs-testing branch).

Some observed issues:

1. Comments aren't being loaded from remote files (minor)

2. Exif tags aren't being loaded from remote files (major)

3. Permissions-related error messages from the "mv" line in src/rotation-utils.c:apply_transformation_jpeg are being reported to the console, rather than through gthumb. This should be done more elegantly. This is only an issue for local files, because the calling routine (apply_transformation) catches VFS problems before it. (minor)

- Mike

Comment 42 Michael Chudobiak 2007-01-29 17:43:04 UTC
I've tidied up the rotation error reporting, so that is fine.

The exif tag issue is a bit worrisome. libexif doesn't support gnomevfs, so if we want to read exif tags we have to copy the whole file to a temp dir, which will be really slow if we have to do it repeatedly.

Maybe the preloaders should copy remote files to a cache, and we check the cache before rotating, or reading exif tags, etc. That adds a whole layer of complexity to reads and writes though, and will use up a lot of disk space locally (temporarily).

Should we opt for speed or simplicity here? Do you have any preference, Paolo?

- Mike
Comment 43 Michael Chudobiak 2007-01-30 13:37:27 UTC
I've added remote XML comment reading support.

XML comment writing, iptc read/write, and Exif read/write are next on the list.

For now, I'm just making temporary local copies of files when we need to access remote files for functions that don't support VFS natively. I'm not going to try longer-term file caching. Image editing is never going to work well over DSL or slower links anyways...

- Mike
Comment 44 Michael Chudobiak 2007-02-02 18:53:50 UTC
Paolo,

VFS support is nearing completion. I have implemented a local cache for remote files after all.

If I get some time this weekend, I hope to wrap up the remaining loose ends and merge the vfs-testing branch back into the trunk. Is that OK with you, or do you want them kept separate for a while?

- Mike
Comment 45 Michael Chudobiak 2007-02-03 13:51:09 UTC
OK, the vfs-testing branch is "feature complete". You can browse VFS folders and edit remote images. (Also, video thumbnailing, video launch, and RAW photo thumbnailing using libopenraw, are now implemented.)

I am aware of one crasher bug (bug 403932), which I haven't looked at in detail yet.

Testers welcome!

- Mike
Comment 46 Michael Chudobiak 2007-02-03 18:44:51 UTC
Fixed the crasher bug. I am unaware of any remaining VFS issues.

I will merge vfs-testing into trunk tomorrow, unless I hear otherwise from Paolo.

If you install the vfs-enabled versions, you might need to change your gthumb.desktop file(s) to read:

Exec=gthumb %U

instead of

Exec=gthumb %F

to allow right-clicking launching of VFS URIs from Nautilus.

I'm not sure how changes to gthumb.desktop are supposed to propagate - it is correct in svn data/gthumb.desktop.in.

- Mike
Comment 47 28872d13 2007-02-03 19:42:20 UTC
It´ll be merged by intltool to data/gthumb.desktop automatically when you update svn and run make.
Comment 48 Paolo Bacchilega 2007-02-03 20:01:47 UTC
Hi Mike,

I've tried the vfs-testing branch browsing a ssh folder, and it sometimes dies suddenly.  Looking at the code I suspect this is due to the complexity of the functions called in the image_loader thread, it's likely that some of that functions are not thread safe.  

I think the image_loader thread must be used only to load the local image with the gdk_pixbuf_... function, which is not asynchronous, while all of the other functionalities (such as coping the remote image locally, etc.) can be done in the main thread.
Comment 49 Michael Chudobiak 2007-02-03 20:22:54 UTC
(In reply to comment #47)
> It´ll be merged by intltool to data/gthumb.desktop automatically when you
> update svn and run make.

But do gthumb.desktop files in the user's home directory (e.g., /home/mjc/Desktop/gthumb.desktop) get updated after a "make install"? I don't think they do...

- Mike


Comment 50 28872d13 2007-02-03 20:25:31 UTC
Hmm, I suppose only the "normal" ones in the prefix (e.g. /usr(/local)/applications) get updated. But luckily they´re (nearly) the only ones that matter for e.g. nautilus, the user´s local copy on his desktop doesn´t change the way nautilus runs programmes, at least I hope so...
Comment 51 Michael Chudobiak 2007-02-03 20:38:41 UTC
Paolo,

I haven't seen any crashes like that in my VFS tests using ssh and smb. (The worst I have seen is the extremely slow loading of large folders, presumably because GnomeVFS is making a new ssh connection every single time it reads file info (size, mtime) - but I'm not sure about that. But that is just an annoying delay, not a crash.)

Do you (or anyone else here) think that you can patch the thread problem? I'm not familiar with thread coding, and I don't understand the issues. Someone other than me will have to fix that.

- Mike
Comment 52 Michael Chudobiak 2007-02-04 10:22:39 UTC
Paolo,

It might be worth experimenting with reverting my stack-size patch (bug 310749), to see if that affects vfs stability at all.

- Mike
Comment 53 Michael Chudobiak 2007-02-06 10:36:43 UTC
I removed the prune_cache step from obtain_local_file. That might not have been thread-safe, and it was not really necessary since the cache is pruned at start-up.

- Mike
Comment 54 Michael Chudobiak 2007-02-06 16:08:11 UTC
I have also stopped using f_load_scaled_jpeg on remote jpegs, even though it supports VFS URIs. A local cache copy is made now. This is actually much faster for typical photos.

Paolo, when you have a moment, could you test the branch again to see if it still dies on you?

- Mike
Comment 55 Paolo Bacchilega 2007-02-07 10:09:49 UTC
(In reply to comment #54)
> I have also stopped using f_load_scaled_jpeg on remote jpegs, even though it
> supports VFS URIs. A local cache copy is made now. This is actually much faster
> for typical photos.
> 
> Paolo, when you have a moment, could you test the branch again to see if it
> still dies on you?

Yes it still does.  To reproduce the bug I just scroll the image list while the thumbnails are loaded, it dies every time.  


Comment 56 Michael Chudobiak 2007-02-07 13:10:57 UTC
That's odd. I can't reproduce that problem.

- Mike
Comment 57 Michael Chudobiak 2007-02-07 20:08:58 UTC
Paolo,

I will merge your mime-type changes in from trunk.

- Mike
Comment 58 Paolo Bacchilega 2007-02-07 20:17:25 UTC
ok, maybe it's a totally unrelated problem.  I think it's a good idea to merge the vfs-testing branch with trunk now, then we will see what to do...
Comment 59 Paolo Bacchilega 2007-02-07 20:22:08 UTC
I've noticed that the directory I load with ssh contains some svg images that make gthumb die even when opened locally, even eog dies when I try to open the image with it !  maybe this is a bug in librsvg or whaterver is used to load svg images, so I'd say it's ok to merge the vfs branch :)
Comment 60 Michael Chudobiak 2007-02-07 20:45:40 UTC
That's great news; the crashes aren't all my fault! :-)

Anyway, your mime-type changes cause these compiler warnings:

file-data.c: In function 'file_data_update':
file-data.c:109: warning: passing argument 1 of 'g_free' discards qualifiers from pointer target type
gth-file-list.c: In function 'load_new_list':
gth-file-list.c:1036: warning: passing argument 3 of 'g_hash_table_insert' discards qualifiers from pointer target type

- Mike
Comment 61 Michael Chudobiak 2007-02-08 13:17:37 UTC
VFS support is in svn trunk now, and should appear in the next release.

- Mike