Bug in Tcsh?
One problem I run into alot at work is with Dynamic/Shared libraries on Unix. Especially with code I compile & install in my home directory, trying to get other people to run it successfully usually runs into lots of problems with making sure the LD_LIBRARY_PATH and LD_LIBRARY64_PATH are set properly, and sometimes lots of other stuff. ParaView frequently requires that I set TCL_LIBRARY to where the init.tcl is, some tools want to be in the PATH, and various other problems that I always forget to tell people about until they’ve run it once and seen it die.
To get around this, I’ve started encapsulating alot of programs with shell scripts to automatically set these variables. ezViz (my frequent guinea pig for this sort of thing) is being wrapped with a shell script like this:
| #!/bin/tcsh -f setenv LD_LIBRARY_PATH dir1:dir2:dir3:${LD_LIBRARY_PATH} /u/rhand/local/bin/`basename $0`-real $* |
Pretty simple. It’s a tcsh script that first adds a few directories to the beginning of the LD_LIBRARY_PATH, then kicks off a program in my local/bin (appending -real to the filename) and passes all the arguments with the $* specifier. I call this ezVizPathFinder, and rename all the real ezViz binaries to append -real at the end. I then create symlinks to this shell script it for every ezViz program. It provides a single point where I can add/remove environment changes to keep things working, and it’s completely transparent to the user.
Until I found a bug. I had written a TCL script to iterate calls to this shell script with changing parameters over a large number of datasets. I found that if I passed an argument with a wildcard in it (In this case it was a formula: "newx=cos(angle)*Coord_X – sin(angle)*Coord_Y"), the wildcard would be expanded by the shell script, resulting in strange "ezVizGeneric-real: no match found" errors.
I was never able to find a suitable way to fix this. No amount of escaping (adding ‘s and quotes) seemed to help, whether in the formulae or in the shell-script. Finally, I simply switched from tcsh to bash, and now the script looks like this:
| #!/bin/bash -f LD_LIBRARY_PATH=dir1:dir2:dir3:${LD_LIBRARY_PATH} /u/rhand/local/bin/`basename $0`-real $* |
Bash seems to handle this situation just fine, where tcsh/csh got confused. I know there has to be a way to fix this with csh, but I can’t figure it out. Any ideas?
[tag:bash][tag:tcsh][tag:csh][tag:shell][tag:unix][tag:linux]

