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

Re: Bug#269416: tetex-extra postinst lacks debconf loading

Frank Küster <frank@debian.org> wrote:

> At least this file shows the same error: VARTEXMF has been introduced by
> the postinst script, but is missing in the TEXMF definition.
> However, I cannot imagine how this happened, because the grep and sed
> regexpressions do match on the file as they should. And if the sed stuff
> would fail because of some other reason (permissions or disk space), it
> would give an other error and fail to configure.

I think I've found the culprit:

    mv $tempfile $$ETXMFC
(line 143 of tetex-bin 2.0.2's postinst)

So, Agustin must have some root-owned file with a name matching
[[:digit:]]+ETXMFC somewhere on his system...

Also, the logic below when you do the:

  if ! grep '^[[:space:]]*TEXMF' $ETXMFC | grep TEXMFMAIN >/dev/null; then

is a bit flawed because this matches lines such as:

TEXMFMAIN = /usr/share/texmf

You should probably use something like:

  if ! grep '^[[:space:]]*TEXMF[[:space:]]*=[^%]*\<TEXMFMAIN\>' \
         $ETXMFC >/dev/null; then

and similarly above with VARTEXMF although the same problem doesn't happen:

  if ! grep '^[[:space:]]*TEXMF[[:space:]]*=[^%]*\<VARTEXMF\>' \
         $ETXMFC >/dev/null; then

Finally, with a few cosmetic changes in the sed c command, that would
make the following patch (for the space right before the c command, I'm
not saying it's wrong; *I* just don't know, so *I* wouldn't use it...).
--- tetex-bin-2.0.2/debian/postinst	2004-09-02 21:58:56.000000000 +0200
+++ postinst.new	2004-09-04 14:58:06.000000000 +0200
@@ -111,12 +111,12 @@
     echo "An essential entry in /etc/texmf/texmf.cnf is missing. Fixing"
-    sed -e '/VARTEXMF = \/usr\/share\/texmf-var/ c\
-%   /VARTEXMF = /usr/share/texmf-var \
-% Debian uses this for storing files generated by updmap and fmtutil, since\
-% 2.0.2-17\
+    sed -e '/VARTEXMF = \/usr\/share\/texmf-var/c\
+%   VARTEXMF = /usr/share/texmf-var\
+% Debian uses this for storing files generated by updmap and fmtutil since\
+% tetex-bin 2.0.2-17.\
-% This variable was forcely introduced by the postinst script.\
+% This variable was forcibly introduced by the postinst script.\
 VARTEXMF = /var/lib/texmf' $ETXMFC > $tempfile
     chown --reference=$ETXMFC $tempfile
     chmod --reference=$ETXMFC $tempfile
@@ -124,9 +124,11 @@
 # And now the inclusion of VARTEXMF in TEXMF
-if ! grep '^[[:space:]]*TEXMF' $ETXMFC | grep VARTEXMF >/dev/null; then
+if ! grep '^[[:space:]]*TEXMF[[:space:]]*=[^%]*\<VARTEXMF\>' \
+       $ETXMFC >/dev/null; then
   # VARTEXMF is not in TEXMF
-  if ! grep '^[[:space:]]*TEXMF' $ETXMFC | grep TEXMFMAIN >/dev/null; then
+  if ! grep '^[[:space:]]*TEXMF[[:space:]]*=[^%]*\<TEXMFMAIN\>' \
+         $ETXMFC >/dev/null; then
     # not even TEXMFMAIN - this will not work at all
     echo "Found a local configuration in $ETXMFC that will break teTeX"
     echo "Exiting"
@@ -140,7 +142,7 @@
     sed -e '/^[[:space:]]*TEXMF/ s/!*$TEXMFMAIN/!!$VARTEXMF,!!$TEXMFMAIN/' $ETXMFC > $tempfile
     chown --reference=$ETXMFC $tempfile
     chmod --reference=$ETXMFC $tempfile
-    mv $tempfile $$ETXMFC
+    mv $tempfile $ETXMFC

Reply to: