Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!

Bug 179920

Summary: sys-apps/net-tools - ifconfig display truncates iface name
Product: Gentoo Linux Reporter: Roman Gruber <roman.gruber>
Component: Current packagesAssignee: Gentoo's Team for Core System packages <base-system>
Status: RESOLVED FIXED    
Severity: minor CC: bugzilla, mattm
Priority: Low    
Version: unspecified   
Hardware: AMD64   
OS: Linux   
URL: http://forums.gentoo.org/viewtopic-t-561661-highlight-.html
Whiteboard:
Package list:
Runtime testing required: ---
Bug Depends on: 217775    
Bug Blocks:    

Description Roman Gruber 2007-05-26 20:49:43 UTC
Hi

How should I know this line

notebook roman # ifconfig eth1_rename 10.10.10.10

when it shows only half of it when I enter ifconfig -a

eth1_rena Link encap:Ethernet  HWaddr 00:50:04:E9:64:63 
          inet addr:10.2.4.5  Bcast:10.255.255.255  Mask:255.0.0.0
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:0 (0.0 b)  TX bytes:0 (0.0 b)
          Interrupt:20 Base address:0xc000 



Reproducible: Always

Steps to Reproduce:
1.switched from gentoo-sources to suspend2-sources
2.make & make modules_install
3.



Expected Results:  
complete name of device in the output of the command: ifconfig -a
Comment 1 Jakub Moc (RETIRED) gentoo-dev 2007-05-26 22:21:46 UTC
How exactly is this an udev bug?
Comment 2 Kevin Pyle 2007-06-01 03:53:16 UTC
This appears to be a deliberate decision on the part of the net-tools maintainers.  For version 1.60 of sys-apps/net-tools, the truncated line is printed in lib/interface.c:ife_print_long with the statement:

    printf(_("%-9.9s Link encap:%s  "), ptr->name, hw->title);

The line is like this in the source unpacked from /usr/portage/distfiles/net-tools-1.60.tar.bz2.  None of the patches in /usr/portage/distfiles/net-tools-1.60-patches-1.6.tar.bz2 appear to change this line.
Comment 3 Martin Schwier 2007-08-01 17:19:45 UTC
Wouldn't it be better anyway to remove arp, ifconfig, ipmaddr, iptunnel, route, nameif and mii-tool from the base-system and to use iproute2 instead?
Comment 4 SpanKY gentoo-dev 2007-08-01 21:06:15 UTC
heh ... while the idea makes sense (iproute2 being a superior tool to the net-tools package), it just wont fly

`ifconfig` is a "standard" and that'll probably never change

as for whether we think the requested change here (dont truncate interfaces) is worthwhile, i dont think it is ...
Comment 5 Martin Schwier 2007-08-02 08:39:39 UTC
there are linux distributions that already got rid of ifconfig & co (fedora IIRC)
Comment 6 SpanKY gentoo-dev 2007-08-02 09:02:57 UTC
FC6 def still includes ifconfig in the default install, but regardless, ifconfig isnt going anywhere at this time
Comment 7 SpanKY gentoo-dev 2007-08-25 18:17:51 UTC
it's a feature to make the output look nice
Comment 8 Matthew Marlowe (RETIRED) gentoo-dev 2011-09-21 02:47:48 UTC
Guys,

Can we consider reopening this bug?  It was discussed on the puppet mailing list today via a gentoo user and makes gentoo look bad -- apparently gentoo is one of the few distributions that hasn't fixed it. Fedora/RHEL/Debian have apparently applied a patch to handle it properly.

fyi:
http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=405521

Email thread in question has subject "[Puppet Users] facter fails to detect network interfaces with long names"

Thanks.
Comment 9 SpanKY gentoo-dev 2011-09-21 04:48:56 UTC
we've already included the fix long ago (since i migrated us to the upstream cvs tree).  it was reverted because some stupid scripts broke when the output of ifconfig changed its output format.  fix openswan if you want this to go anywhere.
Comment 10 Matthew Marlowe (RETIRED) gentoo-dev 2011-09-21 05:49:53 UTC
Actually, I'm wondering if we should consider bug #179920 (interface names truncated) as a completely different issue than bug #217775 (overall changes to which fields are displayed by default in output by ifconfig).

Bug #179920 is a quick fix and that is to just the limitations of number of characters in the name of an interface that ifconfig prints.  Fedora/RHEL/Debian have all done this.  I'm not sure if this would break any apps.  I assume openswan and other apps work fine on debian, fedora, rhel.

Bug #217775 seems to something that the other distributions haven't addressed, and perhaps openswan also with the consensus being that since we can't depend on ifconfig's format being consistant, all apps should not depend on any output from ifconfig being readable.  

Fixing bug #179920 now might fix several apps, like app-admin/puppet, which have reported problems.  Impact on bug #217775, not sure there is any?

Fixing bug #217775 seems to be more of a long term strategy question....and probably can only be resolved by the upstreams for apps depending on iproute2 long term.  Although, I assume there is nothing to protect us against iproute2 doing its own format changes too.
Comment 11 Matthew Marlowe (RETIRED) gentoo-dev 2011-09-21 05:55:07 UTC
Debians patch..will confirm if rhel/fedora also applied this...

--- interface.c.old     2007-01-07 22:27:17.000000000 +0100
+++ interface.c 2007-01-07 22:27:29.000000000 +0100
@@ -594,7 +594,7 @@

 void ife_print_short(struct interface *ptr)
 {
-    printf("%-5.5s ", ptr->name);
+    printf("%-9s ", ptr->name);
     printf("%5d %-2d ", ptr->mtu, ptr->metric);
     /* If needed, display the interface statistics. */
     if (ptr->statistics_valid) {
@@ -685,7 +685,7 @@
     if (hw == NULL)
        hw = get_hwntype(-1);

-    printf(_("%-9.9s Link encap:%s  "), ptr->name, hw->title);
+    printf(_("%-9s Link encap:%s  "), ptr->name, hw->title);
     /* For some hardware types (eg Ash, ATM) we don't print the
        hardware address if it's null.  */
     if (hw->print != NULL && (! (hw_null_address(hw, ptr->hwaddr) &&
Comment 12 Matthew Marlowe (RETIRED) gentoo-dev 2011-09-21 06:05:04 UTC
fedora patch  -- not sure when and to what it was applied, but listed on redhat bugzilla:

https://bugzilla.redhat.com/attachment.cgi?id=147095&action=diff
Comment 13 SpanKY gentoo-dev 2011-09-21 14:18:11 UTC
not truncating changes the output format and thus possibly breaks scripts.  i'm not going to consider it separate issues.