Bug #12615 mysql-test-run.pl aborts if host name can't be fully resolved
Submitted: 17 Aug 2005 6:10 Modified: 18 Aug 2005 19:56
Reporter: Lenz Grimmer Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: Compiling Severity:S3 (Non-critical)
Version:4.1 OS:Any (Any)
Assigned to: Kent Boortz CPU Architecture:Any

[17 Aug 2005 6:10] Lenz Grimmer
Description:
On our Linux/s390 build host, the Perl version of mysql-test-run fails to run with the following error:

$ perl ./mysql-test-run.pl
mysql-test-run: *** ERROR: Couldn't resolve etpglb0 :

I have observed the same behaviour when doing RPM builds with running the test suite in a chroot() environment on Linux.

It seems like mtr_full_hostname() in lib/mtr_misc.pl aborts, if it fails to resolve the full hostname:

[SNIP]
# We want the fully qualified host name and hostname() may have returned
# only the short name. So we use the resolver to find out.

sub mtr_full_hostname () {

  my $hostname=  hostname();
  if ( $hostname !~ /\./ )
  {
    my $address=   gethostbyname($hostname)
      or mtr_error("Couldn't resolve $hostname : $!");
    my $fullname=  gethostbyaddr($address, AF_INET);
    $hostname= $fullname if $fullname;
  }
  return $hostname;
}
[SNIP]

The Shell version just runs "hostname" and goes with whatever it receives, so it does not abort in case the host name is not a FQDN.

How to repeat:
Run mysql-test-run.pl on a host where the host name does not resolve to a FQDN.

Suggested fix:
Don't abort with an error at this point but rather try to cope with the host name by itself.
[17 Aug 2005 12:40] Bugs System
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:

  http://lists.mysql.com/internals/28386
[18 Aug 2005 19:56] Sergei Golubchik
fixed in 4.1.14