Louis Erickson said:
: $cmd = "pogmaker";
: $command = "$cmd $part $befo $fute $cols $redd >output.txt &";
: $command =~ /(.*)/;
: $command = $1;
: $ENV{"PATH"}="/bin:/usr/bin";
: delete @ENV{'IFS','CDPATH','ENV','BASH_ENV'};
: # print "Taint checks seem to be on<br>"
: # unless eval { local $^W; unlink "$^X$^T"; 1 };
: $rez = system($command);
: FYI, the print "Taint.... does not indicate that taint is on by
: printing.
Then I suspect taint is not on. Why do you think taint is on?
The behaviour - runs if used in ('cmd',$parm,$parm,etc) form, but not
if in ("$cmd $parm $parm etc.") form. This behavior is described
fairly closely in perlsec as a consequence of taint being in effect.
No such behavior is described in, or referenced from,
functions/system(), however, which I consider a rather severe
oversight. Taint is not mentioned or referenced either, which it
probably should be.
<ASIDE> I find the perl documentation to be pretty poor in general...
WAY too many assumptions made about what the reader knows, not enough
example code and often, what example code you find there is pretty
darned opaque. I'd offer to contribute, I actually write pretty good
documentation, but the fact that I'm still looking IN the perl
documentation more often than not probably makes me a poor
candidate... sure wish someone would give that stuff a professional
going over. I love perl, but the docs... ugh.</ASIDE>
Also, in perlsec, the following remark is found near the top:
"Perl automatically enables a set of special security checks, called
taint mode, when it detects its program running with differing real
and effective user or group IDs."
....the implication seems to be that taint mode could get turned on
very late, right at the point where the command is invoked, even if it
wasn't on previously. That also leads me to think that taint might be
screwing with things, even if the latest check prior to launch I can
make clearly indicates it isn't.
: pogmaker is in /usr/bin, has execute permission for anyone, owned by
: root.
: pogmaker absolutely will not run.
Why not?
Dunno. That's what this is all about.
Have you checked the return values from system?
Yes, indeed. system() returns 0, and $! is empty.
See perldoc -f system to get how to decode the error values from
system to make sure it's working,
Not much decoding required. 0 is 0 even when you divide it by 256.
and check your server logs for
any messages to stderr indicating possible problems from
your program itself.
None. Also no indication that the program is running when diagnostics
like create a flag file, sleep for a while so I can look in the
process list are added... it's simply not running. When it does run,
it can run even with no parameters and come up with sensible (but
pointless) output. If I call it as system('cmd',$parm,$parm) it runs
perfectly (but runs too long, I need to fork it either from the
shell's interpretation of & or directly.) If I hack the command to
immediately exit(1), I get 256 as expected in the perl script, as a
return from system(). Change the perl to system("$cmd $parm $parm etc)
and I get nothing.
Additional info that might bear on people thinking on why something
might not run: My program is compiled from c, is relatively small
(about 29k) and is running in a 2 GHz, 1 Gb RH9 system with tons of
available resources. Once it is running, it talks to the PostgreSQL
postmaster in the usual ways, but that's way, way after I put the
diagnostics in - no dependance upon PostgreSQL servers involved, for
absolute certain. I can't get the first line of code to run even when
it's exit(1) if the system call is used with one parameter for shell
evaluation.
Thanks for your previous and potential future response(s.)
--Ben