Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 183071 - SuperKaramba: network sensor doesn't work if the interface name doesn't have leading whitespace
Summary: SuperKaramba: network sensor doesn't work if the interface name doesn't have ...
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: [OLD] KDE (show other bugs)
Hardware: All Linux
: High normal
Assignee: Gentoo KDE team
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2007-06-24 18:10 UTC by Evan Teran
Modified: 2007-06-25 06:09 UTC (History)
0 users

See Also:
Package list:
Runtime testing required: ---


Attachments
one character fix, but appears to do the job (superkaramba_network_sensor.patch,672 bytes, patch)
2007-06-25 03:38 UTC, Evan Teran
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Evan Teran 2007-06-24 18:10:30 UTC
In superKaramba, network sensor doesn't work if the interface name doesn't have leading whitespace. Basically line 115 in networksensor.cpp has a small flaw in it which prevents the "in/out" from properly being read.

As you can see form the regular expression:

QRegExp rx( "\\W+"+device+":(\\d+)(?:\\D+\\d+){7}\\D+(\\d+)", false);

it is expecting at least one whitespace character, however for longer device names, there isn't a leading whitespace.

changing the line to this seems to fix it:

QRegExp rx( "\\W*"+device+":(\\d+)(?:\\D+\\d+){7}\\D+(\\d+)", false);

which basically changes it from "1 or more whitespace" to "0 or more whitespace", i think this is more appropriate.

Also, I feel that on Linux builds should attempt to use the sys file system to get this information as it is broken up in a manner which is trivial to parse:

the directory:

/sys/class/net/<device>/ has several files describing just about everything needed about a given interface, and /sys/class/net/<device>/statistics has several files which have all the necessary stats on an individual basis (no need to parse, just read the file).

I have reported this bug on bugs.kde.org (https://bugs.kde.org/show_bug.cgi?id=138696) more than 6 months ago, but to be honest, noone seems to care. I am hoping at least a patch would make it into the gentoo ebuilds.

Evan Teran 

Reproducible: Always

Steps to Reproduce:
1. create a long network device name for example: wireless0
2. Use any superkaramba widget which uses the network sensor in/out 
3. It will always read no traffic
Actual Results:  
doesn't show traffic

Expected Results:  
should show the traffic
Comment 1 Evan Teran 2007-06-24 18:15:30 UTC
The Bug still exists in the 3.5.7 source, the line in question is now: 111 in the same file.

Evan Teran
Comment 2 Wulf Krueger (RETIRED) gentoo-dev 2007-06-24 19:38:23 UTC
 (In reply to comment #1)
> The Bug still exists in the 3.5.7 source, the line in question is now: 111 in
> the same file.

Usually, we don't include patches for things upstream should fix. In this case, though, I propose a deal: You make me a nice little patch for that line and I'll add it. :-)
Comment 3 Evan Teran 2007-06-25 03:37:25 UTC
Deal :)

I'm attaching a very simple patch which does exactly as I described.

Evan Teran

Comment 4 Evan Teran 2007-06-25 03:38:03 UTC
Created attachment 123005 [details, diff]
one character fix, but appears to do the job
Comment 5 Wulf Krueger (RETIRED) gentoo-dev 2007-06-25 06:09:18 UTC
Thanks, Evan! I've kept my part of the bargain ;-) and just checked in your patch to CVS for both superkaramba and kdeutils 3.5.7. 

No version bump as the change is rather small and nobody seems to have noticed the bug since KDE 3.5.5 at least but you.