Subject: BUG: nconfig doesn't preserve case in its menu display

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.


2010-08-17 02:40:37

by Li Zefan

[permalink] [raw]
Subject: Re: BUG: nconfig doesn't preserve case in its menu display

于 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 <[email protected]>
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 <[email protected]>
Signed-off-by: Li Zefan <[email protected]>
---
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

2010-08-17 02:43:21

by Li Zefan

[permalink] [raw]
Subject: Re: BUG: nconfig doesn't preserve case in its menu display

Li Zefan wrote:
> 于 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 <[email protected]>

Change it to:

From: Li Zefan <[email protected]>

Subject: Re: BUG: nconfig doesn't preserve case in its menu display

On Tue, Aug 17, 2010 at 02:45, Li Zefan <[email protected]> wrote:
> 于 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:

That fixes the issue with strings inside (), but now e.g. "General
setup" on the main screen will be "GEneral setup".

2010-08-17 05:07:32

by Li Zefan

[permalink] [raw]
Subject: Re: BUG: nconfig doesn't preserve case in its menu display

Ævar Arnfjörð Bjarmason wrote:
> On Tue, Aug 17, 2010 at 02:45, Li Zefan <[email protected]> wrote:
>> 于 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:
>
> That fixes the issue with strings inside (), but now e.g. "General
> setup" on the main screen will be "GEneral setup".
>

Oops, I made a mistake. Try this one:

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

From: Li Zefan <[email protected]>
Date: Tue, 17 Aug 2010 13:08:13 +0800
Subject: [PATCH v2] 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 <[email protected]>
Signed-off-by: Li Zefan <[email protected]>
---
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..0bb7810 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


Subject: Re: BUG: nconfig doesn't preserve case in its menu display

On Tue, Aug 17, 2010 at 05:12, Li Zefan <[email protected]> wrote:

> Oops, I made a mistake. Try this one:

Thanks, that works.

Tested-by: Ævar Arnfjörð Bjarmason <[email protected]>

2010-08-17 06:25:42

by Michal Marek

[permalink] [raw]
Subject: Re: BUG: nconfig doesn't preserve case in its menu display

On 17.8.2010 04:45, Li Zefan wrote:
> 于 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:

Nir removed the hotkeys feature in completely, can you try if the
problem persists in the for-next branch of
git://git.kernel.org/pub/scm/linux/kernel/git/mmarek/kbuild-2.6.git ?
The commit is a72f3e2.

Michal