Opened 5 years ago
#18822 new defect
VMs with name lengths greater than 64 characters abort on start when using Pulseaudio. Have root cause and fix option <Regression>
Reported by: | J_F | Owned by: | |
---|---|---|---|
Component: | host support | Version: | VirtualBox 5.2.26 |
Keywords: | name length pulseaudio regression | Cc: | |
Guest type: | all | Host type: | Linux |
Description
If a VM has a name length greater than 64 characters, and is using Pulseaudio, it will abort on startup with "VERR_CFGM_NOT_ENOUGH_SPACE" being thrown.
The root cause is: Inside "src/VBox/Devices/Audio/DrvHostPulseAudio.cpp", in "struct DRVHOSTPULSEAUDIO", there is "char szStreamName[64];".
This "szStreamName" only appears to be used by Pulseaudio for display purposes, such as when running "pavucontrol". The comments above "szStreamName" read:
- The stream (base) name; needed for distinguishing
- streams in the PulseAudio mixer controls if multiple
- VMs are running at the same time. */
So, when "int rc2 = CFGMR3QueryString(pCfg, "StreamName", pThis->szStreamName, sizeof(pThis->szStreamName));" is called inside of the "drvHostPulseAudioConstruct" function in that file, "CFGMR3QueryString" throws the above error, as String.cb is greater than 64 characters.
I have a local patch which is a hacky solution and not good enough for you guys -- it checks if "StreamName" is passed in in each call to "CFGMR3QueryString", and then does the following if it is too long -- but I got it to work just fine by ellpisizing ("...") at the middle of the string like so, creating a 64 character string like Pulseaudio requires, which shows up correctly in "pavcontrol":
- First 30 chracters of the VM name
- 3 chracters for "..."
- Last 30 chracters of the VM name
- 1 byte for '\0'
This is 64 characters total. In my patch, I simply change the contents of String.psz and String.cb, which is probably not the correct way to do it.
I would strongly suggest ellipsizing in the middle like this, since the first 64 characters of multiple VM clones could easily be the same, usually the last few characters/words are what is different when there are many clones/different versions of a VM running. Another option could be the number them, but ellipsizing is probably better for the user.
This limitation did not exist when using Ubuntu 18.04/16.04, so I have marked it as a regression. I looked at the latest 6.0 source code, and it looks like this bug will still be present there.
I have many VMs with long and descriptive names past 64 characters, and I know others do too, that is a very useful feature to tell them apart at a glance (especially when using many clones, where checking each description is not realistic). Please fix this for us users who let our VM names get out of control! It really helps workflow to be able to use such long names.
Reproducible: Always