develooper Front page | perl.perl5.porters | Postings from January 2008

Re: dtrace and Perl (again)

Thread Previous | Thread Next
From:
Andy Dougherty
Date:
January 9, 2008 05:22
Subject:
Re: dtrace and Perl (again)
Message ID:
Pine.LNX.4.64.0801090805080.4776@fractal.phys.lafayette.edu
On Wed, 9 Jan 2008, David Cantrell wrote:

> On Tue, Jan 08, 2008 at 02:27:58PM +0000, Andy Armstrong wrote:
> 
> > Thanks Andy - that's going to be a big help. The "did we get the right  
> > dtrace" problem is a slight concern. We could run it and see what it  
> > does - but what if dtrace is a script that someone's created to delete  
> > a bunch of files (for example). Hmm.
> 
> You have the same problem if someone has written a script called cc or
> ld or ...

Well yes, but since Unix systems have shipped with programs called 'cc' 
and 'ld' for decades, those are essentially 'reserved words', and 
Configure can reasonably expect that the first 'cc' found in PATH probably 
does the right thing.  Same for 'grep' and 'sed', and all the other usual 
Unix commands.

'dtrace' is different.  It didn't exist 20 years ago, so people such as 
myself were free to use that name for something else.  It's the familiar 
new-keywords-break-backwards-compatibility problem.

Anyway, there's also apparently the issue that not all 'dtrace's are 
equivalent.  I don't know if there are "new" and "old" versions, but there 
are apparently at least two flavors.

In short, if possible, actually testing whether 'dtrace' works before 
using it makes sense, if that testing can be done without too much pain.

> But how about something like -Dusedtrace=/path/to/dtrace if the user
> wants to specify it, but have it default to the known location of dtrace
> as installed by their OS vendor otherwise?

Yes, something like that is what I had in mind.  (I'll, of course, need to 
find out what those "known locations" are, but that's a detail to be 
filled in later.)  The ability to override with a command line option is a 
general feature of nearly all Configure variables, so that comes along for 
free.

My idea is this:  First, honor a command line.  Next, look in known 
locations for the particular operating system.  Finally, look in $PATH.

Then, if sensible, try to test it somehow.  I don't have dtrace, so I
don't actually know how easy that is to do, but that too can be
deferred.

Apologies if this is all obvious.

-- 
    Andy Dougherty		doughera@lafayette.edu

Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About