linux-modules.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: md@Linux.IT (Marco d'Itri)
To: linux-modules@vger.kernel.org
Subject: Bug#782692: kmod: spurious spaces in lsmod output
Date: Thu, 16 Apr 2015 12:56:12 +0200	[thread overview]
Message-ID: <20150416105612.GA3204@bongo.bofh.it> (raw)

----- Forwarded message from Santiago Vila <sanvila@unex.es> -----

From: Santiago Vila <sanvila@unex.es>
To: submit@bugs.debian.org
Subject: Bug#782692: kmod: spurious spaces in lsmod output

Package: kmod
Version: 18-3
Severity: minor

While using "localyesconfig" to build a custom kernel I noticed that lsmod
output now has trailing spaces when the list of "Used by" modules is empty.

The following (untested but trivial) patch should fix it. It just delays
the space to the point where we are sure that there are more things to print.

Thanks.

diff --git a/tools/lsmod.c b/tools/lsmod.c
index e953c7e..c1bab7f 100644
--- a/tools/lsmod.c
+++ b/tools/lsmod.c
@@ -64,15 +64,17 @@ static int do_lsmod(int argc, char *argv[])
 		struct kmod_list *holders, *hitr;
 		int first = 1;
 
-		printf("%-19s %8ld  %d ", name, size, use_count);
+		printf("%-19s %8ld  %d", name, size, use_count);
 		holders = kmod_module_get_holders(mod);
 		kmod_list_foreach(hitr, holders) {
 			struct kmod_module *hm = kmod_module_get_module(hitr);
 
 			if (!first)
 				putchar(',');
-			else
+			else {
+				putchar(' ');
 				first = 0;
+			}
 
 			fputs(kmod_module_get_name(hm), stdout);
 			kmod_module_unref(hm);

----- End forwarded message -----

-- 
ciao,
Marco

             reply	other threads:[~2015-04-16 11:37 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-04-16 10:56 Marco d'Itri [this message]
2015-04-16 11:48 ` Bug#782692: kmod: spurious spaces in lsmod output Lucas De Marchi

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20150416105612.GA3204@bongo.bofh.it \
    --to=md@linux.it \
    --cc=linux-modules@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).