public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* BUG: nconfig doesn't preserve case in its menu display
@ 2010-08-16 21:04 Ævar Arnfjörð Bjarmason
  2010-08-17  2:45 ` Li Zefan
  0 siblings, 1 reply; 7+ messages in thread
From: Ævar Arnfjörð Bjarmason @ 2010-08-16 21:04 UTC (permalink / raw)
  To: Linux is full of bugs, Nir Tzachar, Michal Marek

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.

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: BUG: nconfig doesn't preserve case in its menu display
  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
  2010-08-17  2:48   ` Li Zefan
                     ` (2 more replies)
  0 siblings, 3 replies; 7+ messages in thread
From: Li Zefan @ 2010-08-17  2:45 UTC (permalink / raw)
  To: Ævar Arnfjörð Bjarmason
  Cc: Linux is full of bugs, Nir Tzachar, Michal Marek

于 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



^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: BUG: nconfig doesn't preserve case in its menu display
  2010-08-17  2:45 ` Li Zefan
@ 2010-08-17  2:48   ` Li Zefan
  2010-08-17  4:01   ` Ævar Arnfjörð Bjarmason
  2010-08-17  6:22   ` Michal Marek
  2 siblings, 0 replies; 7+ messages in thread
From: Li Zefan @ 2010-08-17  2:48 UTC (permalink / raw)
  To: Li Zefan
  Cc: Ævar Arnfjörð Bjarmason, Linux is full of bugs,
	Nir Tzachar, Michal Marek

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 <lizf@lizf.localdomain>

Change it to:

From: Li Zefan <lizf@cn.fujitsu.com>

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: BUG: nconfig doesn't preserve case in its menu display
  2010-08-17  2:45 ` Li Zefan
  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  6:22   ` Michal Marek
  2 siblings, 1 reply; 7+ messages in thread
From: Ævar Arnfjörð Bjarmason @ 2010-08-17  4:01 UTC (permalink / raw)
  To: Li Zefan; +Cc: Linux is full of bugs, Nir Tzachar, Michal Marek

On Tue, Aug 17, 2010 at 02:45, Li Zefan <lizf@cn.fujitsu.com> 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".

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: BUG: nconfig doesn't preserve case in its menu display
  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
  0 siblings, 1 reply; 7+ messages in thread
From: Li Zefan @ 2010-08-17  5:12 UTC (permalink / raw)
  To: Ævar Arnfjörð Bjarmason
  Cc: Linux is full of bugs, Nir Tzachar, Michal Marek

Ævar Arnfjörð Bjarmason wrote:
> On Tue, Aug 17, 2010 at 02:45, Li Zefan <lizf@cn.fujitsu.com> 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 <lizf@cn.fujitsu.com>
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 <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..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




^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: BUG: nconfig doesn't preserve case in its menu display
  2010-08-17  5:12     ` Li Zefan
@ 2010-08-17  5:21       ` Ævar Arnfjörð Bjarmason
  0 siblings, 0 replies; 7+ messages in thread
From: Ævar Arnfjörð Bjarmason @ 2010-08-17  5:21 UTC (permalink / raw)
  To: Li Zefan; +Cc: Linux is full of bugs, Nir Tzachar, Michal Marek

On Tue, Aug 17, 2010 at 05:12, Li Zefan <lizf@cn.fujitsu.com> wrote:

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

Thanks, that works.

Tested-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: BUG: nconfig doesn't preserve case in its menu display
  2010-08-17  2:45 ` Li Zefan
  2010-08-17  2:48   ` Li Zefan
  2010-08-17  4:01   ` Ævar Arnfjörð Bjarmason
@ 2010-08-17  6:22   ` Michal Marek
  2 siblings, 0 replies; 7+ messages in thread
From: Michal Marek @ 2010-08-17  6:22 UTC (permalink / raw)
  To: Li Zefan
  Cc: Ævar Arnfjörð Bjarmason, Linux is full of bugs,
	Nir Tzachar

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

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2010-08-17  6:25 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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
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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox