Bug 197353

Summary: /proc/net/dev columns don't line up
Product: Networking Reporter: Dan Jacobson (jidanni)
Component: OtherAssignee: Stephen Hemminger (stephen)
Status: RESOLVED WILL_NOT_FIX    
Severity: enhancement    
Priority: P1    
Hardware: All   
OS: Linux   
Kernel Version: 4.13 Tree: Mainline
Regression: No

Description Dan Jacobson 2017-10-22 21:44:35 UTC
Some columns don't line up:
$ cat /proc/net/dev
Inter-|   Receive                                                |  Transmit
 face |bytes    packets errs drop fifo frame compressed multicast|bytes    packets errs drop fifo colls carrier compressed
    lo:  520401    1604    0    0    0     0          0         0   520401    1604    0    0    0     0       0          0
wlp2s0b1:       0       0    0    0    0     0          0         0        0       0    0    0    0     0       0          0
enp1s0: 149899665  108492    0    0    0     0          0         0  6876084   68889    0    0    0     0       0          0
  ppp0: 147510463  108431    0    0    0     0          0         0  5352451   68759    0    0    0     0       0          0
Comment 1 Stephen Hemminger 2017-10-23 14:41:07 UTC
The file /proc/net/dev is really not intended for direct user consumption in modern Linux.

The columns are printed with a printf format that was wide enough in the days of 32 bit systems (%8llu). With 64 bit systems the full width of a statistic can be bigger than 8.

This can't be fixed because it might break existing apps that are parsing the output.