Ticket #10572 (closed defect: obsolete)

Opened 4 years ago

Last modified 12 days ago

readdir fail on a SharedFolder from linux guest and Win7 host

Reported by: vejmarie Owned by:
Priority: major Component: shared folders
Version: VirtualBox 4.1.8 Keywords:
Cc: Guest type: Linux
Host type: Windows

Description (last modified by frank) (diff)


I am running VB 4.1.8 on a Windows 7 system (latest available patch running from Microsoft). The linux guest is running ubuntu server with kernel v 3.0.0-19. I am mount a vbox shared folder called Multimedia which contain videos and images. The folder is properly mounted and I can read file through ls and other shell command.

I wanted to use Mediatomb DLNA application on top of this directory, but the application fail to read properly directory content. A simple readdir in the home directory where the mount point is created is not reporting the mount directory as a dirent, and the application did not detect it at all.

The file permission is also strange, as I can't change them.

drwxrwxrwx 1 www-data www-data 8192 2012-05-16 22:55 Multimedia

is the result of a ls on the mount point.

drwxr-xr-x 8 www-data www-data 4096 2012-05-16 22:55 .
drwxrwxrwx 1 www-data www-data 8192 2012-05-16 22:55 Multimedia
drwxr-xr-x 5 www-data www-data 4096 2012-03-23 19:48 .
drwxr-xr-x 2 www-data www-data 4096 2012-03-21 18:17 Videos
drwxrwx--- 4 www-data www-data 4096 2012-03-13 10:42 ..

is the full ls -lta. And the result of the readdir loop following an opendir and closedir is reporting:


which are standard linux directories.

The mount command is

mount -t vboxsf -o uid=33,gid=33 $shared_folder /usr/share/wordpress/wp-content/uploads/host_$magic/$shared_folder

from a standard bash script.

When I am running the ls -lt command I got a green backlight into my shell like if bash was reporting the directory as a special one.

root@webhost:/usr/share/wordpress/wp-content/uploads/host_540927936# uname -a
Linux 3.0.0-19-generic #33-Ubuntu SMP Thu Apr 19 19:05:57 UTC 2012 i686 athlon i386 GNU/Linux

root@webhost:/usr/share/wordpress/wp-content/uploads/host_540927936# df
Filesystem           1K-blocks      Used Available Use% Mounted on
/dev/sda1              7739864   5576972   1769728  76% /
udev                    247144         4    247140   1% /dev
tmpfs                   101664       332    101332   1% /run
none                      5120         0      5120   0% /run/lock
none                    254156         0    254156   0% /run/shm
Multimedia           488383484 212423392 275960092  44% /usr/share/wordpress/wp-content/uploads/host_540927936/Multimedia
Photos               488383484 212423392 275960092  44% /media/Photos
/dev/loop0              954824     77908    828412   9% /media/Photos.img
none                    954824     77908    828412   9% /usr/share/wordpress/wp-content/uploads/host_540927936/Photos

From Mediatomb source code

dir = opendir(path.c_str());
    if (! dir)
        throw _Exception(_("could not list directory ") +
                        path + " : " + strerror(errno));

    while ((dent = readdir(dir)) != NULL)
        char *name = dent->d_name;
        log_debug("Looking for directory:%s\n",dent->d_name);

The Looking for directory display call never display the Multimedia directory.

Change History

comment:1 Changed 4 years ago by vejmarie

Here is how to reproduce the issue !

#include <sys/types.h>
#include <dirent.h>
#include <errno.h>
#include <stdio.h>
void main()
DIR *dirp;
struct dirent *dp;
dirp = opendir("/usr/share/wordpress/wp-content/host_540927936");
while (dirp) {
    errno = 0;
    if ((dp = readdir(dirp)) != NULL) {
        if (errno != 0) {
            puts("Not found");

Running this code from root directory of the filesystem
give the following results:


And within /usr/share/wordpress/wp-content/uploads/host_540927936 with opendir("/usr/share/wordpress/wp-content/host_540927936"); replaced by opendir(".");


It seems there is an issue with dirent detection...

comment:2 Changed 4 years ago by frank

  • Description modified (diff)

comment:3 Changed 12 days ago by aeichner

  • Status changed from new to closed
  • Resolution set to obsolete

Please reopen if still relevant with a recent VirtualBox release.

Note: See TracTickets for help on using tickets.
ContactPrivacy policyTerms of Use