Welcome to iraf.net Thursday, May 02 2024 @ 01:35 PM GMT


 Forum Index > Help Desk > General IRAF New Topic Post Reply
 IRAF host scripting fails with segmentation violation when calling command defined by task
   
mcba
 09/17/2018 07:31AM (Read 755 times)  
+----
Newbie

Status: offline


Registered: 08/05/2006
Posts: 11
Hi guys,

I'm trying to use an IRAF command in a bash script, so I am creating a file like this:

#!/home/mcba/miniconda3/envs/iraf27/iraf/bin.linux/ecl.e -f
task $hello=/home/mcba/iraf/hello.e
imhead g.fits
hello
logout

When I run this, the "imhead" command works fine, but the "hello" command results in:

ERROR: segmentation violation
called as: `cl ()'
Error while reading login.cl file - may need to rebuild with mkiraf
Fatal startup error. CL dies.

Interestingly, the cl doesn't get as far as even looking at hello.e. I can replace the above task line with

task $hello=dummy

and I get exactly the same error message. But if I use $dummy, then hello gets passed straight to bash.

Presumably there is some problem with an environment variable somewhere, but I can't find it. The fact that the imhead comand works OK indicated that my environment can't be too wrong.

Thanks in advance for any help,
Michael

 
Profile Email
 Quote
mcba
 09/17/2018 10:55PM  
+----
Newbie
happy

Status: offline


Registered: 08/05/2006
Posts: 11
OK, I found the problem.

The environment variable "arch" wasn't defined (and isn't apparently used by the miniconda version of IRAF). When IRAF tries to execute a task it first checks various locations for the binary, even if you specify exactly where it is with a task statement. In ecl/exec.c there is a line

arch = envget ("arch");

and if the environment variable "arch" isn't defined, the internal variable "arch" will be NULL, which then causes a segmentation violation at line 764 when it is used in a strstr copy.

The workaround is to call your routine at the bash command prompt with

arch= routine_name

This will ensure that "arch" is defined immediately before running routine_name (and then returned to its previous definition, or lack thereof, afterwards).

Note: I debugged this using

gdb ecl.e
task $hello=/home/mcba/iraf/hello.e
hello

and then using "where" to find out where the segvio occurred.

Regards, Michael

 
Profile Email
 Quote
   
Content generated in: 0.04 seconds
New Topic Post Reply

Normal Topic Normal Topic
Sticky Topic Sticky Topic
Locked Topic Locked Topic
New Post New Post
Sticky Topic W/ New Post Sticky Topic W/ New Post
Locked Topic W/ New Post Locked Topic W/ New Post
View Anonymous Posts 
Anonymous users can post 
Filtered HTML Allowed 
Censored Content 
dog allergies remedies cialis 20 mg chilblain remedies


Privacy Policy
Terms of Use

User Functions

Login