Ticket #6541 (closed defect: fixed)
Virtual machine name accepts forward slashes and creates malformed vm directories -> fixed as of 16 Feb 2012 for future major releases
Reported by: | Sm0k1n | Owned by: | |
---|---|---|---|
Component: | other | Version: | VirtualBox 3.1.6 |
Keywords: | machine, name, slash | Cc: | |
Guest type: | other | Host type: | other |
Description (last modified by michael) (diff)
An example would be the vm name: "dir/anotherdir". VirtualBox accepts it and this tree and config file comes up:
/user/.VirtualBox/Machines/dir/anotherdir/dir/anotherdir.xml
if I then rename the machine to "hello" this shows up:
/root/.VirtualBox/Machines/dir/anotherdir/dir/hello.xml
This only appears when the machines are created. If I try to rename an existing machine this is what I get:
ERROR: Could not rename the directory '/user/.VirtualBox/Machines/test' to '/root/.VirtualBox/Machines/test/test' to save the settings file (VERR_FILE_NOT_FOUND) Details: code NS_ERROR_FAILURE (0x80004005), component Machine, interface IMachine, callee nsISupports Context: "SaveSettings()" at line 1642 of file VBoxManageModifyVM.cpp
I suspect the latter is the desired functionality.
Note: I have tested this through the GUI of a Windows machine (VBox 3.0.0) and through the CLI and API on a Linux machine (VBox 3.1.6).
Change History
comment:2 Changed 11 years ago by Sm0k1n
While browsing through the API docs I found this for IMachine::name:
... The machine name can contain only characters that are valid file name characters according to the rules of the file system used to store VirtualBox configuration. ... If any of the above limitations are hit, saveSettings will return an appropriate error message explaining the exact reason and the changes you made to this machine will not be saved.
Obviously, this is not happening and needs to be fixed.
comment:3 follow-up: ↓ 4 Changed 10 years ago by john.doe
I think slash handling in VM directories should be corrected. http://img823.imageshack.us/img823/3434/virtualboxvmnameslash.png I don't like that it creates additional subdirectories because of slash in the VM name. Just replace any special characters in the VM directory name with "_" or something else.
comment:4 in reply to: ↑ 3 Changed 9 years ago by michael
- Description modified (diff)
Replying to john.doe:
Just replace any special characters in the VM directory name with "_" or something else.
As of 16 Feb 2012 we do this in the development version of VirtualBox. Any major releases after this date will contain the fix.
I just encountered an effect of this "feature" that is not as minor as I originally thought. I have a few machines with slashes in their names as shown above. When I attempt to powerUp() these machines the webservice crashes and I get this error
In my wrappers file, row 3655 is the waitForOperationCompletion() method of the IProgress class and I call this method on the IProgress object returned by the powerUp() method. This error only occurs when I attempt to start the machines from a local session, the automatic start when opening a remote session seems to work fine.