bug-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Read builtin -e (readline) oddities


From: Eduardo A . Bustamante López
Subject: Read builtin -e (readline) oddities
Date: Sun, 18 Jun 2017 20:39:08 -0500
User-agent: NeoMutt/20170113 (1.7.2)

I'm trying to figure out a way to fuzz >>read -e -d ""<<, without having the
fuzzer break due to the temporary files created by fc.

While doing this, I noticed the oddities described below.


#1
Hit `C-x C-e' twice.  The value of PATH seems to be ignored for the second
line.

  address@hidden:~$ PATH= read -e
  
  bash: vim: No such file or directory
  
  echo hi
  hi


#2
Spurious `;'s are inserted into the history.

  address@hidden:~$ history -c
  address@hidden:~$ PATH= read -e
  
  bash: vim: No such file or directory
  
  echo hi
  hi
  
  address@hidden:~$ history
      1  PATH= read -e; ; 
      2  echo hi
      3  history


#3
Hit `C-x C-e' thrice. Also, the mapping of `\C-m' became `self-insert' instead
of `accept-line'.

  address@hidden:~$ PATH= EDITOR=: read -e -d ''
  
  PATH= EDITOR=: read -e -d ''; 
  
  fc -e "${VISUAL:-${EDITOR:-$(command -v editor || echo emacs)}}"
  : /tmp/bash-fc.IZAzmF
  PATH= EDITOR=: read -e -d ''; ; 
  bash: syntax error near unexpected token `;'
  
  fc -e "${VISUAL:-${EDITOR:-$(command -v editor || echo emacs)}}"
  vim /tmp/bash-fc.35ePED
  ^M^M^C
  address@hidden:~$ ^M^M^M^M^M^M^M^M



In relation to my fuzzing goal, it seems this is what I wanted:

  address@hidden:~$ (enable -n fc; read -e -d '')
  
  bash: fc: command not found
  
  bash: fc: command not found
  
  bash: fc: command not found
  
  bash: fc: command not found
  
  bash: fc: command not found
  ^C

-- 
Eduardo Bustamante
https://dualbus.me/



reply via email to

[Prev in Thread] Current Thread [Next in Thread]