Bug 9850 - dtrace: Incorrect shell execution
Summary: dtrace: Incorrect shell execution
Status: RESOLVED FIXED
Alias: None
Product: systemtap
Classification: Unclassified
Component: runtime (show other bugs)
Version: unspecified
: P2 normal
Target Milestone: ---
Assignee: Unassigned
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2009-02-15 21:25 UTC by Eugeniy Meshcheryakov
Modified: 2009-02-16 14:21 UTC (History)
0 users

See Also:
Host:
Target:
Build:
Last reconfirmed:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Eugeniy Meshcheryakov 2009-02-15 21:25:35 UTC
dtrace -G uses shell to execute gcc:

    call("gcc -fPIC -c " + fn + " -o " + filename, shell=True)

This makes directories with spaces problematic:

% mkdir a\ directory
% cd a\ directory
% touch test.d
% ../dtrace -G -s $PWD/test.d
gcc: directory/test.o: No such file or directory

Better way is to use python equivalent of execlp(3) or execvp(3).
Comment 1 Mark Wielaard 2009-02-16 13:54:23 UTC
I made it so that call passes a list of arguments so that spaces aren't a
problem in:

commit c0d0d86876a3763492b3f4054961e9c850e9c216
Author: Mark Wielaard <mjw@redhat.com>
Date:   Mon Feb 16 14:50:02 2009 +0100

    PR 9850, use a list of arguments for call.

But you will still have to quote things like $PWD on the command line to get
them as whole arguments to python (otherwise the shell seems to split them into
multiple arguments anyway). So using this now works:
../dtrace -G -s "$PWD/test.d"
as does
../dtrace -G -s ../a\ directory/test.d

Is this enough?

I am not sure how to get the behaviour you want without quoting the $PWD
variable in the shell.
Comment 2 Eugeniy Meshcheryakov 2009-02-16 14:18:29 UTC
Subject: Re:  dtrace: Incorrect shell execution

16 лютого 2009 о 13:54 -0000 mjw at redhat dot com написав(-ла):
> But you will still have to quote things like $PWD on the command line to get
> them as whole arguments to python (otherwise the shell seems to split them into
> multiple arguments anyway).
Hmm, not my shell (zsh)... But others realy do so.

> So using this now works:
> ../dtrace -G -s "$PWD/test.d"
> as does
> ../dtrace -G -s ../a\ directory/test.d
> 
> Is this enough?
Yep, this is enough.
Comment 3 Mark Wielaard 2009-02-16 14:21:29 UTC
It is enough! :)