Possible bug in cl.csh
jamesh wrote on Jun 02, 2009
(Note: edit for code examples, and general cleanup)
I hope this is the right place for this. I had a user today complaining that the -o and -old flags were non-functional when trying to invoke cl. I did some testing and checked the script ("cl.csh") and it seems that he was correct. Looks like the problem is in this section:
You've got two "else if" statements, and you never reach the second one. I hacked around a bit and this is fixable:
This still doesn't add any error checking (eg: what if someone specifies -e and -o? Only the $argv[1] is taken and the second flag is silently ignored.) but at least you can invoke the "old" mode successfully.
One could also go a step further, and incorporate all of the option handling (integrating the -v option), and warn if you're stacking incompatible options:
This section would have to be moved to after the determination of the IRAF root directory. Maybe it's too ambitious, but I'd love to see a fix in the next release (or a patch or something).
We're running NOAO Sun/IRAF Revision 2.14.1-EXPORT on Solaris 10, although I would think this would happen to everyone.
Cheers,
-James
I hope this is the right place for this. I had a user today complaining that the -o and -old flags were non-functional when trying to invoke cl. I did some testing and checked the script ("cl.csh") and it seems that he was correct. Looks like the problem is in this section:
# Determine CL binary to run based on how we were called.
set cl_binary = "ecl.e"
if (`echo $0 | egrep ecl` != "") then
set cl_binary = "ecl.e"
else if ($#argv > 0) then
if ("$argv[1]" == "-ecl" || "$argv[1]" == "-e") then
set cl_binary = "ecl.e"
endif
else if ($#argv > 0) then
if ("$argv[1]" == "-old" || "$argv[1]" == "-o") then
set cl_binary = "cl.e"
endif
endifYou've got two "else if" statements, and you never reach the second one. I hacked around a bit and this is fixable:
if (`echo $0 | egrep ecl` != "") then
set cl_binary = "ecl.e"
else if ($#argv > 0) then
if ("$argv[1]" == "-ecl" || "$argv[1]" == "-e") then
set cl_binary = "ecl.e"
else if ("$argv[1]" == "-old" || "$argv[1]" == "-o") then
set cl_binary = "cl.e"
endif
endifThis still doesn't add any error checking (eg: what if someone specifies -e and -o? Only the $argv[1] is taken and the second flag is silently ignored.) but at least you can invoke the "old" mode successfully.
One could also go a step further, and incorporate all of the option handling (integrating the -v option), and warn if you're stacking incompatible options:
if (`echo $0 | egrep ecl` != "") then
set cl_binary = "ecl.e"
else if ($#argv == 1) then
if ("$argv[1]" == "-ecl" || "$argv[1]" == "-e") then
set cl_binary = "ecl.e"
else if ("$argv[1]" == "-old" || "$argv[1]" == "-o") then
set cl_binary = "cl.e"
else if ("$argv[1]" == "-v" || "$argv[1]" == "-version" || \
"$argv[1]" == "-V" || "$argv[1]" == "--version") then
head -1 $iraf/unix/hlib/motd
exit 0
endif
else if ($#argv > 0) then
echo "Only one argument may be specified to cl"
exit 1
endifThis section would have to be moved to after the determination of the IRAF root directory. Maybe it's too ambitious, but I'd love to see a fix in the next release (or a patch or something).
We're running NOAO Sun/IRAF Revision 2.14.1-EXPORT on Solaris 10, although I would think this would happen to everyone.
Cheers,
-James
Mike Fitzpatrick wrote on Jun 02, 2009
Hi James,
Thanks for the report. I've merged the cl.csh scripts for both the PC/IRAF and Sun/IRAF systems and put the result in http://iraf.net/ftp/pub/cl.csh, you can download this and replace the version in the $iraf/unix/hlib directory. The script works correctly for PC-IRAF systems, this only affects the Sun/IRAF release. Let me know if you have any other problems.
Cheers,
-Mike
Thanks for the report. I've merged the cl.csh scripts for both the PC/IRAF and Sun/IRAF systems and put the result in http://iraf.net/ftp/pub/cl.csh, you can download this and replace the version in the $iraf/unix/hlib directory. The script works correctly for PC-IRAF systems, this only affects the Sun/IRAF release. Let me know if you have any other problems.
Cheers,
-Mike
jamesh wrote on Jun 02, 2009
Hi Mike,
Thanks for the fix! Csh hacking is not one of my favorite activities. The version you posted seems to resolve the -o|-old flag handling. Thanks again!
Cheers,
-James
Thanks for the fix! Csh hacking is not one of my favorite activities. The version you posted seems to resolve the -o|-old flag handling. Thanks again!
Cheers,
-James
Last post on Jun 02, 2009