Fix nconfig for systems with both ncurses and ncursesw
PATCH 1/1 Fix nconfig for systems with both ncurses and ncursesw
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.
--- support/kconfig/Makefile | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
support/kconfig/Makefile +4 -2
@@ -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)
Signature · 1 line
2.13.6
PATCH 1/1 Fix nconfig for systems with both ncurses and ncursesw
Hello,
Quoted 1 line · Guillermo A. Amaral
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" ?
Quoted 8 lines
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
Makefilewould still link to plain *ncurses* while building nconfig (which was built without WIDECHAR support).
Quoted 6 lines
This would cause a crash after using *wattrset* on a WINDOW instance. WIDECHAR *wattrset* would try to set the
_colormember in the WINDOW struct which does not exist in the NON-WIDECHAR ncurses instance. It would end up clobbering data outside the struct (usually_lineentries).Just linking to *ncursesw* instead could possibly brick nconfig on older
brick -> break
Quoted 15 lines
systems, so I decided to use the same lxdialog script used to find ncurses' cflags/ldflags for menuconfig.
Signed-off-by Guillermo A. Amaral <[email protected]>--- support/kconfig/Makefile | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)support/kconfig/Makefile +0
-0@@ -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))
support/kconfig/Makefile HOSTCFLAGS_gconf.o = `pkg-config --cflags gtk+-2.0 gmodule-2.0 libglade-2.0` \ · line 229
Quoted 10 lines
support/kconfig/Makefile +4
-2HOSTLOADLIBES_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
Signature · 3 lines
Thomas Petazzoni, CTO, Free Electrons Embedded Linux and Kernel engineering http://free-electrons.com
PATCH 1/1 Fix nconfig for systems with both ncurses and ncursesw
Quoted 6 lines · Thomas Petazzoni
Hello,
Quoted 1 line · Guillermo A. Amaral
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).
Quoted 8 lines
Quoted 8 lines
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
Makefilewould still link to plain *ncurses* while building nconfig (which was built without WIDECHAR support).
Quoted 8 lines
Quoted 6 lines
This would cause a crash after using *wattrset* on a WINDOW instance. WIDECHAR *wattrset* would try to set the
_colormember in the WINDOW struct which does not exist in the NON-WIDECHAR ncurses instance. It would end up clobbering data outside the struct (usually_lineentries).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. ;-)
Quoted 24 lines
Quoted 24 lines
systems, so I decided to use the same lxdialog script used to find ncurses' cflags/ldflags for menuconfig.
Signed-off-by Guillermo A. Amaral <[email protected]>--- support/kconfig/Makefile | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)support/kconfig/Makefile +4
-2@@ -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
Quoted 5 lines
support/kconfig/Makefile HOSTCFLAGS_gconf.o = `pkg-config --cflags gtk+-2.0 gmodule-2.0 libglade-2.0` \ · line 229
Quoted 1 line
support/kconfig/Makefile +0
-0ifeq ($(qconf-target),1)Thanks for your patch. I have a few questions:
- Could you submit it upstream to the Linux kernel?
Yes I can.
Quoted 3 lines
- 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.
Quoted 2 lines
- 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
Quoted 7 lines
Best regards,
Thomas Petazzoni
Signature · 3 lines
Thomas Petazzoni, CTO, Free Electrons Embedded Linux and Kernel engineering http://free-electrons.com
Signature · 1 line
gamaral
PATCH 1/1 kconfig: Apply upstream nconfig ncurses/ncursesw fix
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.
--- 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
support/kconfig/Makefile +2 -1
@@ -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
support/kconfig/patches/18-kconfig-nconfig-fix-multi-byte-UTF-handling.patch new file +45 -0
45 lines not on this page · raw message
support/kconfig/patches/series +1 -0
@@ -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
Signature · 1 line
2.13.6
PATCH 1/1 kconfig: Apply upstream nconfig ncurses/ncursesw fix
Hello,
Quoted 16 lines · Guillermo A. Amaral
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
Makefilewould 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
_colormember in the WINDOW struct which does not exist in the NON-WIDECHAR ncurses instance. It would end up clobbering data outside the struct (usually_lineentries).I found an upstream patch fixing the issue, so I'm applying it to Buildroot's kconfig.
Quoted 7 lines
Signed-off-by Guillermo A. Amaral <[email protected]>--- 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
Signature · 3 lines
Thomas Petazzoni, CTO, Free Electrons Embedded Linux, Kernel and Android engineering http://free-electrons.com
PATCH 1/1 kconfig: Apply upstream nconfig ncurses/ncursesw fix
Cool, thanks for taking the time to review and tweak.
Cheers!
Quoted 38 lines · Thomas Petazzoni
Hello,
Quoted 16 lines · Guillermo A. Amaral
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
Makefilewould 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
_colormember in the WINDOW struct which does not exist in the NON-WIDECHAR ncurses instance. It would end up clobbering data outside the struct (usually_lineentries).I found an upstream patch fixing the issue, so I'm applying it to Buildroot's kconfig.
Quoted 7 lines
Signed-off-by Guillermo A. Amaral <[email protected]>--- 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.patchI'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
Signature · 3 lines
Thomas Petazzoni, CTO, Free Electrons Embedded Linux, Kernel and Android engineering http://free-electrons.com
Signature · 2 lines
gamaral http://about.me/gamaral
PATCH 1/1 kconfig: Apply upstream nconfig ncurses/ncursesw fix
In reply to Guillermo A. AmaralQuoted 15 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
"Guillermo" == Guillermo A Amaral <[email protected]> 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
Makefilewould 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
_colormember in the WINDOW struct which does not exist in the NON-WIDECHAR ncurses instance. It would end up clobbering data outside the struct (usually_lineentries).
Quoted 4 lines
I found an upstream patch fixing the issue, so I'm applying it to Buildroot's kconfig.
Signed-off-by Guillermo A. Amaral <[email protected]>
Committed to 2017.11.x, thanks.
Signature · 1 line
Bye, Peter Korsgaard