Bug#65041: hostname: hostname does not allow numeric hostnames
At Fri, 16 Jul 2004 17:06:12 +0200,
Christian Hammers wrote:
> You digged up one old bug.. :)
It's one of old treasures :)
> On 2004-07-16 GOTO Masanori wrote:
> > > /etc/hostname:
> ^^^ should be /etc/hosts of course
>
> > > # hostname -f
> > > 2290
> > > # hostname -f
>
> > You can see that the FQDN is resolved by gethostbyname() when
> > you use "hostname -f".
> Yes, the question was more, is "hostname" supposed to take /etc/hosts
> into consideration (-> bug) or may it only use the DNS (-> no bug)
> if "/etc/nsswitch.conf" says "hosts: files dns".
In that case, hostname command calls gethostbyname(3). Looking at
this bug more. When we give hostnames to gethostbyname(3), it behaves
as follows:
N: numeric, A: alphabet
(1) A+[NA]+ usual case.
(2) N+ all hostname consists of numerical character.
(3) N+[NA]*A+[NA]* first character is numeric, but other includes
more than one alphabet characters.
(1) and (3) is ok. So the question is: when we give numeric strings
to gethostbyname(3) (non-dot form), should this be interpreted not as
host-byte-order IP raw numeric address?
The current glibc (2) is interpreted as IP raw numeric address. I
don't know this is valid interpretation or not. please someone follow
up it.
Regards,
-- gotom
Reply to: