List:Internals« Previous MessageNext Message »
From:Mark Leith Date:September 3 2007 9:43am
Subject:Re: --with-port=6667 should trump
View as plain text  
Hi Eric,

Eric Prud'hommeaux wrote:
> sql/mysqld.cc:1361 (5.1.21-beta tarball) allows /etc/services to trump
> $(configure --with-tcp-port=3307) by setting mysqld_port to the configure
> option first, and then overriding it with the /etc/services entry. Why?
>
> I expect that very few folks control that from /etc/services, and we can
> allow them to continue by compiling with --with-tcp-port=0 checking first
> if mysqld_port is 0 (patch attached).
>   if (!mysqld_port && (serv_ptr= getservbyname("mysql", "tcp")))
>
>
> related discussion on #mysql-dev at 2007-09-02T21:28:41Z:
>
> 21:28:41Z <ericP> set_ports() seems a little twisted:
> 21:28:43Z <ericP>     mysqld_port= MYSQL_PORT;
> 21:28:43Z <ericP>     if ((serv_ptr= getservbyname("mysql", "tcp")))
> 21:28:43Z <ericP>       mysqld_port= ntohs((u_short) serv_ptr->s_port); /*
> purecov: inspected */
> 21:29:39Z <ericP> so if you $(configure --withe-port=3307), you'll get 3307 
> 	  	  *unless* you have a /etc/services
> 21:30:02Z <Toad> yea does seem backwards
> 21:30:15Z <ericP> it's clever code, but i think the config option should 
> 	  	  always trump
> 21:30:24Z <ericP> i.e. no reason to consult /etc/services
> 21:30:55Z <Toad> I wonder if anyone ever uses /etc/services to try to set 
> 	  	 their service ports
> 21:30:56Z <ericP> *maybe* if the user did --with-port=0...
> 21:30:58Z <Toad> I know I don't expect that to happen
> 21:31:03Z -!- weigon__ is now known as weigon
> 21:31:59Z <ericP> just in case, i guess i'll motion for 
> 	  [[if (!mysql_port && (serv_ptr= getservbyname("mysql", "tcp")))...]]
>   

Indeed, this has been reported as a bug a couple of times (I reported 
one which I found as a duplicate of this bug 
http://bugs.mysql.com/bug.php?id=15327).

It's in the works now (couple of patches already).

Cheers,

Mark

-- 
Mark Leith, Senior Support Engineer
MySQL AB, Worcester, England, www.mysql.com
Are you MySQL certified?  www.mysql.com/certification

Thread
--with-port=6667 should trumpEric Prud'hommeaux3 Sep
  • Re: --with-port=6667 should trumpMark Leith3 Sep