Bug 3590 - (int-87586) gnomevfs code enables infinite loop
(int-87586)
: gnomevfs code enables infinite loop
Status: RESOLVED INVALID
Product: Desktop platform
gnomevfs
: 4.1.1 (4.2008.30-2)
: All Maemo
: Medium major (vote)
: ---
Assigned To: Kimmo Hämäläinen
: gnomevfs-bugs
: http://mxr.maemo.org/diablo-20080625/...
: moreinfo
:
: 3588
  Show dependency tree
 
Reported: 2008-08-15 17:19 UTC by timeless
Modified: 2009-06-30 17:56 UTC (History)
4 users (show)

See Also:


Attachments


Note

You need to log in before you can comment on or make changes to this bug.


Description timeless (reporter) 2008-08-15 17:19:33 UTC
sample code:

get_deadlocked (GnomeVFSURI *uri)
{
        GnomeVFSDirectoryHandle *handle;
        GnomeVFSResult           result;
        GnomeVFSFileInfo        *file_info;

        result = gnome_vfs_directory_open_from_uri (
&handle,
uri,
GNOME_VFS_FILE_INFO_FORCE_FAST_MIME_TYPE
        );
        if (result != GNOME_VFS_OK) {
                return NULL;
        }
        file_info = gnome_vfs_file_info_new ();

        while (1) {
                result = gnome_vfs_directory_read_next (
handle,
file_info
                );
                if (result == GNOME_VFS_ERROR_EOF) {
                        break;
                }
                else if (result != GNOME_VFS_OK) {
                        /* Couldn't read. */
                        continue;
...

the problem case is that gnomevfs could fail because there are too many open
files. if it fails, it doesn't increment a counter such that it could reach
EOF, but instead should fail exactly the same way the next time.
Comment 1 clover.pengfangjun 2008-08-18 10:23:57 UTC
read one ,close one
Comment 2 Jianjun Yu 2008-09-01 10:07:57 UTC
Can you give more information about that!Is it your test code ? 
If it's your test code. you could implement this function to use another way.
For example, you could read a file .and then close it.
Comment 3 Andre Klapper maemo.org 2008-09-01 17:40:42 UTC
Jianjun Yu, Fangjun.Peng: Please avoid repeating what is already clear, or
non-understandable comments like "read one, close one". This helps nobody and
just adds clutter and noise here.
If you are confused then please don't comment. Thanks.
Comment 4 Andre Klapper maemo.org 2008-11-11 15:33:39 UTC
According to Richard this is "not a bug in gnomevfs but in the app code."
Comment 5 timeless (reporter) 2008-11-11 17:28:06 UTC
ask Richard to explain precisely which line in the cited code is buggy (by
citing API documentation indicating what should be done in response to a given
return value). That code (plus a sufficiently large number of open file
handles) is sufficient to create such a loop. If necessary I'm sure we could
write such a program.
Comment 6 Andre Klapper maemo.org 2008-11-12 15:43:27 UTC
Please provide a full self contained test case then that shows the issue then,
not just a snippet, including what kind of input is used to reproduce (like the
URIs and how the filesystem looks, i.e. symlinks, "weird" filenames/paths with
characters that could trigger any escaping bugs, etc).
Comment 7 timeless (reporter) 2008-12-16 14:30:17 UTC
so, i actually did some testing with this (well, remotely), all sorts of things
blew up amusingly. and i was supposed to get someone to file bugs against
something. to be honest- I don't care enough. after all gnomevfs is EOLd.

mostly while we use the gnomevfs code, we need to make sure that the consumers
don't implement get_deadlocked (which was based on the backup code).
Comment 8 Andre Klapper maemo.org 2008-12-16 14:39:36 UTC
(In reply to comment #7)
> after all gnomevfs is EOLd.

that's true for upstream, unfortunately it's not true for Fremantle as far as I
know, even though it will ALSO include gvfs.
Comment 9 Andre Klapper maemo.org 2009-03-24 15:41:25 UTC
(In reply to comment #6)
> Please provide a full self contained test case then that shows the issue then

-> moreinfo
Comment 10 Andre Klapper maemo.org 2009-06-30 17:56:09 UTC
Closing this bug report as no further information has been provided. Please
feel free to reopen this bug if you can provide the information asked for.
Thanks!