* [Buildroot] [PATCH] package/libecoli: fix uninitialized width build failure with -Ofast
@ 2026-11-11 8:00 Yegor Yefremov via buildroot
2026-11-11 11:08 ` Peter Korsgaard
0 siblings, 1 reply; 2+ messages in thread
From: Yegor Yefremov via buildroot @ 2026-11-11 8:00 UTC (permalink / raw)
To: buildroot; +Cc: Vincent Jardin
libecoli builds with -Werror. With GCC 15 and BR2_OPTIMIZE_FAST, the
build fails with:
../src/editline.c: In function 'ec_editline_complete':
../src/editline.c:304:22: error: 'width' may be used uninitialized [-Werror=maybe-uninitialized]
../src/editline.c: In function 'ec_editline_interact':
../src/editline.c:657:22: error: 'width' may be used uninitialized [-Werror=maybe-uninitialized]
This is a real bug: ec_editline_term_size() only writes its width
output when both el_get(EL_GETTC) calls succeed, and these two callers
neither check its return value nor initialize width beforehand.
Add a patch, submitted upstream, that defaults width to 80 columns, as
the other ec_editline_term_size() callers already do.
This issue has been present since commit 5638ee04c8dd ("package/libecoli:
bump version to 0.11.3"), as upstream commit bc90312a4285 ("editline:
split in 2 files"), first released in v0.11.0, dropped the width
initialization. It therefore affects 2026.08 and later. The 2026.02.x
LTS branch still has libecoli 0.10.1 and is not affected.
Fixes:
https://autobuild.buildroot.org/results/a0a7e17f1a76588932a8a7f8db35a832d540cc69
Fixes: 5638ee04c8dddb9ebfb7b047efb574f657e1b052 ("package/libecoli: bump version to 0.11.3")
Assisted-by: Claude:claude-opus-5-5
Signed-off-by: Yegor Yefremov <yegorslists@googlemail.com>
---
...-width-before-querying-terminal-size.patch | 56 +++++++++++++++++++
1 file changed, 56 insertions(+)
create mode 100644 package/libecoli/0001-editline-initialize-width-before-querying-terminal-size.patch
diff --git a/package/libecoli/0001-editline-initialize-width-before-querying-terminal-size.patch b/package/libecoli/0001-editline-initialize-width-before-querying-terminal-size.patch
new file mode 100644
index 0000000000..e2b833473e
--- /dev/null
+++ b/package/libecoli/0001-editline-initialize-width-before-querying-terminal-size.patch
@@ -0,0 +1,56 @@
+From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
+From: Yegor Yefremov <yegorslists@googlemail.com>
+Date: Tue, 10 Nov 2026 23:53:35 +0100
+Subject: [PATCH] editline: initialize width before querying terminal size
+
+ec_editline_term_size() only writes the width and height outputs when
+both el_get(EL_GETTC) calls succeed. ec_editline_complete() and
+ec_editline_interact() ignore its return value and do not initialize
+width beforehand, so an indeterminate value is used (clamped to 50..100)
+when the terminal capabilities cannot be retrieved.
+
+With GCC 15 and -Ofast, this is detected and breaks the build because
+of -Werror:
+
+ ../src/editline.c: In function 'ec_editline_complete':
+ ../src/editline.c:304:22: error: 'width' may be used uninitialized [-Werror=maybe-uninitialized]
+ ../src/editline.c: In function 'ec_editline_interact':
+ ../src/editline.c:657:22: error: 'width' may be used uninitialized [-Werror=maybe-uninitialized]
+
+Default width to 80 columns, as the other ec_editline_term_size()
+callers already do.
+
+Link: https://autobuild.buildroot.org/results/a0a7e17f1a76588932a8a7f8db35a832d540cc69
+Fixes: bc90312a4285 ("editline: split in 2 files")
+Upstream: https://github.com/rjarry/libecoli/pull/43
+Assisted-by: Claude:claude-opus-5-5
+Signed-off-by: Yegor Yefremov <yegorslists@googlemail.com>
+---
+ src/editline.c | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/src/editline.c b/src/editline.c
+index d286135..0751194 100644
+--- a/src/editline.c
++++ b/src/editline.c
+@@ -301,7 +301,7 @@ int ec_editline_complete(struct editline *el, int c)
+ struct ec_comp *cmpl = NULL;
+ char *append = NULL;
+ unsigned int height;
+- unsigned int width;
++ unsigned int width = 80;
+ size_t comp_count;
+ void *clientdata;
+ char *line = NULL;
+@@ -654,7 +654,7 @@ int ec_editline_interact(
+ const struct ec_node *node;
+ size_t char_idx = 0;
+ unsigned int height;
+- unsigned int width;
++ unsigned int width = 80;
+ char *line = NULL;
+ ssize_t n;
+ FILE *out;
+--
+2.34.1
+
--
2.34.1
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [Buildroot] [PATCH] package/libecoli: fix uninitialized width build failure with -Ofast
2026-11-11 8:00 [Buildroot] [PATCH] package/libecoli: fix uninitialized width build failure with -Ofast Yegor Yefremov via buildroot
@ 2026-11-11 11:08 ` Peter Korsgaard
0 siblings, 0 replies; 2+ messages in thread
From: Peter Korsgaard @ 2026-11-11 11:08 UTC (permalink / raw)
To: Yegor Yefremov via buildroot; +Cc: Vincent Jardin
>>>>> "Yegor" == Yegor Yefremov via buildroot <buildroot@buildroot.org> writes:
> libecoli builds with -Werror. With GCC 15 and BR2_OPTIMIZE_FAST, the
> build fails with:
> ../src/editline.c: In function 'ec_editline_complete':
> ../src/editline.c:304:22: error: 'width' may be used uninitialized [-Werror=maybe-uninitialized]
> ../src/editline.c: In function 'ec_editline_interact':
> ../src/editline.c:657:22: error: 'width' may be used uninitialized [-Werror=maybe-uninitialized]
> This is a real bug: ec_editline_term_size() only writes its width
> output when both el_get(EL_GETTC) calls succeed, and these two callers
> neither check its return value nor initialize width beforehand.
> Add a patch, submitted upstream, that defaults width to 80 columns, as
> the other ec_editline_term_size() callers already do.
> This issue has been present since commit 5638ee04c8dd ("package/libecoli:
> bump version to 0.11.3"), as upstream commit bc90312a4285 ("editline:
> split in 2 files"), first released in v0.11.0, dropped the width
> initialization. It therefore affects 2026.08 and later. The 2026.02.x
> LTS branch still has libecoli 0.10.1 and is not affected.
> Fixes:
> https://autobuild.buildroot.org/results/a0a7e17f1a76588932a8a7f8db35a832d540cc69
> Fixes: 5638ee04c8dddb9ebfb7b047efb574f657e1b052 ("package/libecoli: bump version to 0.11.3")
> Assisted-by: Claude:claude-opus-5-5
> Signed-off-by: Yegor Yefremov <yegorslists@googlemail.com>
Committed, thanks.
--
Bye, Peter Korsgaard
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2026-11-11 11:09 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-11 8:00 [Buildroot] [PATCH] package/libecoli: fix uninitialized width build failure with -Ofast Yegor Yefremov via buildroot
2026-11-11 11:08 ` Peter Korsgaard
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox