Bug 14068 - 5a2: hostname -a or --alias and --ip-address not working
Summary: 5a2: hostname -a or --alias and --ip-address not working
Status: RESOLVED FIXED
Alias: None
Product: Mageia
Classification: Unclassified
Component: RPM Packages (show other bugs)
Version: Cauldron
Hardware: All Linux
Priority: Normal normal
Target Milestone: ---
Assignee: Thomas Spuhler
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-09-08 14:39 CEST by Bit Twister
Modified: 2014-09-09 00:59 CEST (History)
2 users (show)

See Also:
Source RPM: net-tools-2.0-0.20140707git.3.mga5
CVE:
Status comment:


Attachments

Description Bit Twister 2014-09-08 14:39:31 CEST
Description of problem:

hostname -a or --alias not working for ip address defined in /etc/hosts

$ grep $(hostname) /etc/hosts
192.168.0.132 wb.home.test wb

$ hostname -a

$

Version-Release number of selected component (if applicable):


How reproducible: Always


Steps to Reproduce:
1. place your node's ip address in /etc/hosts with an alias.
2. hostname -a
3. valid result should be the same as hostname -s

/etc/hosts file should look something like mine
$ cat /etc/hosts
127.0.0.1 localhost.localdomain localhost
192.168.0.132 wb.home.test wb



you can get your ip address with the ifconfig command. Example

$ ifconfig | grep inet | grep broadcast
        inet 192.168.0.132  netmask 255.255.255.0  broadcast 192.168.0.255



Workaround:   use hostname -s or --short


Reproducible: 

Steps to Reproduce:
Comment 1 Bit Twister 2014-09-08 15:13:23 CEST
hostname --ip-address is also broke

$ hostname --ip-address
::1 

$ ifconfig
enp3s0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 192.168.0.132  netmask 255.255.255.0  broadcast 192.168.0.255
        ether a0:f3:c1:00:3c:1e  txqueuelen 1000  (Ethernet)
        RX packets 761  bytes 641981 (626.9 KiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 679  bytes 76888 (75.0 KiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

lo: flags=73<UP,LOOPBACK,RUNNING>  mtu 65536
        inet 127.0.0.1  netmask 255.0.0.0
        loop  txqueuelen 0  (Local Loopback)
        RX packets 1664  bytes 774796 (756.6 KiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 1664  bytes 774796 (756.6 KiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0
Bit Twister 2014-09-08 15:27:56 CEST

Summary: 5a2: hostname -a or --alias not working for ip address => 5a2: hostname -a or --alias and --ip-address not working

Comment 2 David Walser 2014-09-08 18:48:01 CEST
As stated on the dev ml:
https://ml.mageia.org/l/arc/dev/2014-09/msg00347.html

This is probably why Fedora's net-tools 2.0 deletes the *hostname* binaries and they have a separate hostname package. We should import it, include in it a conflicts on net-tools up through the current version-release, add a Requires in basesystem-mininal for hostname, and then drop the hostname commands from net-tools.

CC: (none) => luigiwalser
Assignee: bugsquad => thomas

Comment 3 Felix Miata 2014-09-08 22:03:06 CEST
cf. https://bugzilla.novell.com/show_bug.cgi?id=872264

CC: (none) => mrmazda

Comment 4 David Walser 2014-09-08 22:29:27 CEST
Felix, in response to your comment on the other bugzilla, upstream is net-tools on SourceForge.
Comment 5 Thomas Spuhler 2014-09-08 23:00:33 CEST
(In reply to David Walser from comment #2)
> As stated on the dev ml:
> https://ml.mageia.org/l/arc/dev/2014-09/msg00347.html
> 
> This is probably why Fedora's net-tools 2.0 deletes the *hostname* binaries
> and they have a separate hostname package. We should import it, include in
> it a conflicts on net-tools up through the current version-release, add a
> Requires in basesystem-mininal for hostname, and then drop the hostname
> commands from net-tools.

hostname-3.15 has now been imported to cauldron. There is also a RH patch in it that I don't understand.
I will add a Conflicts: net-tools <= net-tools-2.0-0.20140707git.3

Status: NEW => ASSIGNED

Comment 6 Bit Twister 2014-09-09 00:57:09 CEST
new net-tools removed hostname. :(
I had to manually install the new hostname rpm. 
alias and ip-address switches work

Status: ASSIGNED => RESOLVED
Resolution: (none) => FIXED

Comment 7 David Walser 2014-09-09 00:59:06 CEST
You wouldn't have had to manually install it if you'd waited a few minutes :o) (it's now a require of basesystem-minimal), but yes this is fixed now.  Thank you very much for the report (and confirmation that it fixes the issues).

Note You need to log in before you can comment on or make changes to this bug.