Hi, there is some inconsistency in fink's init scripts: init.csh and init.sh behave differently w.r.t. prepend_path. This was already touched upon indirectly in another thread that I started (http://www.mail-archive.com/fink-users@lists.sourceforge.net/msg31924.html), but I wanted to start a new thread devoted to this problem by itself. I am not at all an expert in shell programming, so I could be wrong with my findings, please correct me in that case.
Among others, these scripts build the correct paths for fink users. Perhaps the most important one is PATH itself, that should contain /sw/bin:/sw/sbin at the front after their completion. The scripts intend to prepend this string. In init.csh, the string to be prepended to PATH is not just prepended, but any other occurence of the string in any position, is removed. This means that you end up with a cleaned up PATH. (There seems to be a flaw however: if PATH already contains multiple occurences of /sw/bin:/sw/sbin, and one of them occurs at the front, then these multiple occurences are not removed). In init.sh, the string is prepended to the PATH if it's not already present (at any position). Nothing is cleaned up. That means that if the PATH originally had /sw/bin:/sw/sbin in a wrong position, nothing changes, while the idea is to have /sw/bin:/sw/sbin: at the front. This inconsistency becomes apparent on my machine (10.6.2 with Xquartz 2.3.4) because somewhere in the scripts that build the PATH during login with xterm, /usr/libexec/path_helper screws up things and generates a PATH with /sw/bin:/sw/sbin somewhere in the middle, and this PATH is then finally used by init.sh. If I would have used csh instead of bash, I wouldn't have noticed the problem. And if path_helper would work as advertised in it's man page, there would also be no problem. This is a suggestion for a new prepend_path function to replace the original one in init.sh: prepend_path() { eval "$1=$2:`eval echo '$'$1 | /usr/bin/sed -e s%^\$2:%% -e s%:\$2:%:%g -e s%:\$2$%%`" } I have tested this with bash and it seems to work but I don't know how it works with other bash like shells. Does anyone know if the different behaviour of init.sh and init.csh was intended or is this a bug? Patrick ------------------------------------------------------------------------------ Download Intel® Parallel Studio Eval Try the new software tools for yourself. Speed compiling, find bugs proactively, and fine-tune applications for parallel performance. See why Intel Parallel Studio got high marks during beta. http://p.sf.net/sfu/intel-sw-dev _______________________________________________ Fink-users mailing list Fink-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/fink-users