malc_p@btinternet.com wrote:
> HP-UX 11i, IDS 9.30HC5
>
> Afternoon chaps
> We have an SPL which is failing to run here - it's a fairly simple one
> used to call a shell script when executed, code as follows:
>
> CREATE FUNCTION "dba".request_proj(env CHAR(5),user CHAR(12), pref INT,
> cref INT
> )
>
> RETURNING INT;
>
>
>
> DEFINE path CHAR(50);
>
> DEFINE error_num INT;
>
> DEFINE error_val INT;
>
>
>
> ON EXCEPTION
>
> SET error_num,error_val
>
> END EXCEPTION WITH RESUME
>
>
> LET error_val = 0;
>
>
> LET path =
> '/opt/'||TRIM(env)||'/progs/general/interfaces/proj_request/'
> ;
<herring colour="red">
Since path is CHAR(50) and '/opt/' plus '/progs/...st/' is 44 characters
long (if I counted correctly), you have a truncation problem - unless
the value of TRIM(env) is 6 or less characters long. So the path you
think you're executing is not the one you're actually trying to execute.
The system did its best to tell - no such file or directory.
Now, granted, env is CHAR(5)...so this isn't very significant - beyond
observing that you are dreadfully close to having truncation problems.
</herring>
> SYSTEM TRIM(path)||'proj_request.sh ' ||TRIM(env)||' '||user||'
> '||
> pref||' '||cref;
>
>
> RETURN error_val;
>
>
> END FUNCTION;
>
> .... and it's failing with a return code of -2, and the following is
> put into the IDS message log:
>
> 11:26:09 execve() of " -c
> /opt/ROBIN/progs/general/interfaces/proj_request/proj_request.sh ROBIN
> inetuser 290 1002678" failed errno=2
>
> This is palpably rubbish - the -2 error is "No such file or directory"
> but the file is there - I've even set the access perms on it and it's
> path to 777.
> Does anyone know what execve() is doing?
Trying to execute an a.out executable program; proj_request.sh looks
like it might be shell script. Unless it starts with #!/bin/sh, that is
not going to fly with execve(). Even if it does start like that, it
might depend on your o/s.
--
Jonathan Leffler #include <disclaimer.h>
Email:
jleffler@earthlink.net,
jleffler@us.ibm.com
Guardian of DBD::Informix v2005.02 --
http://dbi.perl.org/