public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Li Zefan <lizf@cn.fujitsu.com>
To: "Ævar Arnfjörð Bjarmason" <avarab@gmail.com>
Cc: Linux is full of bugs <linux-kernel@vger.kernel.org>,
	Nir Tzachar <nir.tzachar@gmail.com>,
	Michal Marek <mmarek@suse.cz>
Subject: Re: BUG: nconfig doesn't preserve case in its menu display
Date: Tue, 17 Aug 2010 10:45:13 +0800	[thread overview]
Message-ID: <4C69F7B9.2000103@cn.fujitsu.com> (raw)
In-Reply-To: <AANLkTimDmwmC3xDJVXB1LXJzMJTuamCswVeC5v42zU-Q@mail.gmail.com>

于 2010年08月17日 05:04, Ævar Arnfjörð Bjarmason 写道:
> When I do "make nconfig" and go to "General Setup" my "Local version -
> append to kernel release" entry appears as:
> 
>     (-avar-akbar) Local version - append to kernel release
> 
> When I use "make menuconfig" it's:
> 
>     (-Avar-Akbar) Local version - append to kernel release
> 
> And my .config agrees:
> 
>     $ ack -n1 CONFIG_LOCALVERSION .config
>     CONFIG_LOCALVERSION="-Avar-Akbar"
> 
> But when I edit the version string in both menuconfig and nconfig it
> retains the correct casing.
> 
> I briefly searched through the nconfig code, but couldn't find
> anything pertinent to the localversion, so this is probably a more
> general issue.

The bug is in make_hot(). Here is the fix:

=======================

From: LiZefan <lizf@lizf.localdomain>
Date: Tue, 17 Aug 2010 10:35:36 +0800
Subject: [PATCH] nconfig: remember where to start searcing hot key

make_hot() skips '[...]', '<...>' and '(...)', but forgets to remember
where it starts to find the hot key, and then it makes all the letters
before the hot key lower case.

As a result, it shows:

    (-avar-akbar) Local version - append to kernel release
...
<m> Kernel .config support

When it should be:

    (-Avar-Akbar) Local version - append to kernel release
...
<M> Kernel .config support

Reported-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Li Zefan <lizf@cn.fujitsu.com>
---
 scripts/kconfig/nconf.c |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)

diff --git a/scripts/kconfig/nconf.c b/scripts/kconfig/nconf.c
index 2ba71bc..ba5eade 100644
--- a/scripts/kconfig/nconf.c
+++ b/scripts/kconfig/nconf.c
@@ -522,6 +522,7 @@ static int is_hot(int index)
 static int make_hot(char *dest, int len, const char *org, int index)
 {
 	int position = -1;
+	int start;
 	int i;
 	int tmp;
 	int c;
@@ -549,6 +550,7 @@ static int make_hot(char *dest, int len, const char *org, int index)
 	}
 	if (i == org_len)
 		return -1;
+	start = ++i;
 	for (; i < org_len; i++) {
 		if (canbhot(org[i]) && org[i-1] != '<' && org[i-1] != '(') {
 			position = i;
@@ -569,7 +571,7 @@ static int make_hot(char *dest, int len, const char *org, int index)
 	   */
 	/* make org[position] uppercase, and all leading letter small case */
 	strncpy(dest, org, len);
-	for (i = 0; i < position; i++)
+	for (i = start; i < position; i++)
 		dest[i] = tolower(dest[i]);
 	dest[position] = toupper(dest[position]);
 	k_menu_items[index].is_hot = 1;
-- 
1.6.3



  reply	other threads:[~2010-08-17  2:40 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-08-16 21:04 BUG: nconfig doesn't preserve case in its menu display Ævar Arnfjörð Bjarmason
2010-08-17  2:45 ` Li Zefan [this message]
2010-08-17  2:48   ` Li Zefan
2010-08-17  4:01   ` Ævar Arnfjörð Bjarmason
2010-08-17  5:12     ` Li Zefan
2010-08-17  5:21       ` Ævar Arnfjörð Bjarmason
2010-08-17  6:22   ` Michal Marek

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=4C69F7B9.2000103@cn.fujitsu.com \
    --to=lizf@cn.fujitsu.com \
    --cc=avarab@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mmarek@suse.cz \
    --cc=nir.tzachar@gmail.com \
    /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