Shared folder no execute rights (chmod +x does not work)

Discussions related to using VirtualBox on Mac OS X hosts.
Post Reply
diddek
Posts: 3
Joined: 24. May 2008, 20:20

Shared folder no execute rights (chmod +x does not work)

Post by diddek »

Hi,

I succesfully mounted my shared folder

mount -t vboxfs -o defaults,uid=diddek,gid=diddek Public /home/dude/diddek

This gives me r/w - but no exec!!

chmod +x changes nothing

I badly need this (compiling/running tests), could anyone please help?

D
paul
Posts: 2
Joined: 24. Jun 2008, 03:07

Execute permission on a file in a shared folder

Post by paul »

I've installed virtualbox 1.6.2 on MacOSX.
The guest is Linux (Ubuntu, hardy heron).
In a shared folder, I created hello.c.
On the guest, I compiled it, but the execute permission is missing:

vbox:/mac$ gcc hello.c

vbox:/mac$ ls -l
-rw------- 1 paul dialout 6362 2008-06-18 10:26 a.out
-rw------- 1 paul dialout 79 2008-06-18 10:13 hello.c

Manually setting the x bit does not work:

vbox:/mac$ chmod +x a.out

vbox:/mac$ ls -l
-rw------- 1 paul dialout 6362 2008-06-18 10:26 a.out
-rw------- 1 paul dialout 79 2008-06-18 10:13 hello.c

However, running the "chmod +x a.out" on the mac does properly
change the mode and allows the guest to run the binary:

vbox:/mac$ ls -l
-rwx--x--x 1 paul dialout 6362 2008-06-18 10:26 a.out
-rw------- 1 paul dialout 79 2008-06-18 10:13 hello.c

vbox:/mac$ ./a.out
Hello from C

Is this a know issue (has a bug been filed?)

thanks,
Paul
diddek
Posts: 3
Joined: 24. May 2008, 20:20

bug report

Post by diddek »

Not by me - I have exactly the same setup; osx host + heron guest (linux)

The following:

#include <iostream>

in main() {
std::cout << "Hello from C++" << std::endl;
return 0;
}

g++ -o test test.cpp

does not give an executable 'test' .

cmod +x in heron does not work, in osx (the host) it *does* work; after which 'test' is executable in heron too...

I think we should file a bug.

Best, Dirk
paul
Posts: 2
Joined: 24. Jun 2008, 03:07

Bug filed

Post by paul »

Ticket #1776
ejtttje
Posts: 6
Joined: 2. Aug 2008, 20:42

workaround

Post by ejtttje »

I posted this in the ticket, but cross posted here for search engines to pick up... I have edited the vboxvfs kernel module with an ugly workaround for doing compilation/development in a shared folder (the joys of open source! Otherwise I'd be screwed on monday! :) )

How to:
  1. mount the VBoxGuestAdditions.iso (e.g. /media/cdrom0)
  2. mkdir vbox && cd vbox && /media/cdrom0/VBoxLinuxAdditions.run --tar -xf
  3. edit module/vboxvfs/utils.c, change line 96 "mode |= mode_set (IXUSR);" to "mode |= S_IXUSR;"
    (note addition of "S_" prefix... basically, always set executable flag)
  4. sudo ./install.sh vfs-module
  5. to clean up: cd .. && rm -rf vbox
This sets the executable flag in the guest only (mode 700) for all shared files — the host still always gets mode 500 for newly created files. Hopefully a dev can make a proper fix. (slight improvement: set executable flag on new file creation, and keep file permissions in sync so pre-existing non-executables in the host don't show up as executable in the guest)

But at least this lets me do development within a shared directory...[/code]
Post Reply