[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

The horrible infinite-loop detected bug



Ok, I have written some code that on upgrade of texlive-base in preinst
removes the offending lines from 10texlive-base-bin.cnf by commenting
them and gives a warning.

Maybe at least someone can review the code, give his comments, or whatever.

tmpfile=`mktemp`

oldfile=/etc/texmf/fmt.d/10texlive-base.cnf
newfile=/etc/texmf/fmt.d/10texlive-base.cnf

if [ -r $oldfile ] ; then
  found_firstline=0
  disable_from_now=0
  cat $oldfile | while read line ; do
    # we have to find those old lines
    case "$line" in
      "# The following added lines have been transferred from"*)
        found_firstline=1
        echo "$line" >> $tmpfile
        ;;
      "# /etc/texmf/fmt.d/10texlive-base-bin.cnf"*)
        echo "$line" >> $tmpfile
        if [ $found_firstline = 1 ] ; then
          # disable all following lines
          echo "# The following lines are disabled to protect loops" >> $tmpfile
          echo "# Please see Debian bug #557091 for details" >> $tmpfile
          disable_from_now=1
        fi
        ;;
      *)
        if [ $disable_from_now = 1 ] ; then
          echo "# $line" >> $tmpfile
        else
          echo "$line" >> $tmpfile
        fi
        ;;
    esac
  done
  echo "Some formats have been disabled in $oldfile" >&2
  echo "Please review the changes!" >&2
  mv $tmpfile $newfile
fi
  

Herzliche Grüße

Norbert
------------------------------------------------------------------------
Norbert Preining            preining@{jaist.ac.jp, logic.at, debian.org}
JAIST, Japan            TU Wien, Austria           Debian TeX Task Force
DSA: 0x09C5B094   fp: 14DF 2E6C 0307 BE6D AD76  A9C0 D2BF 4AA3 09C5 B094
------------------------------------------------------------------------
OZARK (n.)
One who offers to help just after all the work has been done.
			--- Douglas Adams, The Meaning of Liff


Reply to: