[OS X TeX] Query the PATH [was: local vs. global symlink]

Maarten Sneep maarten.sneep at xs4all.nl
Fri Dec 1 09:28:21 EST 2006


On 30-nov-2006, at 23:42, Jérome Laurens wrote:

> Finally, I remembered why using the login-shell PATH is dangerous  
> and not recommanded
>
> Suppose PATH starts with ".", the current directory will be the  
> first one searched by the terminal
> Combined with the write18 feature, it is a security hole
> The write18 can execute an apparently guenuine action, that is  
> really overriden in the current directory and can do quite anything  
> on your data

I think you can set the PATH from within write18, which places the  
burden in a different location. In any case, the current directory  
should never be in the PATH, and most certainly not as the first  
item, at least not for background operation.

I think if the shell-script snippet starts with:

#!/bin/bash

shname="x$(basename $SHELL)"
if [ "x$shname" = "xcsh" -o "x$shname" = "xtcsh" ] ; then userpath=$ 
($SHELL -c -l 'echo $path' | sed 's/:\.:/:/g'); else userpath=$ 
($SHELL -c -l 'echo $PATH' | sed 's/:\.:/:/g'); fi
PATH=$userpath

and calls whatever tools are needed here, you get a cleaned up  
version of the PATH, usable in a sh/bash environment.

Maarten
------------------------- Info --------------------------
Mac-TeX Website: http://www.esm.psu.edu/mac-tex/
          & FAQ: http://latex.yauh.de/faq/
TeX FAQ: http://www.tex.ac.uk/faq
List Archive: http://tug.org/pipermail/macostex-archives/




More information about the MacOSX-TeX mailing list