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.

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


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

  dualbus@debian:~$ history -c
  dualbus@debian:~$ PATH= read -e
  
  bash: vim: No such file or directory
  
  echo hi
  hi
  
  dualbus@debian:~$ 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'.

  dualbus@debian:~$ 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
  dualbus@debian:~$ ^M^M^M^M^M^M^M^M



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

  dualbus@debian:~$ (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]