Problem with a System call . . . .
Posted in 2011
An Informix 10 stored procedure on HP-UX used SYSTEM to run a shell script; it worked for some clients but others got "System command cannot be executed / Not owner" (SQL -668 with ISAM -1). Jonathan Leffler explained the script's exit status is negated and reported as the ISAM error, so a non-zero exit triggers -668. Art Kagel noted the SYSTEM call runs as the connecting user, not informix, so that user needs execute/access rights on the script and any files it touches. The poster confirmed the cause was permissions on a temp file used by the script.
Auto-generated by DrWatson from the posts below — may be imperfect; read the full thread.
Topics: Stored Procedures & SPL, Connectivity: ODBC / JDBC / .NET, Platform-Specific Issues
We are currently running informix 10.00.HC9 on a HP-UX 11iv2 machine and are having an issue with a stored procedure that executes a shell script. When the stored procedure is executed via ODBC on some client machines everything works correctly. When executed on others, we get get and error message stating: System command cannot be executed Not owner As far as I can tell, there is nothing inherently wrong with the shell script, it runs fine when executed by hand and when I call it using the stored procedure via JDBC in Squirrel. When a colleague does the same using Aqua and JDBC, it errors out. Any thoughts on what to check next? -- -------------------------------------------- Chris Salch Programmer/Analyst Programming Services LeTourneau University 903-233-3537 | 903-233-3500 http://www.letu.edu | http://www.twitter.com/letuit
On Wed, Aug 31, 2011 at 11:54, chrissalch <chrissalch@letu.edu> wrote:
> We are currently running informix 10.00.HC9 on a HP-UX 11iv2 machine and
> are having an issue with a stored procedure that executes a shell
> script. When the stored procedure is executed via ODBC on some client
> machines everything works correctly. When executed on others, we get
> get and error message stating:
>
> System command cannot be executed
>
Error -668.
> Not owner
>
Error +1 and -1...
As far as I can tell, there is nothing inherently wrong with the shell
> script, it runs fine when executed by hand and when I call it using the
> stored procedure via JDBC in Squirrel. When a colleague does the same
> using Aqua and JDBC, it errors out. Any thoughts on what to check next?
>
The problem is likely that the exit status of the shell script is not fully
determinate; sometimes it exits with status 0 (not triggering any error) and
sometimes with an exit status of 1 (triggering the error). You can probably
eliminate the warnings by ensuring that the shell script consistently exits
with status 0 when everything goes according to plan.
You can also try triggering a syntax error by exiting with status 201:
CREATE PROCEDURE test_system(e INTEGER DEFAULT 0)
DEFINE cmd CHAR(30);
LET cmd = '/tmp/exit_with ' || e;
SYSTEM cmd;
END PROCEDURE;
The script /tmp/exit_with contains simply:
exit ${1:-0}
and is executable, of course.
SQL[1495]: execute procedure test_system();
SQL -668: The system command cannot be executed or it exited with a non-zero
status.
ISAM -126: ISAM error: bad row id
SQL[1496]: !chmod +x /tmp/exit_with
SQL[1497]: r 1495;
SQL[1498]: execute procedure test_system(1);
SQL -668: The system command cannot be executed or it exited with a non-zero
status.
ISAM -1: Not owner
SQL[1499]: execute procedure test_system(201);
SQL -668: The system command cannot be executed or it exited with a non-zero
status.
ISAM -201: A syntax error has occurred.
As you can see, the exit status is negated and treated as an error...
--
Jonathan Leffler <jonathan.leffler@gmail.com> #include <disclaimer.h>
Guardian of DBD::Informix - v2011.0612 - http://dbi.perl.org
"Blessed are we who can laugh at ourselves, for we shall never cease to be
amused."
--00151759364a38ad3704abd21faa
It's going to depend on the userid that the client is using to connect to the server. When an SPL routine shells out it does so as the user running the routine, not as user "informix", so that user has to have execute privileges on the shell script that is being executed and on any resources that the shell script tries to access like files. Art Art S. Kagel Advanced DataTools (www.advancedatatools.com) Blog: http://informix-myview.blogspot.com/ Disclaimer: Please keep in mind that my own opinions are my own opinions and do not reflect on my employer, Advanced DataTools, the IIUG, nor any other organization with which I am associated either explicitly, implicitly, or by inference. Neither do those opinions reflect those of other individuals affiliated with any entity with which I am affiliated nor those of the entities themselves. On Wed, Aug 31, 2011 at 2:54 PM, chrissalch <chrissalch@letu.edu> wrote: > We are currently running informix 10.00.HC9 on a HP-UX 11iv2 machine and > are having an issue with a stored procedure that executes a shell > script. When the stored procedure is executed via ODBC on some client > machines everything works correctly. When executed on others, we get > get and error message stating: > > System command cannot be executed > > Not owner > > As far as I can tell, there is nothing inherently wrong with the shell > script, it runs fine when executed by hand and when I call it using the > stored procedure via JDBC in Squirrel. When a colleague does the same > using Aqua and JDBC, it errors out. Any thoughts on what to check next? > > -- > -------------------------------------------- > Chris Salch > Programmer/Analyst > Programming Services > LeTourneau University > 903-233-3537 | 903-233-3500 > http://www.letu.edu | http://www.twitter.com/letuit > > > > ******************************************************************************* > Forum Note: Use "Reply" to post a response in the discussion forum. > > --bcaec52994bbda3eb604abd34c7f
It's a pain under windows, you have to have permission to execute at the = OS level, which means that you have to go through the connect process = first. Scripting "connect" is a pain. j. On Aug 31, 2011, at 4:52 PM, Art Kagel wrote: > It's going to depend on the userid that the client is using to connect = to=20 > the server. When an SPL routine shells out it does so as the user = running=20 > the routine, not as user "informix", so that user has to have execute=20= > privileges on the shell script that is being executed and on any = resources=20 > that the shell script tries to access like files.=20 >=20 > Art=20 >=20 > Art S. Kagel=20 > Advanced DataTools (www.advancedatatools.com)=20 > Blog: http://informix-myview.blogspot.com/=20 >=20 > Disclaimer: Please keep in mind that my own opinions are my own = opinions and=20 > do not reflect on my employer, Advanced DataTools, the IIUG, nor any = other=20 > organization with which I am associated either explicitly, implicitly, = or by=20 > inference. Neither do those opinions reflect those of other = individuals=20 > affiliated with any entity with which I am affiliated nor those of the=20= > entities themselves.=20 >=20 > On Wed, Aug 31, 2011 at 2:54 PM, chrissalch <chrissalch@letu.edu> = wrote:=20 >=20 >> We are currently running informix 10.00.HC9 on a HP-UX 11iv2 machine = and=20 >> are having an issue with a stored procedure that executes a shell=20 >> script. When the stored procedure is executed via ODBC on some client=20= >> machines everything works correctly. When executed on others, we get=20= >> get and error message stating:=20 >>=20 >> System command cannot be executed=20 >>=20 >> Not owner=20 >>=20 >> As far as I can tell, there is nothing inherently wrong with the = shell=20 >> script, it runs fine when executed by hand and when I call it using = the=20 >> stored procedure via JDBC in Squirrel. When a colleague does the same=20= >> using Aqua and JDBC, it errors out. Any thoughts on what to check = next?=20 >>=20 >> --=20 >> --------------------------------------------=20 >> Chris Salch=20 >> Programmer/Analyst=20 >> Programming Services=20 >> LeTourneau University=20 >> 903-233-3537 | 903-233-3500=20 >> http://www.letu.edu | http://www.twitter.com/letuit=20 >>=20 >>=20 >>=20 >>=20 > = **************************************************************************= *****=20 >> Forum Note: Use "Reply" to post a response in the discussion forum.=20= >>=20 >>=20 >=20 > --bcaec52994bbda3eb604abd34c7f=20 >=20 >=20 > = **************************************************************************= *****=20 > Forum Note: Use "Reply" to post a response in the discussion forum.=20= >=20
Close, it turned out to be permissions on a temp file. This clued me in though. Thanks! On Wed, 2011-08-31 at 16:52 -0400, Art Kagel wrote: > It's going to depend on the userid that the client is using to connect to > the server. When an SPL routine shells out it does so as the user running > the routine, not as user "informix", so that user has to have execute > privileges on the shell script that is being executed and on any resources > that the shell script tries to access like files. > > Art > > Art S. Kagel > Advanced DataTools (www.advancedatatools.com) > Blog: http://informix-myview.blogspot.com/ > > Disclaimer: Please keep in mind that my own opinions are my own opinions and > do not reflect on my employer, Advanced DataTools, the IIUG, nor any other > organization with which I am associated either explicitly, implicitly, or by > inference. Neither do those opinions reflect those of other individuals > affiliated with any entity with which I am affiliated nor those of the > entities themselves. > > On Wed, Aug 31, 2011 at 2:54 PM, chrissalch <chrissalch@letu.edu> wrote: > > > We are currently running informix 10.00.HC9 on a HP-UX 11iv2 machine and > > are having an issue with a stored procedure that executes a shell > > script. When the stored procedure is executed via ODBC on some client > > machines everything works correctly. When executed on others, we get > > get and error message stating: > > > > System command cannot be executed > > > > Not owner > > > > As far as I can tell, there is nothing inherently wrong with the shell > > script, it runs fine when executed by hand and when I call it using the > > stored procedure via JDBC in Squirrel. When a colleague does the same > > using Aqua and JDBC, it errors out. Any thoughts on what to check next? > > > > -- > > -------------------------------------------- > > Chris Salch > > Programmer/Analyst > > Programming Services > > LeTourneau University > > 903-233-3537 | 903-233-3500 > > http://www.letu.edu | http://www.twitter.com/letuit > > > > > > > > > ******************************************************************************* > > Forum Note: Use "Reply" to post a response in the discussion forum. > > > > > > --bcaec52994bbda3eb604abd34c7f > > > ******************************************************************************* > Forum Note: Use "Reply" to post a response in the discussion forum. > > > -- -------------------------------------------- Chris Salch Programmer/Analyst Programming Services LeTourneau University 903-233-3537 | 903-233-3500 http://www.letu.edu | http://www.twitter.com/letuit
Great! Glad you found it! Like I said: "and on any resources that the shell script tries to access like files". Art Art S. Kagel Advanced DataTools (www.advancedatatools.com) Blog: http://informix-myview.blogspot.com/ Disclaimer: Please keep in mind that my own opinions are my own opinions and do not reflect on my employer, Advanced DataTools, the IIUG, nor any other organization with which I am associated either explicitly, implicitly, or by inference. Neither do those opinions reflect those of other individuals affiliated with any entity with which I am affiliated nor those of the entities themselves. On Mon, Sep 5, 2011 at 3:38 PM, chrissalch <chrissalch@letu.edu> wrote: > Close, it turned out to be permissions on a temp file. This clued me in > though. > > Thanks! > > On Wed, 2011-08-31 at 16:52 -0400, Art Kagel wrote: > > It's going to depend on the userid that the client is using to connect to > > the server. When an SPL routine shells out it does so as the user running > > the routine, not as user "informix", so that user has to have execute > > privileges on the shell script that is being executed and on any > resources > > that the shell script tries to access like files. > > > > Art > > > > Art S. Kagel > > Advanced DataTools (www.advancedatatools.com) > > Blog: http://informix-myview.blogspot.com/ > > > > Disclaimer: Please keep in mind that my own opinions are my own opinions > and > > do not reflect on my employer, Advanced DataTools, the IIUG, nor any > other > > organization with which I am associated either explicitly, implicitly, or > by > > inference. Neither do those opinions reflect those of other individuals > > affiliated with any entity with which I am affiliated nor those of the > > entities themselves. > > > > On Wed, Aug 31, 2011 at 2:54 PM, chrissalch <chrissalch@letu.edu> wrote: > > > > > We are currently running informix 10.00.HC9 on a HP-UX 11iv2 machine > and > > > are having an issue with a stored procedure that executes a shell > > > script. When the stored procedure is executed via ODBC on some client > > > machines everything works correctly. When executed on others, we get > > > get and error message stating: > > > > > > System command cannot be executed > > > > > > Not owner > > > > > > As far as I can tell, there is nothing inherently wrong with the shell > > > script, it runs fine when executed by hand and when I call it using the > > > stored procedure via JDBC in Squirrel. When a colleague does the same > > > using Aqua and JDBC, it errors out. Any thoughts on what to check next? > > > > > > -- > > > -------------------------------------------- > > > Chris Salch > > > Programmer/Analyst > > > Programming Services > > > LeTourneau University > > > 903-233-3537 | 903-233-3500 > > > http://www.letu.edu | http://www.twitter.com/letuit > > > > > > > > > > > > > > > > ******************************************************************************* > > > Forum Note: Use "Reply" to post a response in the discussion forum. > > > > > > > > > > --bcaec52994bbda3eb604abd34c7f > > > > > > > > ******************************************************************************* > > Forum Note: Use "Reply" to post a response in the discussion forum. > > > > > > > > -- > -------------------------------------------- > Chris Salch > Programmer/Analyst > Programming Services > LeTourneau University > 903-233-3537 | 903-233-3500 > http://www.letu.edu | http://www.twitter.com/letuit > > > > ******************************************************************************* > Forum Note: Use "Reply" to post a response in the discussion forum. > > --90e6ba21241d4b484404ac36e9cd