(patch for Bash) dynamically loadable builtins

From: William Park (opengeometry_at_yahoo.ca)
Date: 08/29/04


Date: 29 Aug 2004 06:39:07 GMT

By popular demand, all my builtins have been converted to dynamically
loadables. This allows user to compile and load the builtins without
re-compiling the shell from scratch. Downside is that you have to
know where the .so file is, and remember what to load.

Ref:
    http://freshmeat.net/projects/bashdiff/
    http://home.eol.ca/~parkw/index.html#bash
    http://home.eol.ca/~parkw/bashdiff.tar.gz

bashdiff.tar.gz contains bunch of files:
    - bash.diff -- patch to the main core (like before)
    - examples/loadables/william/* -- loadable builtins

To compile the main core,

    wget ftp://ftp.gnu.org/pub/gnu/bash/bash-3.0.tar.gz # source tarball
or wget ftp://ftp.cwru.edu/pub/bash/bash-3.0.tar.gz
    tar -xzf bash-3.0.tar.gz
    mv bash-3.0 bash

    wget http://home.eol.ca/~parkw/bashdiff.tar.gz # my patch
    tar -xzf bashdiff.tar.gz
    cd bash
        patch -p1 < ../bash.diff
        autoconf
        ./configure
        make
        ./bash # Now you are in my Bash shell
        exit # back to your original shell

To compile the loadable builtins,

    cd examples/loadables/william
        make
        enable -f ./william.so vplot # load 'vplot' as builtin
        enable -d vplot # unload 'vplot'

Currently, there are 24 builtins, which can be listed by
    nm -D ./william.so | grep ' D '
So, for 'vplot' builtin, you will see 'vplot_struct'. Hell, there are
so many, even I can't remember them all.

I would appreciate any feedback or request. :-) Enjoy.

-- 
William Park <opengeometry@yahoo.ca>
Open Geometry Consulting, Toronto, Canada


Relevant Pages