this is a convoluted one so bear with me. I have a perl script that is located on a Windows VirtualBox guest. I want to call this script from the Linux host and have it read a shared folder from the host. The reading of the folder fails.
On the host I call this script and it gives me the following output:
host:~/$ ./script.pl /nfs/nasi/temp [2014-04-02 10:50:55] Uploading file records to localhost [2014-04-02 10:50:55] Running VirtualBox for Kaspersky fatal: opendir(E:\nasi\temp) failed: No such file or directory [2014-04-02 10:50:56] Uploading malware samples data to localhost host:$The script converts the argument /nfs/nasi/temp to E:\nasi\temp and calls the script using the following command:
/usr/bin/VBoxManage guestcontrol <guest> execute --image "C:\strawberry\perl\bin\perl.exe" --username <user> --password <pass> --wait-stdout --wait-stderr --wait-exit -- "C:\antivirus\kaspersky.pl" "E:\nasi\temp"When I run this same script using the same option from the guest directly however I get the following:
C:\antivirus>C:\strawberry\perl\bin\perl.exe C:\antivirus\kaspersky.pl E:\nasi\temp [2014-04-02 10:54:19] Running Kaspersky Antivirus [2014-04-02 10:54:20] Parsing Kaspersky report [2014-04-02 10:54:20] Uploading Kaspersky results to 10.0.0.1 C:\antivirus>But wait, it gets weirder. When instead of providing the shared directory E:\ I instead point it to C:\ it has no problem reading the directory and just happily keeps going. So the error only shows up when I run the command from the host through VirtualBox and point it to the share.
Here is the relevant code:
Code: Select all
sub createSamplesMap {
opendir( my $dh, $ARGV[0] ) or die "fatal: opendir($ARGV[0]) failed: $!\n";
my @files = readdir( $dh );
foreach my $file ( @files ) {
if (! -d $file ) {
...
}
}
closedir($dh);
}
Code: Select all
my @files = <$ARGV[0]\\*>;
my @files = glob( $ARGV[0] . '\\*' );
Windows 7, Ubuntu 12.04.04, VirtualBox 4.2.16r86992, linux perl v5.14.2, Windows Strawberry perl v5.18.2
thnx
Jurgen
crosspost: There is a post at stackoverflow but the forum won't let me add urls: /questions/22807376/virtualbox-perl-shared-folder-fail