e.g. if package specifies
How does apt/dpkg decide which real package will be installed?
According to this answer on Ask Ubuntu, apt will first try to install any non-virtual packages listed as options instead:
Now, according to sources, apt tries first of satisfying the dependency before trying with virtual packages (i.e., if depends are
firefox | www-browser, checks if any of the packages are installed, then try to install firefox if neither is).
If not, it will simply iterate over the list of packages that provide the virtual one, and install the first one that it can:
If the non-virtual package isn't available, it seems to just iterate over all packages which provides the virtual package, if no other dependencies are broken. Other comments evidence of this behavior are this which leads to GrpIterator::FindPreferredPkg function.