Bug 13543 - weird behavior of /proc/net/dev
Summary: weird behavior of /proc/net/dev
Status: CLOSED WILL_NOT_FIX
Alias: None
Product: Other
Classification: Unclassified
Component: Configuration (show other bugs)
Hardware: All Linux
: P1 low
Assignee: other_configuration@kernel-bugs.osdl.org
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2009-06-15 10:36 UTC by ale ritty
Modified: 2009-07-08 14:39 UTC (History)
2 users (show)

See Also:
Kernel Version: <= 2.6.30
Subsystem:
Regression: No
Bisected commit-id:


Attachments

Description ale ritty 2009-06-15 10:36:52 UTC
If you cat /proc/net/dev you can see:
Inter-|   Receive                                                |  Transmit
 face |bytes    packets errs drop fifo frame compressed multicast|bytes    packets errs drop fifo colls carrier compressed
    lo:     300       6    0    0    0     0          0         0      300       6    0    0    0     0       0          0
 wlan0:38493170   47282    0    0    0     0          0         0  8228940   45380    0    0    0     0       0          0

That in the "lo:" line there is a space between "lo:" and the rx bytes count, but if you exceed an amount of data exchanged, like the "wlan0:" line, this space disappears.
This can cause troubles when trying to automatically extract data from this file.

I experienced this bug on Fedora, mandriva, debian & Ubuntu.
Actually i am using 2.6.30 vanilla, and this weird behavior is still here.
Comment 1 Randy Dunlap 2009-06-17 03:14:55 UTC
The Interface name & the Receive bytes count fields are printed with
format specifiers of "%6s:%8lu".  I.e., a string followed by a colon
followed by a numeric field, but the numeric field may have leading
spaces if it is less that 8 characters in length.

Any program that is reading this should allow for that format.
Comment 2 ale ritty 2009-06-17 11:29:26 UTC
But it isn't preferable insert a blank space in any case between the semicolon and the count?
In many languages without varibale typing this blank space transform the number in a text string.
Comment 3 Alan 2009-07-08 14:39:50 UTC
Its up to the user to parse the data - and the format is historically defined anyway

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