* [Buildroot] [PATCH 1/1] Fix nconfig for systems with both ncurses and ncursesw @ 2018-01-14 3:12 Guillermo A. Amaral 2018-01-14 13:34 ` Thomas Petazzoni 0 siblings, 1 reply; 7+ messages in thread From: Guillermo A. Amaral @ 2018-01-14 3:12 UTC (permalink / raw) To: buildroot Buildroot's "make ncurses" stopped working a while ago on all my Gentoo systems, running the command would just cause it to crash. I look into it and found that the issue was caused by lxdialog's cflags which are also used to build nconfig; It would detect *ncursesw* and turn on WIDECHAR support -- but the Makefile would still link to plain *ncurses* while building nconfig (which was built without WIDECHAR support). This would cause a crash after using *wattrset* on a WINDOW instance. WIDECHAR *wattrset* would try to set the _color member in the WINDOW struct which does not exist in the NON-WIDECHAR ncurses instance. It would end up clobbering data outside the struct (usually _line entries). Just linking to *ncursesw* instead could possibly brick nconfig on older systems, so I decided to use the same lxdialog script used to find ncurses' cflags/ldflags for menuconfig. Signed-off-by: Guillermo A. Amaral <g@maral.me> --- support/kconfig/Makefile | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/support/kconfig/Makefile b/support/kconfig/Makefile index 7eb4071b4e..f54a60baff 100644 --- a/support/kconfig/Makefile +++ b/support/kconfig/Makefile @@ -220,8 +220,10 @@ 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 menu panel 2>/dev/null \ + || echo "-lmenu -lpanel") +HOSTLOADLIBES_nconf += $(shell $(CONFIG_SHELL) $(check-lxdialog) -ldflags) + $(obj)/qconf.o: $(obj)/.tmp_qtcheck ifeq ($(qconf-target),1) -- 2.13.6 ^ permalink raw reply related [flat|nested] 7+ messages in thread
* [Buildroot] [PATCH 1/1] Fix nconfig for systems with both ncurses and ncursesw 2018-01-14 3:12 [Buildroot] [PATCH 1/1] Fix nconfig for systems with both ncurses and ncursesw Guillermo A. Amaral @ 2018-01-14 13:34 ` Thomas Petazzoni 2018-01-14 16:39 ` Guillermo A. Amaral 0 siblings, 1 reply; 7+ messages in thread From: Thomas Petazzoni @ 2018-01-14 13:34 UTC (permalink / raw) To: buildroot Hello, On Sat, 13 Jan 2018 19:12:02 -0800, Guillermo A. Amaral wrote: > Buildroot's "make ncurses" stopped working a while ago on all my Gentoo Are you sure it's "make ncurses" that failed ? Or "make nconfig" ? > systems, running the command would just cause it to crash. > > I look into it and found that the issue was caused by lxdialog's cflags > which are also used to build nconfig; It would detect *ncursesw* and turn > on WIDECHAR support -- but the Makefile would still link to plain > *ncurses* while building nconfig (which was built without WIDECHAR > support). > > This would cause a crash after using *wattrset* on a WINDOW instance. > WIDECHAR *wattrset* would try to set the _color member in the WINDOW > struct which does not exist in the NON-WIDECHAR ncurses instance. It > would end up clobbering data outside the struct (usually _line entries). > > Just linking to *ncursesw* instead could possibly brick nconfig on older brick -> break > systems, so I decided to use the same lxdialog script used to find > ncurses' cflags/ldflags for menuconfig. > > Signed-off-by: Guillermo A. Amaral <g@maral.me> > --- > support/kconfig/Makefile | 6 ++++-- > 1 file changed, 4 insertions(+), 2 deletions(-) > > diff --git a/support/kconfig/Makefile b/support/kconfig/Makefile > index 7eb4071b4e..f54a60baff 100644 > --- a/support/kconfig/Makefile > +++ b/support/kconfig/Makefile > @@ -220,8 +220,10 @@ 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 menu panel 2>/dev/null \ > + || echo "-lmenu -lpanel") > +HOSTLOADLIBES_nconf += $(shell $(CONFIG_SHELL) $(check-lxdialog) -ldflags) > + > $(obj)/qconf.o: $(obj)/.tmp_qtcheck > > ifeq ($(qconf-target),1) Thanks for your patch. I have a few questions: - Could you submit it upstream to the Linux kernel? - You should also create a patch in support/kconfig/patches/. Indeed, we keep a quilt stack of patches on top of the upstream Linux kernel kconfig code. - Why are you not passing $(HOSTCC) like is done for HOSTLOADLIBES_mconf ? Best regards, Thomas Petazzoni -- Thomas Petazzoni, CTO, Free Electrons Embedded Linux and Kernel engineering http://free-electrons.com ^ permalink raw reply [flat|nested] 7+ messages in thread
* [Buildroot] [PATCH 1/1] Fix nconfig for systems with both ncurses and ncursesw 2018-01-14 13:34 ` Thomas Petazzoni @ 2018-01-14 16:39 ` Guillermo A. Amaral 2018-01-14 17:28 ` [Buildroot] [PATCH 1/1] kconfig: Apply upstream nconfig ncurses/ncursesw fix Guillermo A. Amaral 0 siblings, 1 reply; 7+ messages in thread From: Guillermo A. Amaral @ 2018-01-14 16:39 UTC (permalink / raw) To: buildroot On Sun, Jan 14, 2018 at 02:34:37PM +0100, Thomas Petazzoni wrote: > Hello, > > On Sat, 13 Jan 2018 19:12:02 -0800, Guillermo A. Amaral wrote: > > Buildroot's "make ncurses" stopped working a while ago on all my Gentoo > > Are you sure it's "make ncurses" that failed ? Or "make nconfig" ? ROFL, yes "make nconfig"; Ah, the perils of having similar sounding names (and me not double checking my emails). > > systems, running the command would just cause it to crash. > > > > I look into it and found that the issue was caused by lxdialog's cflags > > which are also used to build nconfig; It would detect *ncursesw* and turn > > on WIDECHAR support -- but the Makefile would still link to plain > > *ncurses* while building nconfig (which was built without WIDECHAR > > support). > > > > This would cause a crash after using *wattrset* on a WINDOW instance. > > WIDECHAR *wattrset* would try to set the _color member in the WINDOW > > struct which does not exist in the NON-WIDECHAR ncurses instance. It > > would end up clobbering data outside the struct (usually _line entries). > > > > Just linking to *ncursesw* instead could possibly brick nconfig on older > > brick -> break I meant 'brick nconfig', as in have a once working command completely stop working; But I agree 'break' is clearer. Something tells me you must be super fun at parties. ;-) > > systems, so I decided to use the same lxdialog script used to find > > ncurses' cflags/ldflags for menuconfig. > > > > Signed-off-by: Guillermo A. Amaral <g@maral.me> > > --- > > support/kconfig/Makefile | 6 ++++-- > > 1 file changed, 4 insertions(+), 2 deletions(-) > > > > diff --git a/support/kconfig/Makefile b/support/kconfig/Makefile > > index 7eb4071b4e..f54a60baff 100644 > > --- a/support/kconfig/Makefile > > +++ b/support/kconfig/Makefile > > @@ -220,8 +220,10 @@ 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 menu panel 2>/dev/null \ > > + || echo "-lmenu -lpanel") > > +HOSTLOADLIBES_nconf += $(shell $(CONFIG_SHELL) $(check-lxdialog) -ldflags) > > + > > $(obj)/qconf.o: $(obj)/.tmp_qtcheck > > > > ifeq ($(qconf-target),1) > > Thanks for your patch. I have a few questions: > > - Could you submit it upstream to the Linux kernel? Yes I can. > - You should also create a patch in support/kconfig/patches/. Indeed, > we keep a quilt stack of patches on top of the upstream Linux kernel > kconfig code. Ah, I missed that directory. Will do. > - Why are you not passing $(HOSTCC) like is done for > HOSTLOADLIBES_mconf ? It didn't seem to need it, but I see now it's used as a backup if pkg-config fails to find the package, I'll add that in. Cheers > Best regards, > > Thomas Petazzoni > -- > Thomas Petazzoni, CTO, Free Electrons > Embedded Linux and Kernel engineering > http://free-electrons.com -- gamaral ^ permalink raw reply [flat|nested] 7+ messages in thread
* [Buildroot] [PATCH 1/1] kconfig: Apply upstream nconfig ncurses/ncursesw fix 2018-01-14 16:39 ` Guillermo A. Amaral @ 2018-01-14 17:28 ` Guillermo A. Amaral 2018-01-15 20:37 ` Thomas Petazzoni 2018-01-16 22:25 ` Peter Korsgaard 0 siblings, 2 replies; 7+ messages in thread From: Guillermo A. Amaral @ 2018-01-14 17:28 UTC (permalink / raw) To: buildroot Buildroot's "make nconfig" command stopped working a while ago on all my Gentoo systems. Running the command would result in a crash. I found that the issue was caused by lxdialog's cflags which are also used to build nconfig; It would detect *ncursesw* and turn on WIDECHAR support -- but the Makefile would still link to plain *ncurses* while building nconfig (which was built without WIDECHAR support). This would cause a crash after using *wattrset* on a WINDOW instance. WIDECHAR *wattrset* would try to set the _color member in the WINDOW struct which does not exist in the NON-WIDECHAR ncurses instance. It would end up clobbering data outside the struct (usually _line entries). I found an upstream patch fixing the issue, so I'm applying it to Buildroot's kconfig. Signed-off-by: Guillermo A. Amaral <g@maral.me> --- support/kconfig/Makefile | 3 +- ...onfig-nconfig-fix-multi-byte-UTF-handling.patch | 45 ++++++++++++++++++++++ support/kconfig/patches/series | 1 + 3 files changed, 48 insertions(+), 1 deletion(-) create mode 100644 support/kconfig/patches/18-kconfig-nconfig-fix-multi-byte-UTF-handling.patch diff --git a/support/kconfig/Makefile b/support/kconfig/Makefile index 7eb4071b4..af6202386 100644 --- a/support/kconfig/Makefile +++ b/support/kconfig/Makefile @@ -220,7 +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 \ + pkg-config --libs menuw panelw ncursesw 2>/dev/null \ + || pkg-config --libs menu panel ncurses 2>/dev/null \ || echo "-lmenu -lpanel -lncurses" ) $(obj)/qconf.o: $(obj)/.tmp_qtcheck diff --git a/support/kconfig/patches/18-kconfig-nconfig-fix-multi-byte-UTF-handling.patch b/support/kconfig/patches/18-kconfig-nconfig-fix-multi-byte-UTF-handling.patch new file mode 100644 index 000000000..3ca48d071 --- /dev/null +++ b/support/kconfig/patches/18-kconfig-nconfig-fix-multi-byte-UTF-handling.patch @@ -0,0 +1,45 @@ +From 7285996aa0006d671bb01f0d35991d254b2b2b01 Mon Sep 17 00:00:00 2001 +From: Brian Norris <computersforpeace@gmail.com> +Date: Wed, 4 Jun 2014 00:52:31 -0700 +Subject: kconfig: nconfig: fix multi-byte UTF handling + +Currently, Kconfig descriptions that use multi-byte UTF-8 characters +(such as MTD_NAND_CAFE) will have their menu entries dropped from the +'make nconfig' ncurses menu, and all subsequent entries in the same +window will be omitted. This seems to be due to the ncurses 'menu' +library, which does not traditionally handle UTF-8 >8-bit characters +properly. + +The ncursesw library ('w' is for "wide") is written to handle these +UTF-8 characters, and is practically a drop-in replacement at the source +level. Use it by default, if available. + +Link: https://bugzilla.kernel.org/show_bug.cgi?id=43067 +Signed-off-by: Brian Norris <computersforpeace@gmail.com> +Cc: "Yann E. MORIN" <yann.morin.1998@free.fr> +Cc: Martin Walch <walch.martin@web.de> +Acked-by: Sam Ravnborg <sam@ravnborg.org> +Signed-off-by: Michal Marek <mmarek@suse.cz> +--- + scripts/kconfig/Makefile | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +(limited to 'scripts/kconfig/Makefile') + +diff --git a/scripts/kconfig/Makefile b/scripts/kconfig/Makefile +index e7bf38e..c059385 100644 +--- a/scripts/kconfig/Makefile ++++ b/scripts/kconfig/Makefile +@@ -191,7 +191,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 \ ++ pkg-config --libs menuw panelw ncursesw 2>/dev/null \ ++ || pkg-config --libs menu panel ncurses 2>/dev/null \ + || echo "-lmenu -lpanel -lncurses" ) + $(obj)/qconf.o: $(obj)/.tmp_qtcheck + +-- +cgit v1.1 + diff --git a/support/kconfig/patches/series b/support/kconfig/patches/series index e25375ea2..1a53ba995 100644 --- a/support/kconfig/patches/series +++ b/support/kconfig/patches/series @@ -7,3 +7,4 @@ 15-fix-qconf-moc-rule.patch 16-fix-space-to-de-select-options.patch 17-kconfig-lxdialog-get-ncurses-CFLAGS-with-pkg-config.patch +18-kconfig-nconfig-fix-multi-byte-UTF-handling.patch -- 2.13.6 ^ permalink raw reply related [flat|nested] 7+ messages in thread
* [Buildroot] [PATCH 1/1] kconfig: Apply upstream nconfig ncurses/ncursesw fix 2018-01-14 17:28 ` [Buildroot] [PATCH 1/1] kconfig: Apply upstream nconfig ncurses/ncursesw fix Guillermo A. Amaral @ 2018-01-15 20:37 ` Thomas Petazzoni 2018-01-16 3:14 ` Guillermo A. Amaral 2018-01-16 22:25 ` Peter Korsgaard 1 sibling, 1 reply; 7+ messages in thread From: Thomas Petazzoni @ 2018-01-15 20:37 UTC (permalink / raw) To: buildroot Hello, On Sun, 14 Jan 2018 09:28:07 -0800, Guillermo A. Amaral wrote: > Buildroot's "make nconfig" command stopped working a while ago on all my > Gentoo systems. Running the command would result in a crash. > > I found that the issue was caused by lxdialog's cflags which are also > used to build nconfig; It would detect *ncursesw* and turn on WIDECHAR > support -- but the Makefile would still link to plain *ncurses* while > building nconfig (which was built without WIDECHAR support). > > This would cause a crash after using *wattrset* on a WINDOW instance. > WIDECHAR *wattrset* would try to set the _color member in the WINDOW > struct which does not exist in the NON-WIDECHAR ncurses instance. It > would end up clobbering data outside the struct (usually _line entries). > > I found an upstream patch fixing the issue, so I'm applying it to > Buildroot's kconfig. > > Signed-off-by: Guillermo A. Amaral <g@maral.me> > --- > support/kconfig/Makefile | 3 +- > ...onfig-nconfig-fix-multi-byte-UTF-handling.patch | 45 ++++++++++++++++++++++ > support/kconfig/patches/series | 1 + > 3 files changed, 48 insertions(+), 1 deletion(-) > create mode 100644 support/kconfig/patches/18-kconfig-nconfig-fix-multi-byte-UTF-handling.patch I've applied after tweaking a bit the commit title ("support/kconfig" instead of "kconfig") and the commit log (using the singular first person is not very common). Thanks a lot for this contribution! Thomas -- Thomas Petazzoni, CTO, Free Electrons Embedded Linux, Kernel and Android engineering http://free-electrons.com ^ permalink raw reply [flat|nested] 7+ messages in thread
* [Buildroot] [PATCH 1/1] kconfig: Apply upstream nconfig ncurses/ncursesw fix 2018-01-15 20:37 ` Thomas Petazzoni @ 2018-01-16 3:14 ` Guillermo A. Amaral 0 siblings, 0 replies; 7+ messages in thread From: Guillermo A. Amaral @ 2018-01-16 3:14 UTC (permalink / raw) To: buildroot Cool, thanks for taking the time to review and tweak. Cheers! On Mon, Jan 15, 2018 at 09:37:06PM +0100, Thomas Petazzoni wrote: > Hello, > > On Sun, 14 Jan 2018 09:28:07 -0800, Guillermo A. Amaral wrote: > > Buildroot's "make nconfig" command stopped working a while ago on all my > > Gentoo systems. Running the command would result in a crash. > > > > I found that the issue was caused by lxdialog's cflags which are also > > used to build nconfig; It would detect *ncursesw* and turn on WIDECHAR > > support -- but the Makefile would still link to plain *ncurses* while > > building nconfig (which was built without WIDECHAR support). > > > > This would cause a crash after using *wattrset* on a WINDOW instance. > > WIDECHAR *wattrset* would try to set the _color member in the WINDOW > > struct which does not exist in the NON-WIDECHAR ncurses instance. It > > would end up clobbering data outside the struct (usually _line entries). > > > > I found an upstream patch fixing the issue, so I'm applying it to > > Buildroot's kconfig. > > > > Signed-off-by: Guillermo A. Amaral <g@maral.me> > > --- > > support/kconfig/Makefile | 3 +- > > ...onfig-nconfig-fix-multi-byte-UTF-handling.patch | 45 ++++++++++++++++++++++ > > support/kconfig/patches/series | 1 + > > 3 files changed, 48 insertions(+), 1 deletion(-) > > create mode 100644 support/kconfig/patches/18-kconfig-nconfig-fix-multi-byte-UTF-handling.patch > > I've applied after tweaking a bit the commit title ("support/kconfig" > instead of "kconfig") and the commit log (using the singular first > person is not very common). > > Thanks a lot for this contribution! > > Thomas > -- > Thomas Petazzoni, CTO, Free Electrons > Embedded Linux, Kernel and Android engineering > http://free-electrons.com -- gamaral http://about.me/gamaral ^ permalink raw reply [flat|nested] 7+ messages in thread
* [Buildroot] [PATCH 1/1] kconfig: Apply upstream nconfig ncurses/ncursesw fix 2018-01-14 17:28 ` [Buildroot] [PATCH 1/1] kconfig: Apply upstream nconfig ncurses/ncursesw fix Guillermo A. Amaral 2018-01-15 20:37 ` Thomas Petazzoni @ 2018-01-16 22:25 ` Peter Korsgaard 1 sibling, 0 replies; 7+ messages in thread From: Peter Korsgaard @ 2018-01-16 22:25 UTC (permalink / raw) To: buildroot >>>>> "Guillermo" == Guillermo A Amaral <g@maral.me> writes: > Buildroot's "make nconfig" command stopped working a while ago on all my > Gentoo systems. Running the command would result in a crash. > I found that the issue was caused by lxdialog's cflags which are also > used to build nconfig; It would detect *ncursesw* and turn on WIDECHAR > support -- but the Makefile would still link to plain *ncurses* while > building nconfig (which was built without WIDECHAR support). > This would cause a crash after using *wattrset* on a WINDOW instance. > WIDECHAR *wattrset* would try to set the _color member in the WINDOW > struct which does not exist in the NON-WIDECHAR ncurses instance. It > would end up clobbering data outside the struct (usually _line entries). > I found an upstream patch fixing the issue, so I'm applying it to > Buildroot's kconfig. > Signed-off-by: Guillermo A. Amaral <g@maral.me> Committed to 2017.11.x, thanks. -- Bye, Peter Korsgaard ^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2018-01-16 22:25 UTC | newest] Thread overview: 7+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2018-01-14 3:12 [Buildroot] [PATCH 1/1] Fix nconfig for systems with both ncurses and ncursesw Guillermo A. Amaral 2018-01-14 13:34 ` Thomas Petazzoni 2018-01-14 16:39 ` Guillermo A. Amaral 2018-01-14 17:28 ` [Buildroot] [PATCH 1/1] kconfig: Apply upstream nconfig ncurses/ncursesw fix Guillermo A. Amaral 2018-01-15 20:37 ` Thomas Petazzoni 2018-01-16 3:14 ` Guillermo A. Amaral 2018-01-16 22:25 ` Peter Korsgaard
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox