Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 364631 - sys-apps/module-init-tools - would be nice if lsmod could handle very long module names
Summary: sys-apps/module-init-tools - would be nice if lsmod could handle very long mo...
Status: RESOLVED UPSTREAM
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: [OLD] Core system (show other bugs)
Hardware: All Linux
: Normal enhancement (vote)
Assignee: Gentoo's Team for Core System packages
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-04-24 07:01 UTC by André Terpstra
Modified: 2011-04-30 07:45 UTC (History)
0 users

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


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description André Terpstra 2011-04-24 07:01:44 UTC
I use lsmod a lot. In the current version very long module names don't fit in the tabular format, like:

snd_hda_codec          52287  3 snd_hda_codec_hdmi,snd_hda_codec_realtek,snd_hda_intel
snd_hda_codec_hdmi     20329  4 
snd_hda_codec_realtek   273500  1 
snd_hda_intel          18481  4 
snd_hwdep               5262  1 snd_hda_codec

here the name of the module snd_hda_codec_realtek is too long.
Comment 1 SpanKY gentoo-dev 2011-04-25 20:51:13 UTC
the one or two spaces could be tweaked for this specific instance, but i dont think lsmod should pre-scan the whole list and calculate the required alignment across all of them.
Comment 2 André Terpstra 2011-04-26 18:19:24 UTC
Hm if I remember programming well (it is a long time ago) either a valid assumption about the maximum length of module names can be made or long entries should be truncated...
Comment 3 SpanKY gentoo-dev 2011-04-26 19:56:53 UTC
the code already makes an assumption about the length.  but anyone can make a module with a longer name.

a slightly padded display is a lot better than arbitrary truncation.
Comment 4 SpanKY gentoo-dev 2011-04-30 06:46:02 UTC
ok, looking at the code, it basically does:
"%-19s %8s ....."

so if we add brackets to make things clearer, we see:
{1234567890123456789} {12345678}
{snd_hda_codec      } {   52287}
{snd_hda_codec_hdmi } {   20329}
{snd_hda_codec_realtek} {  273500}

the realtek module has already violated the 19 char limit that lsmod uses.  a quick sample of all the modules i have available on my system shows that there are quite a few that are larger than 20 chars, so increasing the 19 only makes it look OK for some modules ... it will still be exceeded by some other module.

since the current code is pretty simple (less than 3KiB of .text on 64bit!), i dont see much value in making this work.  you'd have to scan the file twice, the first would be just to calculate the longest line.

feel free to make your case with the upstream project ... who knows, maybe they'll implement the overly complicated solution.
Comment 5 André Terpstra 2011-04-30 07:45:27 UTC
(In reply to comment #4)
> 
> since the current code is pretty simple (less than 3KiB of .text on 64bit!), i
> dont see much value in making this work.  you'd have to scan the file twice,
> the first would be just to calculate the longest line.
>

I see your point. Didn't know that module name length is unrestricted. My simple suggestion would be to increase the 19 char limit to, say, 30. Of course that's not set in stone. If I knew how to do it I would propose such a patch upstream.