AlexanderWillner / runMacOSinVirtualBox

Run macOS 10.16 Big Sur (and other versions) in VirtualBox on macOS
MIT License
936 stars 126 forks source link

Consider protecting against another volume named `NO NAME` #61

Closed jsoref closed 5 years ago

jsoref commented 5 years ago

To Reproduce Steps to reproduce the behavior:

  1. Insert an unrelated blank USB stick and let it get formatted with a volume name of NO NAME (I'm not quite sure about the details, but I know I've ended up w/ USB sticks whose volume name is NO NAME -- afaict Disk Utility.app tends to create volumes named Untitled or UNTITLED instead.)
  2. (allow time to pass, i.e. forget you did 1)
  3. use runMacOSinVirtualBox

Expected behavior I'd encourage using hdiutil attach -mountrandom ... or hdutil attach -mountpoint ... to avoid colliding with unrelated disks

You should be able to use:

attach_and_get_volume() {
  hdiutil attach "$@" -mountrandom /Volumes| sed $'$!d;s/.*\t//'
}

VOL=`attach_and_get_volume "$DST_CLOVER.dmg"`

Additional context https://github.com/AlexanderWillner/runMacOSinVirtualBox/blob/238ba21b9d0b3f1eb31c42af737b5039000cf8ab/runMojaveVirtualbox.sh#L221 https://github.com/AlexanderWillner/runMacOSinVirtualBox/blob/238ba21b9d0b3f1eb31c42af737b5039000cf8ab/runMojaveVirtualbox.sh#L222

AlexanderWillner commented 5 years ago

As Clover support (and therefor this line of code) was removed, this issue is probably not valid anymore.

jsoref commented 5 years ago

Possibly, there still appeared to be a place or two where you weren't using random mounts...

AlexanderWillner commented 5 years ago

Not using random mounts but automatically unmounting at the beginning of the relevant functions. However, thanks a lot!