Skip to contentSkip to conversation

readline: backport a patch to fix for caller setting rl_prompt to NULL

PATCH Superseded João Henrique Ferreira de Freitas 3 participants 4 messages Oct 31, 2025 – Nov 3, 2025

v2 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 readline: backport a patch to fix for caller setting rl_prompt to NULL

I've observed this issue affecting iwctl and connmanctl.

Patching readline solves the issue.

The original patch from [5] mixes many fixes in one commit. I've extract only what matters to solve the issues observed with connman and iwd. The final patch is the same patch sent by readline author to readline's mail list [6].

References:

1: https://gitlab.archlinux.org/archlinux/packaging/packages/readline/-/issues/1
2: https://gitlab.archlinux.org/archlinux/packaging/packages/readline/-/commit/b30636dc66fc783a091af51b049dc5240f861dd0
3: https://lists.gnu.org/archive/html/bug-readline/2025-07/msg00007.html
4: https://lore.kernel.org/connman/[email protected]/
5: https://cgit.git.savannah.gnu.org/cgit/readline.git/commit/display.c?h=devel&id=488d7edc22894d30b6de7f2d4190bf7403f63ffd
6: https://lists.gnu.org/archive/html/bug-readline/2025-07/txtmA7rksnmmi.txt

Fixes [YOCTO #16047]

---

Notes:
changes in v2:
- add readline fix author name
- add explanation why and where the original patch come from

 ...for-caller-setting-rl_prompt-to-NULL.patch | 42 +++++++++++++++++++
 meta/recipes-core/readline/readline_8.3.bb    |  5 ++-
 2 files changed, 45 insertions(+), 2 deletions(-)
 create mode 100644 meta/recipes-core/readline/readline/fix-for-caller-setting-rl_prompt-to-NULL.patch
meta/recipes-core/readline/readline/fix-for-caller-setting-rl_prompt-to-NULL.patch new file +42 -0
new file mode 100644
index 0000000000..c8ac712d56
@@ -0,0 +1,42 @@
+From a0a4c011c0c5e598c5b51cbf81d3b4501fa72e0c Mon Sep 17 00:00:00 2001
+From: Chet Ramey <[email protected]>
+Date: Thu, 30 Oct 2025 14:19:41 -0300
+Subject: [PATCH] fix for caller setting rl_prompt to NULL
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+Upstream-Status: Backport [https://cgit.git.savannah.gnu.org/cgit/readline.git/commit/display.c?h=devel&id=488d7edc22894d30b6de7f2d4190bf7403f63ffd]
+Signed-off-by: João Henrique Ferreira de Freitas <[email protected]>
+---
+
+Notes:
+    The original patch came from [1, 2] and it has been integrated into
+    readline git repository, commit (488d7edc22894d30b6de7f2d4190bf7403f63ffd)
+    
+    This patch has only the fix needed to solve the follow issues [3,4].
+    
+    I added the original author as this patch has been sent through readline mail
+    list.
+    
+    1: https://lists.gnu.org/archive/html/bug-readline/2025-07/msg00007.html
+    2: https://lists.gnu.org/archive/html/bug-readline/2025-07/txtmA7rksnmmi.txt
+    3: https://lore.kernel.org/connman/[email protected]/
+    4: https://gitlab.archlinux.org/archlinux/packaging/packages/readline/-/issues/1
+
+ display.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/display.c b/display.c
+index 9aa8c7b..edb525d 100644
+--- a/display.c
++++ b/display.c
+@@ -783,7 +783,7 @@ _rl_optimize_redisplay (void)
+ 
+ /* Useful shorthand used by rl_redisplay, update_line, rl_move_cursor_relative */
+ #define INVIS_FIRST()	(local_prompt_invis_chars[0])
+-#define WRAP_OFFSET(line, offset)  ((line <= prompt_last_screen_line) ? local_prompt_invis_chars[line] : 0)
++#define WRAP_OFFSET(line, offset)  ((line <= prompt_last_screen_line && local_prompt_invis_chars) ? local_prompt_invis_chars[line] : 0)
+ 
+ #define W_OFFSET(line, offset) ((line) == 0 ? offset : 0)
+ #define VIS_LLEN(l)	((l) > _rl_vis_botlin ? 0 : (vis_lbreaks[l+1] - vis_lbreaks[l]))
meta/recipes-core/readline/readline_8.3.bb +3 -2
index a2f23eb353..8bc4477946 100644
@@ -1,7 +1,8 @@
 require readline.inc
 
 SRC_URI += "file://norpath.patch \
-            file://fix-for-readline-event-hook.patch \
-            "
+           file://fix-for-readline-event-hook.patch \
+           file://fix-for-caller-setting-rl_prompt-to-NULL.patch \
+           "
 
 SRC_URI[archive.sha256sum] = "fe5383204467828cd495ee8d1d3c037a7eba1389c22bc6a041f627976f9061cc"
#1 lore raw

looks ok.

Quoted 106 lines · João Henrique Ferreira de Freitas via lists.openembedded.org

I've observed this issue affecting iwctl and connmanctl.

Patching readline solves the issue.

The original patch from [5] mixes many fixes in one commit. I've extract only what matters to solve the issues observed with connman and iwd. The final patch is the same patch sent by readline author to readline's mail list [6].

References:

1: https://gitlab.archlinux.org/archlinux/packaging/packages/readline/-/issues/1
2: https://gitlab.archlinux.org/archlinux/packaging/packages/readline/-/commit/b30636dc66fc783a091af51b049dc5240f861dd0
3: https://lists.gnu.org/archive/html/bug-readline/2025-07/msg00007.html
4: https://lore.kernel.org/connman/[email protected]/
5: https://cgit.git.savannah.gnu.org/cgit/readline.git/commit/display.c?h=devel&id=488d7edc22894d30b6de7f2d4190bf7403f63ffd
6: https://lists.gnu.org/archive/html/bug-readline/2025-07/txtmA7rksnmmi.txt

Fixes [YOCTO #16047]

---

Notes:
changes in v2:
- add readline fix author name
- add explanation why and where the original patch come from

 ...for-caller-setting-rl_prompt-to-NULL.patch | 42 +++++++++++++++++++
 meta/recipes-core/readline/readline_8.3.bb    |  5 ++-
 2 files changed, 45 insertions(+), 2 deletions(-)
 create mode 100644 meta/recipes-core/readline/readline/fix-for-caller-setting-rl_prompt-to-NULL.patch
meta/recipes-core/readline/readline/fix-for-caller-setting-rl_prompt-to-NULL.patch new file +42 -0
new file mode 100644
index 0000000000..c8ac712d56
@@ -0,0 +1,42 @@
+From a0a4c011c0c5e598c5b51cbf81d3b4501fa72e0c Mon Sep 17 00:00:00 2001
+From: Chet Ramey <[email protected]>
+Date: Thu, 30 Oct 2025 14:19:41 -0300
+Subject: [PATCH] fix for caller setting rl_prompt to NULL
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+Upstream-Status: Backport [https://cgit.git.savannah.gnu.org/cgit/readline.git/commit/display.c?h=devel&id=488d7edc22894d30b6de7f2d4190bf7403f63ffd]
+Signed-off-by: João Henrique Ferreira de Freitas <[email protected]>
+---
+
+Notes:
+    The original patch came from [1, 2] and it has been integrated into
+    readline git repository, commit (488d7edc22894d30b6de7f2d4190bf7403f63ffd)
+
+    This patch has only the fix needed to solve the follow issues [3,4].
+
+    I added the original author as this patch has been sent through readline mail
+    list.
+
+    1: https://lists.gnu.org/archive/html/bug-readline/2025-07/msg00007.html
+    2: https://lists.gnu.org/archive/html/bug-readline/2025-07/txtmA7rksnmmi.txt
+    3: https://lore.kernel.org/connman/[email protected]/
+    4: https://gitlab.archlinux.org/archlinux/packaging/packages/readline/-/issues/1
+
+ display.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/display.c b/display.c
+index 9aa8c7b..edb525d 100644
+--- a/display.c
++++ b/display.c
+@@ -783,7 +783,7 @@ _rl_optimize_redisplay (void)
+
+ /* Useful shorthand used by rl_redisplay, update_line, rl_move_cursor_relative */
+ #define INVIS_FIRST() (local_prompt_invis_chars[0])
+-#define WRAP_OFFSET(line, offset)  ((line <= prompt_last_screen_line) ? local_prompt_invis_chars[line] : 0)
++#define WRAP_OFFSET(line, offset)  ((line <= prompt_last_screen_line && local_prompt_invis_chars) ? local_prompt_invis_chars[line] : 0)
+
+ #define W_OFFSET(line, offset) ((line) == 0 ? offset : 0)
+ #define VIS_LLEN(l)   ((l) > _rl_vis_botlin ? 0 : (vis_lbreaks[l+1] - vis_lbreaks[l]))
meta/recipes-core/readline/readline_8.3.bb +3 -3
index a2f23eb353..8bc4477946 100644
@@ -1,7 +1,8 @@
 require readline.inc
 
 SRC_URI += "file://norpath.patch \
-            file://fix-for-readline-event-hook.patch \
-            "
+           file://fix-for-readline-event-hook.patch \
+           file://fix-for-caller-setting-rl_prompt-to-NULL.patch \
+           "
 
 SRC_URI[archive.sha256sum] = "fe5383204467828cd495ee8d1d3c037a7eba1389c22bc6a041f627976f9061cc"
 
-=-=-=-=-=-=-=-=-=-=-=-

Links: You receive all messages sent to this group.
View/Reply Online (#225558): https://lists.openembedded.org/g/openembedded-core/message/225558
Mute This Topic: https://lists.openembedded.org/mt/116053075/1997914
Group Owner: [email protected]
Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-

#2 lore raw
In reply to João Henrique Ferreira de Freitas
Quoted 54 lines · João Henrique Ferreira de Freitas

I've observed this issue affecting iwctl and connmanctl.

Patching readline solves the issue.

The original patch from [5] mixes many fixes in one commit. I've extract only what matters to solve the issues observed with connman and iwd. The final patch is the same patch sent by readline author to readline's mail list [6].

References:

1: https://gitlab.archlinux.org/archlinux/packaging/packages/readline/-/issues/1
2: https://gitlab.archlinux.org/archlinux/packaging/packages/readline/-/commit/b30636dc66fc783a091af51b049dc5240f861dd0
3: https://lists.gnu.org/archive/html/bug-readline/2025-07/msg00007.html
4: https://lore.kernel.org/connman/[email protected]/
5: https://cgit.git.savannah.gnu.org/cgit/readline.git/commit/display.c?h=devel&id=488d7edc22894d30b6de7f2d4190bf7403f63ffd
6: https://lists.gnu.org/archive/html/bug-readline/2025-07/txtmA7rksnmmi.txt

Fixes [YOCTO #16047]

---

Notes:
changes in v2:
- add readline fix author name
- add explanation why and where the original patch come from

 ...for-caller-setting-rl_prompt-to-NULL.patch | 42 +++++++++++++++++++
 meta/recipes-core/readline/readline_8.3.bb    |  5 ++-
 2 files changed, 45 insertions(+), 2 deletions(-)
 create mode 100644 meta/recipes-core/readline/readline/fix-for-caller-setting-rl_prompt-to-NULL.patch
meta/recipes-core/readline/readline/fix-for-caller-setting-rl_prompt-to-NULL.patch new file +15 -0
new file mode 100644
index 0000000000..c8ac712d56
@@ -0,0 +1,42 @@
+From a0a4c011c0c5e598c5b51cbf81d3b4501fa72e0c Mon Sep 17 00:00:00 2001
+From: Chet Ramey <[email protected]>
+Date: Thu, 30 Oct 2025 14:19:41 -0300
+Subject: [PATCH] fix for caller setting rl_prompt to NULL
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+Upstream-Status: Backport [https://cgit.git.savannah.gnu.org/cgit/readline.git/commit/display.c?h=devel&id=488d7edc22894d30b6de7f2d4190bf7403f63ffd]
+Signed-off-by: João Henrique Ferreira de Freitas <[email protected]>
+---
+
+Notes:
+    The original patch came from [1, 2] and it has been integrated into
+    readline git repository, commit (488d7edc22894d30b6de7f2d4190bf7403f63ffd)

meta/recipes-core/readline/readline/fix-for-caller-setting-rl_prompt-to-NULL.patch line 25

Quoted 10 lines
meta/recipes-core/readline/readline/fix-for-caller-setting-rl_prompt-to-NULL.patch new file +10 -0
+    
+    This patch has only the fix needed to solve the follow issues [3,4].
+    
+    I added the original author as this patch has been sent through readline mail
+    list.
+    
+    1: https://lists.gnu.org/archive/html/bug-readline/2025-07/msg00007.html
+    2: https://lists.gnu.org/archive/html/bug-readline/2025-07/txtmA7rksnmmi.txt
+    3: https://lore.kernel.org/connman/[email protected]/
+    4: https://gitlab.archlinux.org/archlinux/packaging/packages/readline/-/issues/1

We should keep these notes above the "---" divider in the patch file so that they're not lost if devtool or another tool is used to rebase patches.

meta/recipes-core/readline/readline_8.3.bb line 6

Quoted 13 lines
meta/recipes-core/readline/readline_8.3.bb +3 -2
index a2f23eb353..8bc4477946 100644
@@ -1,7 +1,8 @@
 require readline.inc
 
 SRC_URI += "file://norpath.patch \
-            file://fix-for-readline-event-hook.patch \
-            "
+           file://fix-for-readline-event-hook.patch \
+           file://fix-for-caller-setting-rl_prompt-to-NULL.patch \
+           "

Minor nitpick: Looks like there's an unnecessary whitespace change here.

Thanks,

Signature · 1 line
Paul Barker
#3 lore raw

Hi Paul,

I'll send a v3 soon. I was unsure where to add those notes.

Thanks

Quoted 111 lines · Paul Barker
Quoted 7 lines · João Henrique Ferreira de Freitas

I've observed this issue affecting iwctl and connmanctl.

Patching readline solves the issue.

The original patch from [5] mixes many fixes in one commit. I've extract only what matters to solve the issues observed with connman and iwd. The final patch is the same patch sent by readline author to readline's mail

list [6].

Quoted 4 lines

References:

1:

https://gitlab.archlinux.org/archlinux/packaging/packages/readline/-/issues/1

Quoted 1 line

2:

https://gitlab.archlinux.org/archlinux/packaging/packages/readline/-/commit/b30636dc66fc783a091af51b049dc5240f861dd0

Quoted 2 lines

3: https://lists.gnu.org/archive/html/bug-readline/2025-07/msg00007.html
4:

https://lore.kernel.org/connman/[email protected]/

Quoted 1 line

5:

https://cgit.git.savannah.gnu.org/cgit/readline.git/commit/display.c?h=devel&id=488d7edc22894d30b6de7f2d4190bf7403f63ffd

Quoted 1 line

6:

https://lists.gnu.org/archive/html/bug-readline/2025-07/txtmA7rksnmmi.txt

Quoted 12 lines

Fixes [YOCTO #16047]

---

Notes:
changes in v2:
- add readline fix author name
- add explanation why and where the original patch come from

Quoted 4 lines
 ...for-caller-setting-rl_prompt-to-NULL.patch | 42 +++++++++++++++++++
 meta/recipes-core/readline/readline_8.3.bb    |  5 ++-
 2 files changed, 45 insertions(+), 2 deletions(-)
 create mode 100644

meta/recipes-core/readline/readline/fix-for-caller-setting-rl_prompt-to-NULL.patch

Quoted 2 lines

diff --git

a/meta/recipes-core/readline/readline/fix-for-caller-setting-rl_prompt-to-NULL.patch b/meta/recipes-core/readline/readline/fix-for-caller-setting-rl_prompt-to-NULL.patch

Quoted 4 lines

new file mode 100644
index 0000000000..c8ac712d56
--- /dev/null
+++

b/meta/recipes-core/readline/readline/fix-for-caller-setting-rl_prompt-to-NULL.patch

meta/recipes-core/readline/readline/fix-for-caller-setting-rl_prompt-to-NULL.patch line 9

Quoted 10 lines
meta/recipes-core/readline/readline/fix-for-caller-setting-rl_prompt-to-NULL.patch new file +9 -0
@@ -0,0 +1,42 @@
+From a0a4c011c0c5e598c5b51cbf81d3b4501fa72e0c Mon Sep 17 00:00:00 2001
+From: Chet Ramey <[email protected]>
+Date: Thu, 30 Oct 2025 14:19:41 -0300
+Subject: [PATCH] fix for caller setting rl_prompt to NULL
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+Upstream-Status: Backport [

https://cgit.git.savannah.gnu.org/cgit/readline.git/commit/display.c?h=devel&id=488d7edc22894d30b6de7f2d4190bf7403f63ffd
]

meta/recipes-core/readline/readline/fix-for-caller-setting-rl_prompt-to-NULL.patch

Quoted 6 lines
meta/recipes-core/readline/readline/fix-for-caller-setting-rl_prompt-to-NULL.patch new file +6 -0
+Signed-off-by: João Henrique Ferreira de Freitas <[email protected]>
+---
+
+Notes:
+    The original patch came from [1, 2] and it has been integrated into
+    readline git repository, commit

(488d7edc22894d30b6de7f2d4190bf7403f63ffd)

meta/recipes-core/readline/readline/fix-for-caller-setting-rl_prompt-to-NULL.patch

Quoted 4 lines
meta/recipes-core/readline/readline/fix-for-caller-setting-rl_prompt-to-NULL.patch new file +4 -0
+
+    This patch has only the fix needed to solve the follow issues [3,4].
+
+    I added the original author as this patch has been sent through

readline mail

meta/recipes-core/readline/readline/fix-for-caller-setting-rl_prompt-to-NULL.patch

Quoted 3 lines
meta/recipes-core/readline/readline/fix-for-caller-setting-rl_prompt-to-NULL.patch new file +3 -0
+    list.
+
+    1:

https://lists.gnu.org/archive/html/bug-readline/2025-07/msg00007.html

Review line 23

Quoted 1 line
(quoted diff) +1 -0
+    2:

https://lists.gnu.org/archive/html/bug-readline/2025-07/txtmA7rksnmmi.txt

Review line 24

Quoted 1 line
(quoted diff) +1 -0
+    3:

https://lore.kernel.org/connman/[email protected]/

Review line 25

Quoted 1 line
(quoted diff) +1 -0
+    4:

https://gitlab.archlinux.org/archlinux/packaging/packages/readline/-/issues/1

We should keep these notes above the "---" divider in the patch file so that they're not lost if devtool or another tool is used to rebase patches.

Review

Quoted 1 line
(quoted diff) +0 -0

b/meta/recipes-core/readline/readline_8.3.bb

meta/recipes-core/readline/readline_8.3.bb line 6

Quoted 12 lines

index a2f23eb353..8bc4477946 100644

meta/recipes-core/readline/readline_8.3.bb +3 -2
@@ -1,7 +1,8 @@
 require readline.inc
 
 SRC_URI += "file://norpath.patch \
-            file://fix-for-readline-event-hook.patch \
-            "
+           file://fix-for-readline-event-hook.patch \
+           file://fix-for-caller-setting-rl_prompt-to-NULL.patch \
+           "

Minor nitpick: Looks like there's an unnecessary whitespace change here.

Thanks,

--
Paul Barker

Signature · 2 lines
João Henrique Ferreira de Freitas - joaohf_at_gmail.com
Campinas-SP-Brasil