distcc wrap script trouble and fix

Hendrik Visage hvisage at envisage.co.za
Mon Mar 3 22:32:08 GMT 2003


HI there,

 The newer (SInce ~1.1) distccs are very sensitive to recursive
invocations. 

 The problem is that some configure/makefiles have a few cases that it appears 
to double append the PATH variables. This would mean that the standard
lunar distcc scripts have more than one /var/lib/lunar/compiler in the
path, which the current wrapper scripts doesn;t handle correctly, as theyt
only remove the first instance.

 Here is a proposed test script to show the problems that the current script
doesn't address, and a proposed solution that would fix it (all??)

GReetz
Hendrik



#!/bin/bash

#Horrible path with all the possible (AFAIK) troubles that
#The distcc script might encounter:

PATH=/var/lib/lunar/compilers:/var/lib/lunar/compilers:/var/lib/lunar/compilers:/var/lib/lunar/compilers:/bin:/sbin:/var/lib/lunar/compilers:/usr/bin:/var/lib/lunar/compilers:/var/lib/lunar/compilers:/var/lib/lunar/compilers:/var/lib/lunar/compilers:/var/lib/lunar/compilers

echo standard lunar expansion:
echo ${PATH/\/var\/lib\/lunar\/compilers:/}
echo
echo proposed fix

#First remove all the /var/lib/lunar/compilers:
TEMP=${PATH//\/var\/lib\/lunar\/compilers/}
# Now we'll have to remove :: as well as prefixed and trailing : to
#Make sure security is addressed ;^)
until [ "$TEMP" == "$PATH" ]
 do
  PATH=$TEMP
  TEMP=${PATH//::/:}
 done
PATH=${PATH/%:/}
PATH=${PATH/#:/}
echo $PATH



More information about the Lunar mailing list