Skip to content

Instantly share code, notes, and snippets.

@delphyne
Created April 10, 2014 19:16
Show Gist options
  • Save delphyne/10413691 to your computer and use it in GitHub Desktop.
Save delphyne/10413691 to your computer and use it in GitHub Desktop.
There is an obscure bug in OSX (described here: http://stevegrunwell.com/blog/quick-tip-troubleshooting-etchosts-issues/) that causes IP resolution for hosts in /etc/hosts take up to 2 minutes (!!!!) if there are more than 10 aliases on a single line. For us at Spredfast, this occurs in our Vagrant environment when we co-locate too many services…
/(vagrant-hostmanager-start|vagrant-hostmanager-end)/{f=f?0:1}f && /[0-9]+\.[0-9]+\.[0-9]+\.[0-9]/ {
if (NF>2) {
out=""
for (i=2;i<=NF;i++) {
out=(out $1 "\t" $(i) "\n")
}
$0=out
}
}1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment