Welcome to iraf.net Thursday, May 02 2024 @ 01:35 PM GMT
mcba |
09/17/2018 07:31AM (Read 755 times)
|
|
|
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
|
|
|
|
mcba |
09/17/2018 10:55PM
|
|
|
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
|
|
|
|
| |
|
Content generated in: 0.04 seconds |
|