Bug 43067

Summary: drivers/mtd/nand/Kconfig contains Unicode character 'É' (0xc389) while scanner works in 8 bit mode
Product: Other Reporter: Martin Walch (walch.martin)
Component: ConfigurationAssignee: other_configuration (other_configuration)
Status: RESOLVED CODE_FIX    
Severity: low CC: briannorris, rdunlap
Priority: P1    
Hardware: All   
OS: Linux   
Kernel Version: 2.x, 3.x Subsystem:
Regression: No Bisected commit-id:
Attachments: screenshot of xconfig, showing the broken characters
menu is broken in make nconfig
what the above screenshot looks like without the utf-8 character
hack fix, to make nconfig use the wide ncurses library

Description Martin Walch 2012-04-07 14:19:42 UTC
Created attachment 72843 [details]
screenshot of xconfig, showing the broken characters

The Linux Kernel Configuration system (lkc) expects 8 bit characters only (declared in scripts/kconfig/zconf.l: %option 8bit). However, the following config entry from drivers/mtd/nand/Kconfig contains two times the character 'É':

config MTD_NAND_CAFE
	tristate "NAND support for OLPC CAFÉ chip"
	depends on PCI
	select REED_SOLOMON
	select REED_SOLOMON_DEC16
	help
	  Use NAND flash attached to the CAFÉ chip designed for the OLPC
	  laptop.

As it only occurs in a prompt and in a help text, it causes only minor glitches like broken characters in xconfig (see attachment).
Comment 1 Martin Walch 2012-12-17 02:30:05 UTC
Created attachment 89331 [details]
menu is broken in make nconfig

This screenshot shows what happens to make nconfig when a utf-8 character in a symbol prompt is encountered: the prompt containing the character and all prompts below are not shown and can not be selected.
Comment 2 Martin Walch 2012-12-17 02:31:19 UTC
Created attachment 89341 [details]
what the above screenshot looks like without the utf-8 character
Comment 3 Randy Dunlap 2013-11-07 01:11:55 UTC
all confirmed.
Comment 4 Brian Norris 2014-06-01 07:29:20 UTC
This bug isn't explicitly reported for 'make menuconfig', but I thought I'd post here, since until today, I thought menuconfig was broken w.r.t. UTF-8 too...

but if you have the ncursesw ('w' for "wide") development package installed, mconf.o will be linked against it, and 'make menuconfig' will actually display CAFÉ correctly!

Haven't checked into fixing nconfig or xconfig.

I'll also note for posterity that this was discussed in linux-mtd, and the final verdict can be found here:

http://lists.infradead.org/pipermail/linux-mtd/2012-December/045180.html
Comment 5 Brian Norris 2014-06-01 08:20:54 UTC
I just played with nconfig a bit. It looks like it should use the linker flag '-lmenuw' instead of '-lmenu'. With the following hack, 'make nconfig' also works properly. Perhaps I'll work this into a proper patch that will fall back to -lmenu if the wide version is not available.

diff --git a/scripts/kconfig/Makefile b/scripts/kconfig/Makefile
index 844bc9da08da..193fc8830d05 100644
--- a/scripts/kconfig/Makefile
+++ b/scripts/kconfig/Makefile
@@ -220,8 +220,8 @@ HOSTCFLAGS_gconf.o	= `pkg-config --cflags gtk+-2.0 gmodule-2.0 libglade-2.0` \
 HOSTLOADLIBES_mconf   = $(shell $(CONFIG_SHELL) $(check-lxdialog) -ldflags $(HOSTCC))
 
 HOSTLOADLIBES_nconf	= $(shell \
-				pkg-config --libs menu panel ncurses 2>/dev/null \
-				|| echo "-lmenu -lpanel -lncurses"  )
+				pkg-config --libs menuw panel ncursesw 2>/dev/null \
+				|| echo "-lmenuw -lpanel -lncursesw"  )
 $(obj)/qconf.o: $(obj)/.tmp_qtcheck
 
 ifeq ($(qconf-target),1)
Comment 6 Brian Norris 2014-06-01 08:21:56 UTC
Created attachment 137751 [details]
hack fix, to make nconfig use the wide ncurses library
Comment 7 Randy Dunlap 2014-06-01 17:02:02 UTC
Please send the patch to linux-kbuild@vger.kernel.org and Cc: the kconfig
maintainer "Yann E. MORIN" <yann.morin.1998@free.fr>.
Thanks for your help.
Comment 8 Brian Norris 2014-06-02 04:16:30 UTC
Sure thing. I'll fix it up for falling back to the non-wide version, just in case.
Comment 9 Brian Norris 2014-06-04 08:15:08 UTC
Posted patch for nconfig:

http://article.gmane.org/gmane.linux.kbuild.devel/11433
Comment 10 Brian Norris 2014-08-24 05:16:56 UTC
My nconfig patch made it to linux-next.

So xconfig is the only broken one now.
Comment 11 Randy Dunlap 2018-08-11 21:31:08 UTC
The nconfig patch was merged 2014-JUN-04 as commit ID 7285996aa0006d671bb01f0d35991d254b2b2b01.
Comment 12 Brian Norris 2020-04-28 22:00:30 UTC
I just ran `make xconfig` (using Qt5, FWIW) on ~v5.7-rc1, and this was no longer a problem there either.