On Fri, Nov/03/2006 09:54:06AM, Jeff Squyres wrote: > On Nov 3, 2006, at 9:46 AM, Ethan Mallove wrote: > > >> So just to confirm -- this works: > >> > >> command = ./configure --with-mpi-dir=&test_prefix(); gmake > >> > >> Right? > > > > Right. I still like doing trim_quotes before returning, so > > that we're more forgiving in allowing ''both'' of these: > > > > shell_build_command = configure --with-mpi-dir=&test_prefix(); gmake > > shell_build_command = "configure --with-mpi-dir=&test_prefix(); gmake" > > But what if there are cases where I *do* want quotes? > > I'm more in favor of being as literal as possible. What > you type for the shell_build_command will be directly > launched. This provides greater flexiblity for if you > *do* need quotes. For example: > > shell_build_command = ./configure "CFLAGS=-g -O" > > In this case you definitely do not want to remove the quotes. > > More specifically, proper quoting handling is a really, > really tricky task and I don't really want to tackle it. > :-) >
Ah, sorry I was unclear. trim_quotes (not strip_quotes) will remove only leading and trailing quotes. But right, it would wreck something like this: shell_build_command = ./configure &my_cflags() If you wanted the above to expand to: shell_build_command = ./configure "CFLAGS=-g -O" My last proposal would be this: --- Index: lib/MTT/DoCommand.pm =================================================================== --- lib/MTT/DoCommand.pm (revision 411) +++ lib/MTT/DoCommand.pm (working copy) @@ -194,6 +194,11 @@ select STDOUT; $| = 1; + # Remove leading/trailing quotes, which + # protects against a common funclet syntax error + @$tokens[0] =~ s/^\"+//; + @$tokens[(@$tokens - 1)] =~ s/\"+$//; + # Run it! exec(@$tokens) || @@ -323,6 +328,11 @@ $max_stdout_lines, $max_stderr_lines) = @_; my ($fh, $filename) = tempfile(); + + # Remove leading/trailing quotes, which + # protects against a common funclet syntax error + $cmds =~ s/^\"+|\"+$//g; + print $fh ":\n$cmds\n"; close($fh); chmod(0700, $filename); ---- Point taken about being literal. My thinking is that most will be only guessing about the quoting mechanism of funclets (as I was for a bit), and there would never be a real case for sending '"cmd"' to exec(). -Ethan > -- > Jeff Squyres > Server Virtualization Business Unit > Cisco Systems > > _______________________________________________ > mtt-users mailing list > mtt-us...@open-mpi.org > http://www.open-mpi.org/mailman/listinfo.cgi/mtt-users