[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: LTP: [nstraz@sgi.com: Re: [LTP] 2 commands (mkfifo & growfiles) in fs fail]


Instead of blindly using system(), you could determine
if there where any shell metachacters in the command line.
(i.e. such as '>', '<', '$', '|', etc.)
If there is, then use a system() like exec.
I.e.  execlp("sh", "sh", "-c", cmdline, 0);

just an idea.

Rich Logan

Nathan Straz wrote:
> Oops, I just realized I didn't send this to the list.
> ----- Forwarded message from Nathan Straz <nstraz@sgi.com> -----
> Date: Mon, 8 Jan 2001 16:09:47 -0600
> From: Nathan Straz <nstraz@sgi.com>
> To: cheryl benek <cbenek@timesys.com>
> Subject: Re: [LTP] 2 commands (mkfifo & growfiles) in fs fail
> User-Agent: Mutt/1.3.12i
> On Mon, Jan 08, 2001 at 04:05:54PM -0500, cheryl benek wrote:
> > When running ltp for the first time, I noticed that it failed on the command
> > line from the fs command examples: "mkfifo gffifo17; growfiles -b -e 1 -u -i
> > 0 -L 30 gffifo17" complaining "mkfifo: invalid option -- b".  It doesn't
> > appear that pan handles multiple commands like that.  Am I correct?
> Yes, you're right.  Pan reads in the line, splits it up into works and
> runs the command with execvp().  What we should have done was throw the
> two commands in a shell script like so:
> #!/bin/sh
> mkfifo gffifo17
> growfiles -b -e 1 -u -i 0 -L 30 gffifo17
> and add that to the pan file.
> Using system() might allow such lines to work, but I didn't think of it
> when I was cleaning up the code.  It would be nice to add lines like
> that to pan file so you don't have to have a bunch of little wrapper
> scripts laying around.  If I get some free time I may look into it.  If
> you beat me to it, please post a patch.  :)
> Now I think I'll find a paper bag to put over my head.
> --
> Nate Straz                                              nstraz@sgi.com
> sgi, inc                                           http://www.sgi.com/
> Linux Test Project                    http://oss.sgi.com/projects/ltp/
> ----- End forwarded message -----

Richard Logan                               OS Test Development
SGI                                         E-mail: rrl@sgi.com
655F Lone Oak Drive                         Voice : 651-683-5844
Eagan, MN 55121-1560                        Fax   : 651-683-5599