blog | oilshell.org

Release of OSH 0.6.pre5

2018-10-11

This is the latest version of OSH, a bash-compatible shell:

Please try it on your shell scripts and report bugs! To build and run it, follow the instructions in INSTALL.txt.

If you're new to the project, see Why Create a New Shell?.

In the last post on autocompletion, I hinted at what's new in this release. Read on for details.

Table of Contents
Highlights
Details
0.6.pre3
0.6.pre4
0.6.pre5
What's Next?
Appendices
Selected Release Metrics
Unimplemented Language Features
Hard Bugs Encountered in These Releases

This post summarizes the last three releases:

Highlights

Details

0.6.pre3

Under the hood:

0.6.pre4

Under the hood:

0.6.pre5

New metrics on the OPy compiler's bytecode:

Analyzing the bytecode with the R language improved my understanding of the compiler that I cobbled together. Explaining the above metrics metrics would make a good blog post. I discovered some inefficiencies, described in issue #180.

Language features for Completion:

Builtins for completion:

Bug fixes for completion:

f() {
  local x=1

  # The "globals" in lib.sh are now local!  Unless declared with -g.
  source lib.sh
}

Dev Tools:

Other:

$ opyc compile -emit-docstring=0 foo.py

What's Next?

To be honest, I'm burnt out on the interactive shell, and it's not done yet. I need help!

Leave a comment or chat with me on oilshell.zulipchat.com if you're experienced with both Python and shell, and want to help.

Here are some blog posts I should write:

Appendices

Selected Release Metrics

The new functionality above is reflected in the spec test metrics:

I also mentioned improvements in the OSH-to-Oil translations:

(Many translations are still incorrect, but they no longer fail by crashing!)

I want Oil's source to be compact and easily understandable. All these new features only cost us ~700 significant lines of code!

Including whitespace and comments:

Slight decrease in native code:

which results in a slightly smaller binary:

But the bytecode size went up, since there are more lines of Python:

Unimplemented Language Features

OSH is at the point where I implement features on demand. I won't go out of my way to implement a feature — a "real" shell script has to motivate it.

The only unhandled exceptions in the spec tests are now NotImplementedError for the following features:

Hard Bugs Encountered in These Releases

(1) Python's readline binding silently swallows exceptions in registered callbacks. Like the author of this blog post, I found this out the hard way.

(2) I hit another occurrence of the hardest bug: file descriptors silently getting clobbered, leading to a process that can't even print debug messages.

The underlying cause was that import random in Python opens /dev/urandom as a side effect. I fixed the bug by simply removing it, since it was an unnecessary transitive dependency caused by cgi.escape().

A shell interpreter is unique in that it must know about all file descriptors used by the process it runs in. It can't use libraries and frameworks that open files "behind its back".