[yocto] [PATCH 3/3] mc: unify curses initialization

Hongxu Jia hongxu.jia at windriver.com
Thu Aug 17 23:44:39 PDT 2017


Since ncurses upgraded to 6.0+20170715, it compile failed
...
| ../../../mc-4.7.5.2/lib/tty/tty-ncurses.c: In function 'tty_init':
| ../../../mc-4.7.5.2/lib/tty/tty-ncurses.c:163:13: error:
dereferencing pointer to incomplete type 'TERMINAL {aka struct term}'
|      cur_term->Nttyb.c_cc[VINTR] = CTRL ('g');   /* ^g */
...

Backport a patch from upstream and rebase to 4.7.5.2 could fix the issue.

Signed-off-by: Hongxu Jia <hongxu.jia at windriver.com>
---
 ...3697-tty_init-unify-curses-initialization.patch | 51 ++++++++++++++++++++++
 recipes-extended/mc/mc_4.7.5.2.bb                  |  1 +
 2 files changed, 52 insertions(+)
 create mode 100644 recipes-extended/mc/mc/0001-Ticket-3697-tty_init-unify-curses-initialization.patch

diff --git a/recipes-extended/mc/mc/0001-Ticket-3697-tty_init-unify-curses-initialization.patch b/recipes-extended/mc/mc/0001-Ticket-3697-tty_init-unify-curses-initialization.patch
new file mode 100644
index 0000000..3fe836a
--- /dev/null
+++ b/recipes-extended/mc/mc/0001-Ticket-3697-tty_init-unify-curses-initialization.patch
@@ -0,0 +1,51 @@
+From 4d46a108629beb66a293672db7b44f863b6598ba Mon Sep 17 00:00:00 2001
+From: Thomas Dickey <dickey at his.com>
+Date: Fri, 14 Apr 2017 14:06:13 +0300
+Subject: [PATCH] Ticket #3697: (tty_init): unify curses initialization
+
+...for various curses implementations.
+
+Signed-off-by: Andrew Borodin <aborodin at vmail.ru>
+
+Upstream-Status: Backport [https://github.com/MidnightCommander/mc.git]
+
+Signed-off-by: Hongxu Jia <hongxu.jia at windriver.com>
+---
+ lib/tty/tty-ncurses.c | 12 +++++++++---
+ 1 file changed, 9 insertions(+), 3 deletions(-)
+
+diff --git a/lib/tty/tty-ncurses.c b/lib/tty/tty-ncurses.c
+index ab61891..47e537e 100644
+--- a/lib/tty/tty-ncurses.c
++++ b/lib/tty/tty-ncurses.c
+@@ -144,6 +144,8 @@ tty_init (gboolean slow, gboolean ugly_lines)
+     slow_tty = slow;
+     (void) ugly_lines;
+ 
++    struct termios mode;
++
+     initscr ();
+ 
+ #ifdef HAVE_ESCDELAY
+@@ -159,11 +161,15 @@ tty_init (gboolean slow, gboolean ugly_lines)
+     ESCDELAY = 200;
+ #endif /* HAVE_ESCDELAY */
+ 
++    tcgetattr (STDIN_FILENO, &mode);
+     /* use Ctrl-g to generate SIGINT */
+-    cur_term->Nttyb.c_cc[VINTR] = CTRL ('g');   /* ^g */
++    mode.c_cc[VINTR] = CTRL ('g');  /* ^g */
+     /* disable SIGQUIT to allow use Ctrl-\ key */
+-    cur_term->Nttyb.c_cc[VQUIT] = NULL_VALUE;
+-    tcsetattr (cur_term->Filedes, TCSANOW, &cur_term->Nttyb);
++    mode.c_cc[VQUIT] = NULL_VALUE;
++    tcsetattr (STDIN_FILENO, TCSANOW, &mode);
++
++    /* curses remembers the "in-program" modes after this call */
++    def_prog_mode ();
+ 
+     tty_start_interrupt_key ();
+ 
+-- 
+1.8.3.1
+
diff --git a/recipes-extended/mc/mc_4.7.5.2.bb b/recipes-extended/mc/mc_4.7.5.2.bb
index b38964d..cf2ad8e 100644
--- a/recipes-extended/mc/mc_4.7.5.2.bb
+++ b/recipes-extended/mc/mc_4.7.5.2.bb
@@ -10,6 +10,7 @@ PR = "r3"
 
 SRC_URI = "http://www.midnight-commander.org/downloads/${BPN}-${PV}.tar.bz2 \
            file://mc-CTRL.patch \
+           file://0001-Ticket-3697-tty_init-unify-curses-initialization.patch \
            "
 
 SRC_URI[md5sum] = "bdae966244496cd4f6d282d80c9cf3c6"
-- 
2.8.1




More information about the yocto mailing list