I was swapping some readline settings in my .bashrc earlier today and mistyped the following (bind since it's not in .inputrc):

bind "mark-symlinked-directories on"

I forgot to put a set in there before mark-symlinked-directories, the end result of which was that my "d" key stopped working in the terminal. Lame. Some messing around with other bindings indicated that whatever the first letter of the last "word" was would be unusable, i.e.,

bind "page-completions off" messed up c

bind "visible-stats on" messed up s

bind "completion-query-items 42" messed up i

My question is why? What is bind doing that renders those keys useless, and why that specific key?

  • 1
    Weird! I just tried this and get the same behavior. Note that D does actually work, it is just not printed. For example, Ctrl+D to exit the shell works as expected despite not being able to type D. – terdon Feb 17 '14 at 13:56

why i cannot provide an answer why this happens, it seems that if the 1st token of the readline command contains one or several dashs (-), then the character following the last dash will be unbound from the self-insert command.

e.g. the following will disable the p key.

bind foo-bar-paz zill-honk
  • 1
    I haven't checked the source to confirm, but I think I know why. Readline parses the argument as MODIFIER1-MODIFIER2-MAINKEY, ignores unknown modifiers, and treats the first character of MAINKEY as the key. This looks like insufficient input validation, not at all like intended behavior. – Gilles Feb 17 '14 at 23:31
  • @Gilles If you can find something to back that up would you make it a separate answer so I can credit you? – Amory Feb 19 '14 at 15:15
  • @Amory This would require reading the source or checking the bug list. I don't have time for either at the moment. I actually encourage you to check the bug list, and if you find nothing, report this as a bug. – Gilles Feb 19 '14 at 15:27

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.