Skip to content

Running ble.sh With Oil

andychu edited this page Jul 17, 2024 · 17 revisions

Related: How Interactive Shells Work

This is issue #653, in particular the list of tasks in this comment.

Bugs Found by Running Ble.sh

  • Zulip 49. BUG \return 0 doesn't work
  • Zulip 51. BUG option -i in declare -i v=1+2+3+4 is silently ignored

Features Needed to Run Ble.sh

  • bind -x to get user input. Can we do something simpler/better at first?
  • #647 NYI: declare -p, etc.
    • declare, declare -p (#671)
    • declare -f, type function
    • trap, trap -p
  • #653 16. NYI: read -t timeout / builtin sleep #684
  • #680 trap -l
  • #653 19. NYI: let (#622)
  • #653 28. NYI: declare -iluc and flags iluc in ${var@a}
  • #653 32. NYI: LC_CTYPE (or Binary manipulations) (#527 and #529)
  • #1069 39. NYI: EPOCHREALTIME, SECONDS, and other dynamic variables
  • #1069 40. BUG: a=(declare v); "${a[@]}" fails
  • Zulip 45. NYI sparse array

Others

  • #652 CONSISTENCY: Check declare -A d=([k]=v)
  • #654 DOC: redefinable builtins?
  • #653 22. COMPAT: builtin declare doesn't work (#654)
  • #653 24. COMPAT/ERRMSG: Oil tries to execute the first path in PATH for an empty command (#690)
  • #653 35. COMPAT: Oil session closed by exec non-existent-command

Done

≦ 2024

Bugs

NYI

  • read -t 0 (Or select/poll-like feature)
    • what C function do we want to wrap? select() on the terminal?
  • #146 NYI: mapfile / readarray ★ (tests #666)
  • #701 44. NYI nocasematch (Fix #1718)
0.8.pre5

Bugs Found by Running Ble.sh

  • #653 30. BUG: ${arr[@]::0} prints all the elements
  • #653 33. BUG: Redirection of 2 is persistent after : 2>/dev/null >&30 (Fix #723)
  • #653 37. BUG: {fd}>&- does not close the fd (Fix #723)
  • #724 BUG: Digits in $((base#num)) are reversed
  • #726 BUG: ${#BASH_SOURCE} and ${BASH_SOURCE:offset:length} count array elements.
  • #729 BUG: Result of IFS= read -n 1 char disappears
  • #731 BUG: declare -a arr removes existing arrays

Features Needed to Run Ble.sh

  • #653 26. NYI: Dynamic unset (#706 Tests #718) ★
  • #653 31. COMPAT: shopt for $ARRAY? ★ (Fix #728)
  • #653 34. NYI: $BASHPID (or Current subshell PID)
  • #727 NYI 1?a=1:1 (Ref #712)
  • #728 NYI: shopt for $ARRAY? ★ (Additional fix #733)
  • #730 NYI: printf %d \' for NUL
Before 0.8.pre5
  • #620 NYI: return 2>/dev/null
  • #637 CONSISTENCY: type return
  • #537 NYI: test -k (#649)
  • #640 NYI: ((${prefix}a=${prefix}b)) (cf #644 #670) ★★
  • #651 NYI: unset -v 'a[0]' ★★
  • #653 1. CONSISTENCY: default [[ -o emacs ]] in interactive sessions ★
  • #653 2. NYI: $FUNCNAME / $BASH_LINENO (#656)
  • #653 3. BUG: ${*:offset} (#658)
  • #653 4. BUG: ${!prefix@} self-rewrites (#657)
  • #653 5. CONSISTENCY: declare -A dict=() (#661) ★★
  • #653 6. NYI: exec 5<> a.pipe (cf #223 #667 #672)
  • #653 7. NYI: exec {fd}> a.txt (cf #223 #672)
  • #653 8. NYI: exec 5>&- (cf #223 #667 #672)
  • #653 9. NYI: read -d '' (#356 #665) ★
  • #653 10. ERRMSG: builtin read
  • #653 11. NYI: trap -- ... / eval -- ... (#662) ★★
  • #653 12. NYI: printf '%()T' (cf #650 #668)
  • #653 13. BUG: ${var=x}
  • #653 14. DOC: Bash/Oil diff
    • #648 recursive arithmetic evaluation ☆ (tests #686)
    • #664 ERRMSG: error inside $((a))
  • #653 15. NEWFEAT: OIL_VERSION / OIL_VERSINFO? #683
  • #653 17. BUG: ${arr[0]=x} (#660) ★
  • #653 18. BUG? An empty variable in recursive arithmetic evaluation produces fatal error (e379b61)
  • #653 20. BUG ${!prefix@} fails when prefix matches with an array name (daab1d6)
  • #653 21. BUG ${x/^} crashes (dbf9e00)
  • #653 23. BUG: declare -F funcname doesn't accept non-alphanumeric characters in funcname ★★ (ec62c8a)
  • #653 25. NYI: Attributes ${var@a} (#689)
  • #653 27. NYI: flags rx in ${var@a} (14548dc)
  • #653 36. BUG: read fails on empty lines (#705) ★★

Try out ble.sh with Oil

Currently, ble.sh does not fully work on Oil. Only a part can be run for testing purpose.

Clone ble.osh

$ git clone --recursive http://github.com/akinomyoga/ble.sh -b osh ble.osh
$ cd ble.osh
$ make

Update ble.osh

The branch osh is occasionally force-pushed so need to be forcibly updated by git reset --hard or git checkout -B. Please be careful not to have your own commits in osh branch or edits in the working tree before running the following commands. They will be lost. You need to save your changes in another branch.

$ cd ble.osh
$ git fetch origin
$ git checkout -B osh origin/osh
$ make

Try unit tests for ble/util

$ cd ble.osh
$ osh --rcfile oshrc.test-util

Try read -e by ble.sh

The builtin read -e (read with line editor) is emulated by ble.sh. Minimal initialization for testing read -e is available with oshrc.read in osh branch of ble.sh.

$ cd ble.osh
$ osh --rcfile oshrc.read
$ read -e

Specify prompt (-p) and initial contents (-i):

$ read -e -p '[\u@\h \W]\$ ' -i 'echo hello'
Clone this wiki locally