Problem 1268

Summary: "ARGS: Subscript out of range." when sourcing geant4.csh from .tcshrc
Product: Geant4 Reporter: jasondet
Component: cmakeAssignee: Ben Morgan <Ben.Morgan>
Status: CLOSED FIXED    
Severity: minor CC: Giovanni.Santin
Priority: P5    
Version: 9.5   
Hardware: All   
OS: All   

Description jasondet 2011-12-09 23:17:43 CET
When I source the new geant4.csh made by cmake from my .tcshrc, I get the error

ARGS: Subscript out of range.

A google search for this message revealed discussions about a similar error in ROOT, in which it was explained that the self-location code used in the script requires the script to be sourced from a shell prompt, not from within another script. As I complained on the ROOT forum, I think this defeats one of the key purposes of having this script in the first place:

http://root.cern.ch/phpBB3/viewtopic.php?f=3&t=11742&p=59559

Could it please be edited so that it can once again be sourced from a login script?

Thanks,
Jason
Comment 1 Ben Morgan 2011-12-12 09:33:32 CET
We'll look at fixing this, though other use cases do require the self-location functionality.
Comment 2 Giovanni.Santin 2012-04-16 15:00:08 CEST
For information, I am having exactly the same problem on a SLES11 64bit machine with tcsh shell. I have a set of custom scripts for the initialisation of Geant4 and all related libraries and ancillary software.

The script geant4.csh works fine only if I source it directly from the tcsh prompt, but it fails if sourced indirectly (from my general Geant4 init tcsh scripts).

The problem is a showstopper, actually, as there is no way to source geant4.csh directly from the prompt for batch jobs.
Comment 3 Ben Morgan 2012-05-29 19:58:04 CEST
Fixed in r58945 [cmake-V09-05-18].

The scripts can now be sourced inside others, and in this case you either have to do

cd script_dir ; source geant4.csh

or

source script_dir/geant4.csh script_dir

This need to supply extra info is due to the limitations of the C-shell. If the script can locate itself using the above, it will print an error message, but will not fail or make any changes to the environment.

Should be in 9.6.0beta.