DNS Hostname doesn't match Uname

The hostnames of the machines are box[0-9]+. The /etc/hosts has an entry like this: localhost box[0-9]+

Due to this, the gethostbyname call for the uname results in it returning localhost as the primary hostname, and the uname being a secondary name. This breaks some software I have. I wish it would be fixed.

It would be simple to fix: box[0-9]+ localhost

or changing the uname hostname to localhost.