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 341485 - gnome_vfs_directory_visit stops on permission problems
gnome_vfs_directory_visit stops on permission problems
Status: RESOLVED WONTFIX
Product: gnome-vfs
Classification: Deprecated
Component: Docs
2.15.x
Other All
: Normal major
: 2.16
Assigned To: gnome-vfs maintainers
gnome-vfs maintainers
: 343850 (view as bug list)
Depends on:
Blocks:
 
 
Reported: 2006-05-11 23:36 UTC by Mehmet Giritli
Modified: 2008-09-06 19:12 UTC
See Also:
GNOME target: ---
GNOME version: ---



Description Mehmet Giritli 2006-05-11 23:36:21 UTC
Please describe the problem:
It seems that RB no longer recursively searches for files when importing a
single folder.I have a music library structure as follows:
/music/artist/album/file.mp3. But when I import /music, the sudirectories are no
longer recursively searched. However, when I import /music/artist, all files in
all subfolders of /music/artist are correctly found by RB.

Steps to reproduce:
1. Go to import folder
2. Select a folder
3. 

Actual results:
Nothing

Expected results:
Find all files recursively under /music

Does this happen every time?
yes

Other information:
Comment 1 Jonathan Matthew 2006-05-13 22:13:38 UTC
This is kind of confusing.. you're saying that importing /music does not import any subfolders, but importing /music/artist does?

You also imply that this used to work for you.  If so, which version was the last one you used where this worked?
Comment 2 Mehmet Giritli 2006-05-14 00:32:16 UTC
(In reply to comment #1)
> This is kind of confusing.. you're saying that importing /music does not import
> any subfolders, but importing /music/artist does?
> 

OK. I played around this a bit and now I've found some pattern to it. 

/music is a mounted folder. It seems that RB does not like it when in the import folder dialogue, a mounted directory is selected. Otherwise the problem does not exist, even when folders *inside* mounted volumes are selected.

So, to reproduce the problem, 

1. Mount a volume to a folder /mnt/x
2. Go to import folder and select /mnt/x

RB does nothing. But no problems occur when /mnt/x/y is selected.


> You also imply that this used to work for you.  If so, which version was the
> last one you used where this worked?
> 

I think it was broken first when the watching music library with FAM feature was introduced (0.9.2?)
Comment 3 Jonathan Matthew 2006-06-04 13:56:41 UTC
What's probably happening here is that the gnome_vfs_directory_visit call is finding the lost+found directory on your filesystem, then stopping because it can't read the directory.  You could temporarily do 'sudo chmod 755 /music/lost+found' to test this.  What filesystem are you using?  I think some don't have lost+found directories.

If this turns out to be the problem, I'll reassign this bug to gnome-vfs and ask that gnome_vfs_directory_visit either ignore lost+found altogether (probably not a good idea) or at least ignore errors when attempting to access it.  Maybe there should be an option to ignore permission problems entirely.
Comment 4 Alex Lancaster 2006-06-06 01:04:51 UTC
*** Bug 343850 has been marked as a duplicate of this bug. ***
Comment 5 Alex Lancaster 2006-06-06 01:05:50 UTC
Confirming as a bug.
Comment 6 Mehmet Giritli 2006-06-06 10:53:35 UTC
(In reply to comment #3)
> What's probably happening here is that the gnome_vfs_directory_visit call is
> finding the lost+found directory on your filesystem, then stopping because it
> can't read the directory.  You could temporarily do 'sudo chmod 755
> /music/lost+found' to test this.  What filesystem are you using?  I think some
> don't have lost+found directories.
> 
> If this turns out to be the problem, I'll reassign this bug to gnome-vfs and
> ask that gnome_vfs_directory_visit either ignore lost+found altogether
> (probably not a good idea) or at least ignore errors when attempting to access
> it.  Maybe there should be an option to ignore permission problems entirely.
> 

Filesystem is ext3 and now I can confirm that l+f permissions was the problem here. The above suggestion solved the problem. l+f was inaccessible to others except root before the change. Thanks.
Comment 7 Jonathan Matthew 2006-06-06 11:21:13 UTC
OK, thanks for confirming that.  I'm moving this bug to gnome-vfs, since we'll need some changes to gnome_vfs_directory_visit to get this to work.  

The problem is that it stops when it hits a directory it can't read.  When using it on the root of an ext2 or ext3 volume, it never provides any results at all, because the first directory entry is lost+found, which is owned by root and has 0700 permissions.

I can see a few different solutions to this:
- have gnome_vfs_directory_visit completely ignore permission problems
- add a GnomeVFSDirectoryVisitOptions flag to tell it to ignore permission problems
- just ignore permission problems for directories called lost+found

I don't think it's useful to have gnome_vfs_directory_visit stop altogether when it encounters a directory it can't read, except when that directory is the one specified by the caller.  It doesn't return any information on which directory caused the problem.
Comment 8 Christian Neumair 2006-06-06 14:52:20 UTC
The GnomeVFSDirectoryVisitFunc should set *recurse to FALSE and return TRUE if the GnomeVFSFileInfo provides GNOME_VFS_FILE_INFO_FIELDS_ACCESS fields, has a GNOME_VFS_FILE_TYPE_DIRECTORY type and its access field does not have GNOME_VFS_PERM_ACCESS_READABLE, i.e.

static gboolean
my_visit_func (const char *rel_path,
               GnomeVFSFileInfo *info,
               gboolean recursing_will_loop,
               gpointer data,
               gboolean *recurse)
{
  if (info->type == GNOME_VFS_FILE_TYPE_DIRECTORY &&
      (info->valid_fields & GNOME_VFS_FILE_INFO_FIELDS_ACCESS) &&
      !(info->permissions & GNOME_VFS_PERM_ACCESS_READABLE)) {
     /* skip unreadable directories */
     *recurse = FALSE;
     return TRUE;
  }

/* ... your code ... */
}

I'll soon pick up my work on the documentation again and provide a similar example.
Comment 9 Jonathan Matthew 2006-06-18 05:25:32 UTC
I've fixed this in rhythmbox with the above checks (and the addition of the GNOME_VFS_FILE_INFO_GET_ACCESS_RIGHTS flag).  Thanks for your help, Christian.
Comment 10 Christian Neumair 2006-06-18 10:43:35 UTC
Reassining to GnomeVFS docs so that it doesn't get lost.
Comment 11 André Klapper 2008-09-06 19:12:06 UTC
gnome-vfs has been deprecated and superseded by gio/gvfs since GNOME 2.22, hence mass-closing many of the gnome-vfs requests/bug reports. This means that gnome-vfs is NOT actively maintained anymore, however patches are still welcome.

If your reported issue is still valid for gio/gvfs, please feel free to file a bug report against glib/gio or gvfs.

@Bugzilla mail recipients: query for gnome-vfs-mass-close to get rid of these notification emails all together.


General further information: http://en.wikipedia.org/wiki/GVFS 
Reasons behind this decision are listed at http://www.mail-archive.com/gnome-vfs-list@gnome.org/msg00899.html