Bug#228926: /var/lib/dpkg/info/tetex-bin.postinst: line 209: 5576: Permission denied
Matt Zimmerman <mdz@debian.org> wrote:
> I think the problem is with the expression "$LDAT_$$". I think what you
> wanted was to concatenate $LDAT, "_" and $$, but this expression is expanded
> as "$LDAT_" (which is empty) concatenated with "$$" (expanded to the PID).
> This would create a file in the cwd, which is probably what caused te
> problem.
>
> I suggest using tempfile or mktemp from debianutils (which is essential).
So here's a better script. I've tested on my computer with a couple of
combinations in dpkg-reconfigure tetex-bin. The "changes" in the last
lines are only changes in whitespace, and I didn't manage to get the old
format back - I guess my editor changed some tabs to spaces or vice
versa.
--- tetex-bin-2.0.2/debian/postinst.orig Fri Jan 23 14:16:19 2004
+++ tetex-bin-2.0.2/debian/postinst Fri Jan 23 13:37:00 2004
@@ -1,4 +1,4 @@
-#!/bin/sh
+#!/bin/sh -x
set -e
@@ -189,46 +189,87 @@
{ mkdir "$vardir/source" && chmod 1777 "$vardir/source"; }
fi
-# language.dat handling
+# language.dat handling, first a helper function
+uncomment_ldat(){
+ pattern="$1"
+ TMP_LDAT=`tempfile`
+
+ newpattern=${pattern#%! }
+ sed -e "s/$pattern/$newpattern/" $LDAT > $TMP_LDAT
+ chown --reference=$LDAT $TMP_LDAT
+ chmod --reference=$LDAT $TMP_LDAT
+ mv $TMP_LDAT $LDAT
+}
+
db_get tetex-bin/use_debconf || true
if [ "$RET" = "true" ]; then
# rename unused language.dat
- if [ -f ${ELDAT} ]; then mv -f ${ELDAT} ${ELDAT}.dpkg-old; fi
- if [ -f ${DFLT} ]; then
- cp -f ${DFLT} ${LDAT}
- rm -f ${LDATD}/language.dat
- (cd ${LDATD} ; ln -s ${LDAT} .)
- fi
- db_get tetex-bin/hyphen || true
- IFS=' ,'
- lang="$RET"
- for l in $lang; do
- case $l in
- none) cp -f $DFLT $LDAT ;;
- british) sed -e "s/%! british ukhyphen.tex/british ukhyphen.tex/" $LDAT | sed -e "s/%! =UKenglish/=UKenglish/" > $LDAT_$$; mv $LDAT_$$ $LDAT ;;
- french\[=patois\]) sed -e "s/%! french/french/" $LDAT | sed -e "s/%! =patois/=patois/" > $LDAT_$$; mv $LDAT_$$ $LDAT ;;
- german\[=austrian-alte_Rechtschreibung\]) sed -e "s/%! german/german/" $LDAT | sed -e "s/%! =austrian/=austrian/" > $LDAT_$$; mv $LDAT_$$ $LDAT ;;
- ngerman\[=naustrian-neue_Rechtschreibung\]) sed -e "s/%! ngerman/ngerman/" $LDAT | sed -e "s/%! =naustrian/=naustrian/" > $LDAT_$$; mv $LDAT_$$ $LDAT ;;
- norsk\[old\]) sed -e "s/%! norsk nohyph.tex/norsk nohyph.tex/" $LDAT > $LDAT_$$; mv $LDAT_$$ $LDAT ;;
- norsk\[nohyphb\.tex\]) sed -e "s/%! norsk nohyphb.tex/norsk nohyphb.tex/" $LDAT > $LDAT_$$; mv $LDAT_$$ $LDAT ;;
- norsk\[nohyphbc\.tex\]) sed -e "s/%! norsk nohyphbc.tex/norsk nohyphbc.tex/" $LDAT > $LDAT_$$; mv $LDAT_$$ $LDAT ;;
- ukrainian\[ukrhyph\.tex\]) sed -e "s/%! ukrainian ukrhyph.tex/ukrainian ukrhyph.tex/" $LDAT > $LDAT_$$; mv $LDAT_$$ $LDAT ;;
- ukrainian\[ukrhyph\.t2a\]) sed -e "s/%! ukrainian ukrhyph.t2a/ukrainian ukrhyph.t2a/" $LDAT > $LDAT_$$; mv $LDAT_$$ $LDAT ;;
- ukrainian\[ukrhyph\.lcy\]) sed -e "s/%! ukrainian ukrhyph.lcy/ukrainian ukrhyph.lcy/" $LDAT > $LDAT_$$; mv $LDAT_$$ $LDAT ;;
- ukrainian\[ukrhyph\.ot2\]) sed -e "s/%! ukrainian ukrhyph.ot2/ukrainian ukrhyph.ot2/" $LDAT > $LDAT_$$; mv $LDAT_$$ $LDAT ;;
- *) sed -e "s/%! $l/$l/" $LDAT > $LDAT_$$; mv $LDAT_$$ $LDAT ;;
- esac
- done
+ if [ -f ${ELDAT} ]; then mv -f ${ELDAT} ${ELDAT}.dpkg-old; fi
+ if [ -f ${DFLT} ]; then
+ cp -f ${DFLT} ${LDAT}
+ rm -f ${LDATD}/language.dat
+ (cd ${LDATD} ; ln -s ${LDAT} .)
+ else
+ exit 1 # tetex-base not installed?
+ fi
+ db_get tetex-bin/hyphen || true
+ IFS=' ,'
+ lang="$RET"
+ for l in $lang; do
+ case $l in
+ none) ;; # $DFLT has been copied before
+ british)
+ uncomment_ldat "%! british ukhyphen.tex"
+ uncomment_ldat "%! =UKenglish"
+ ;;
+ french\[=patois\])
+ uncomment_ldat "%! french frhyph.tex"
+ uncomment_ldat "%! =patois"
+ ;;
+ german\[=austrian-alte_Rechtschreibung\])
+ uncomment_ldat "%! german dehypht.tex"
+ uncomment_ldat "%! =austrian"
+ ;;
+ ngerman\[=naustrian-neue_Rechtschreibung\])
+ uncomment_ldat "%! ngerman dehyphn.tex"
+ uncomment_ldat "%! =naustrian"
+ ;;
+ norsk\[old\])
+ uncomment_ldat "%! norsk nohyph.tex"
+ ;;
+ norsk\[nohyphb\.tex\])
+ uncomment_ldat "%! norsk nohyphb.tex"
+ ;;
+ norsk\[nohyphbc\.tex\])
+ uncomment_ldat "%! norsk nohyphbc.tex"
+ ;;
+ ukrainian\[ukrhyph\.tex\])
+ uncomment_ldat "%! ukrainian ukrhyph.tex"
+ ;;
+ ukrainian\[ukrhyph\.t2a\])
+ uncomment_ldat "%! ukrainian ukrhyph.t2a"
+ ;;
+ ukrainian\[ukrhyph\.lcy\])
+ uncomment_ldat "%! ukrainian ukrhyph.lcy"
+ ;;
+ ukrainian\[ukrhyph\.ot2\])
+ uncomment_ldat "%! ukrainian ukrhyph.ot2"
+ ;;
+ *)
+ uncomment_ldat "%! $l"
+ ;;
+ esac
+ done
else
- if [ ! -f ${ELDAT} ]; then
- if [ -f ${ELDAT}.dpkg-old ]; then
- mv ${ELDAT}.dpkg-old ${ELDAT}
- else
- cp ${DFLT} ${ELDAT}
- fi
+ if [ ! -f ${ELDAT} ]; then
+ if [ -f ${ELDAT}.dpkg-old ]; then
+ mv ${ELDAT}.dpkg-old ${ELDAT}
+ else
+ cp ${DFLT} ${ELDAT}
fi
- rm -f ${LDATD}/language.dat
- (cd ${LDATD} ; ln -s ${ELDAT} .)
+ fi
+ rm -f ${LDATD}/language.dat
+ (cd ${LDATD} ; ln -s ${ELDAT} .)
fi
if [ -e $TEXCONFIG_P -a -e /usr/share/texmf/dvips/config ]
Regards, Frank
--
Frank Küster, Biozentrum der Univ. Basel
Abt. Biophysikalische Chemie
Reply to: