2011-02-23 19:33:41 UTC
I have found an issue with how DTrace handles the #pragma D depends_on
option when using dtrace -Lpath to add additional directories. I have
confirmed that this is a problem on illumos and OS X 10.6.6. Presumably
it also affects FreeBSD.
When looking for a dependency it does not search the entire path to try
and resolve it, but rather only the local directory. So if you have a
file with the following:
#pragma D depends_on procfs.d
that was in another directory, say, /home/rm/local/lib/dtrace, DTrace
will only look for procfs.d in /home/rm/local/lib/dtrace/procfs.d and
never anywhere else on the library path, which includes /usr/lib/dtrace
where the file resides.
Attached is a patch that applies cleanly to Illumos. This patch searches
the entire libdir path for the file using the first one that it finds.
This patch also adds a DTest that catches this issue.
This patch was developed at Joyent with review from Bryan Cantrill. It
is copyright by Joyent and licensed under the CDDL. It should apply
cleanly to the Mac OS X and FreeBSD codebases. If people from the
respective communities would like me to file bugs or there is some other
process to facilitate this fix getting out there, please let me know.