DNS Hostname doesn't match Uname

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

127.0.0.1 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:

127.0.0.1 box[0-9]+ localhost

or changing the uname hostname to localhost.