From 57c098b60853707866641c71a7a78541c621ca4c Mon Sep 17 00:00:00 2001
From: Koichi Murase <myoga.murase@gmail.com>
Date: Wed, 18 Dec 2019 19:34:36 +0800
Subject: [PATCH] unbind_keyseq: check shadow bindings for
 "bash_execute_unix_command"

---
 builtins/bind.def | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/builtins/bind.def b/builtins/bind.def
index ea1f47cf..f5ef88fc 100644
--- a/builtins/bind.def
+++ b/builtins/bind.def
@@ -370,6 +370,7 @@ unbind_keyseq (seq)
   char *kseq;
   int kslen;
   rl_command_func_t *f;
+  int type;
 
   kseq = (char *)xmalloc ((2 * strlen (seq)) + 1);
   if (rl_translate_keyseq (seq, kseq, &kslen))
@@ -378,11 +379,13 @@ unbind_keyseq (seq)
       builtin_error (_("`%s': cannot unbind"), seq);
       return EXECUTION_FAILURE;
     }
-  if ((f = rl_function_of_keyseq_len (kseq, kslen, (Keymap)0, (int *)0)) == 0)
+  if ((f = rl_function_of_keyseq_len (kseq, kslen, (Keymap)0, &type)) == 0)
     {
       free (kseq);
       return (EXECUTION_SUCCESS);
     }
+  if (type == ISKMAP)
+    f = ((Keymap) f)[ANYOTHERKEY].function;
 
   /* I wish this didn't have to translate the key sequence again, but readline
      doesn't have a binding function that takes a translated key sequence as
-- 
2.21.0

