From mboxrd@z Thu Jan 1 00:00:00 1970 From: John Darrington Subject: Re: Contents of /etc/hosts Date: Sat, 8 Oct 2016 16:19:23 +0200 Message-ID: <20161008141923.GB5979@jocasta.intra> References: <20161005183147.GA32276@jocasta.intra> <87zimi5z5h.fsf@gnu.org> <20161006005710.GA2352@jocasta.intra> <57F62269.4090100@goebel-consult.de> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:47181) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bssTK-0002Du-DW for guix-devel@gnu.org; Sat, 08 Oct 2016 10:19:31 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bssTF-0004DL-82 for guix-devel@gnu.org; Sat, 08 Oct 2016 10:19:29 -0400 Received: from de.cellform.com ([88.217.224.109]:57252 helo=jocasta.intra) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bssTF-0004Cx-06 for guix-devel@gnu.org; Sat, 08 Oct 2016 10:19:25 -0400 Content-Disposition: inline In-Reply-To: <57F62269.4090100@goebel-consult.de> List-Id: "Development of GNU Guix and the GNU System distribution." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-devel-bounces+gcggd-guix-devel=m.gmane.org@gnu.org Sender: "Guix-devel" To: Hartmut Goebel Cc: guix-devel@gnu.org On Thu, Oct 06, 2016 at 12:07:37PM +0200, Hartmut Goebel wrote: Am 06.10.2016 um 02:57 schrieb John Darrington: > 127.0.0.1 localhost > ::1 localhost > 127.0.0.1 gambrinus > ::1 gambrinus > > Or am I missing something? > > Hmm. I have never seen it done this way elsewhere, and I really wonder how some > services will react if they discover that 127.0.0.1 is not called "localhost"? > Or that one address is known by two names. I think it possible they might > assume a security breach and refuse to work. This should not be a problem. One could always add several entries for the same IP-address. And "getent hosts 127.0.0.1" will return the first entry in /etc/hosts AFAIKT. I started digging through the man pages, but did not finish. It's a deep maybe recursive mess of documentation where nothing is said about Maybe we need to refer to the gethostbyname(2) and gethostbyname(3) documentation, which both are listed in "man hostname". Indeed it is a mess. And be careful there are several versions of "hostname" program in circulation. One of them explicitly says that 127.0.1.1 canoncal-name.example.com canonical-name Is the recommended way to set the canoncial name and fqdn * gethostbyname(2) [1], uses uname[2], which returns what ever has been set with sethostname (AFAICT) and always returns a single string. That is also my understanding. * gethostbyname(3) [3] returns a structure capable to hold an name, several aliases, and several addresses. Yes. Nevertheless my conclusion is that any program should be able to handle any ip-address and and hostname and must not rely on any assumtion regarding these. (Exept perhaps to assume "localhost" is defined.) Well behaved programs should not make such assumptions. But I don't think we should assume that all programs behave well . Anyway I think we need to change what we currently have because it breaks "hostname -f" (and possibly other things too) J' -- Avoid eavesdropping. Send strong encrypted email. PGP Public key ID: 1024D/2DE827B3 fingerprint = 8797 A26D 0854 2EAB 0285 A290 8A67 719C 2DE8 27B3 See http://sks-keyservers.net or any PGP keyserver for public key.