Summary:ASTERISK-03239: AGI scripts with bad interpreters reported as "no such file"
Reporter:dale_au (dale_au)Labels:
Date Opened:2005-01-10 05:48:41.000-0600Date Closed:2011-06-07 14:10:01
Versions:Frequency of
Description:AGI scripts which fail to run because of a bad interpreter in the script have the error incorrectly reported on the asterisk console.

Trying to run the AGI script on the command prompt:
su-2.05b# /usr/local/share/asterisk/agi-bin/agi-bash-test.sh
su: /usr/local/share/asterisk/agi-bin/agi-bash-test.sh: /usr/bin/bash: bad interpreter: No such file or directory

Error reported on Asterisk console when it tries to run it:
'/usr/local/share/asterisk/agi-bin/agi-bash-test.sh': No such file or directory
Comments:By: Clod Patry (junky) 2005-01-10 05:51:10.000-0600

It's probably an error in your file. Can ya attach it?
And most of the time, agi is tested with calling that script with AGI(file) in dialplan.

edited on: 01-10-05 05:52

By: dale_au (dale_au) 2005-01-10 06:29:35.000-0600

I know that its an error in the file that was causing the problems..  The bug was that the error reported on the asterisk console ("No such file or directory") is incorrect, because the file exists, it just wont execute because it has a bad interpreter.

edited on: 01-10-05 06:44

By: Clod Patry (junky) 2005-01-10 07:17:08.000-0600

Attach your file (agi-bash-test.sh) for futher assistance.

By: Mark Spencer (markster) 2005-01-10 08:13:34.000-0600

This program:

#include <errno.h>
#include <strings.h>
#include <unistd.h>
#include <stdlib.h>

int main(int argc, char *argv[])
       execl("./foo.sh", "./foo.sh", NULL);
       printf("Error is %s\n", strerror(errno));

Proves that errno is actually set to "no such file or directory"

[root@lappy root]# ./foo.sh
bash: ./foo.sh: /bin/foo: bad interpreter: No such file or directory
[root@lappy root]#

Also indicates that it is "no such file or directory"...

Ergo, this is not a bug, or if you still think it's a bug, take it up with glibc :)