kenorb kenorb - 3 months ago 8x
Bash Question

How to activate sh DTrace Provider?

I've found out about patches (and updates) for an x86 sh binary in 2007 to support sh DTrace provider.

However I can't find any probes on OS X. I'm checking by:

$ sudo dtrace -l | grep command-entry

See: /bin/sh DTrace Provider at Oracle site (same article on blog)

Maybe because my
is the same as GNU bash?

$ /bin/sh --version
GNU bash, version 3.2.57(1)-release (x86_64-apple-darwin15)

Where these probes were implemented, how I can find them or how I can activate them?

Were there only implemented on Solaris?


The patches you refer to were specific to the bourne shell on Solaris, and as far as I know nothing like it has ever been ported to other shells.

In the illumos (née OpenSolaris) commit history, we can see that /bin/sh was changed to be a symlink to ksh93 in commit ead1f93 on March 2, 2010. Considering that Alan's blog post is dated 2007, this wasn't included in Solaris 10, at least not initially since Solaris 10 was released in 2005. It may be in one of the updates post 2007 but I sort of doubt it. From the existing code, I can't even find what provided /bin/sh before the switch to ksh, which might mean it was one of the closed bits.

Either way, it was never part of any illumos release and I don't see any references to dtrace probes for command-entry in the illumos commit history. Unless Alan or somebody else close to the matter can speak up, it's probably lost to time.

In summary, as near as I can tell these patches were never included in any released product from Sun or otherwise. It will almost certainly have to be reimplemented from scratch on any existing open source shell.