Opened 14 years ago
Last modified 12 years ago
#9527 new defect
'Shared Folders' returning incorrect file order to Win API
Reported by: | solanum | Owned by: | |
---|---|---|---|
Component: | other | Version: | VirtualBox 4.1.2 |
Keywords: | Cc: | ||
Guest type: | Windows | Host type: | Linux |
Description
I am using some proprietary software on Windows XP guest under Linux host. This software (Magpie from MEA in Australia) extracts certain data from certain binary files output from a datalogger and collates it in a database. When run in WinXP under VirtualBox with the data stored in a VirtualBox 'shared folder' mounted as a Windows network drive it loses data. When the data is stored within the VirtualBox 'disk' it works fine and it also works fine when the data is on a real Windows network share.
I have spoken to the developer of the software and it turns out that it is using the Windows API calls 'FindFirstFile' and 'FindNextFile'. The virtualbox "pseudo-network redirector" driver in WinXP is not returning files in the same order as either windows or a windows network share (which it is pretending to be) does. This leads to the data problems within the software. See attached screenshot for file dialog box with incorrectly ordered files. When the data are stored on the windows virtual disk or on a windows share the files are in date order.
Interestingly, when run under WINE the file order in this dialog is exactly the same as when run using Virtualbox and a 'shared folder'. I conclude from this that when the above API calls are run against a virtualbox 'shared folder' it is presenting the files as they are presented to it by my linux host, not in the order that windows would present them.
Unfortunately, I am not a developer and have no idea how linux chooses to present it's files or anything further about these API calls...
Attachments (2)
Change History (3)
by , 14 years ago
Attachment: | snapshot7.jpeg added |
---|
by , 12 years ago
comment:1 by , 12 years ago
Hi, I can confirm that this is a problem.
I stumbled about it when testing ruby scripts on XP (in VirtualBox) that still showed the same wrong sorting as on linux. It seems to be due to incorrect handling of unsorted results of the 'glob' function (Ruby uses that wrongly, I don't know for VirtualBox).
As for what I researched, one can NOT assume that the posix 'glob' function returns sorted filenames. Though it seems OS X users get sorted results, the order can also be in ASCII order or depending on the system's locale or out of order (according to the man page). As far as I found it is the shell's job to sort results of glob.
The attached image shows that file sorting is wrong on the network drive (= ext4 file system) but correct when copied to the virtual NTFS file system. Gnome-terminal and cmd.exe in Wine don't show this issue.
file sorting from 'dir' command in VirtualBox on (linux) network drive, windows drive, 'ls' on linux, 'dir' in Wine