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

Bug#263296: tetex-bin 2.0.2-17 broke "tex --parse-first-line"



On 04.08.04 Olaf Weber (olaf@infovore.xs4all.nl) wrote:
> Hilmar Preusse writes:
> > On 03.08.04 Benjamin BAYART (bayartb@sitadelle.com) wrote:

Hi *,

> >> tex --parse-first-line works fine up to version 2.0.2-16, and
> >> does not work anymore since 2.0.2-17.
> [...]
> 
> > Could you give us a little example, how such a file could look like
> > you want to compile here?
> 
> An example would be the sample2e.tex file, with a line containing
> just "%&latex" prepended.
> 
OK, thanks. I can reproduce the bug.

> The switch to using (pdf)etex as the engine for latex does affect what
> happens when -parse-first-line is used, and the engines in the current
> teTeX-beta will at least provide a usable diagnostic.
> 
> $ tex -parse-first-line sample2e.tex
> This is TeXk, Version 3.141592 (Web2C 7.5.3)
>  %&-line parsing enabled.
> ---! /var/lib/texmf/web2c/latex.fmt was written by pdfetex
> (Fatal format file error; I'm stymied)
> 
This is the error message I expect, instead of an :

! Undefined control sequence.
l.2 \documentclass

> A note to the debian maintainers: if you're going to use etex as
> the engine for latex, consider taking the makempx script from the
> current teTeX-beta; the script was modified so that if there is a
> "%&format" line it will use "format" for the TeX command instead of
> just "tex".
> 
OK thanks. I had a short look at the code -- looks OK. Unfortunately
I couldn't test it, cause I don't have a minimal input example for
makempx and actually I'm to lazy to create one. ;-(

> This allows the common case "%&latex" work.
> 
If anybody is using other formats than LaTeX when calling plain tex
--with parse-first-line I guess he has to create his own formats
using Knuth TeX. We'll document that more in detail in our package.
He is own his own anyway.

> As long as fmtutil is used to generate the formats, the existence
> of symlinks from format name to their proper engine is also
> guaranteed.
> 
We do so.

> When options like -parse-first-line are enabled (and regardless of
> _how_ they are enabled) the following happens:
> 
> - In the main banner line, a 'k' is appended to engine name.
> - An additional banner line is printed.
> 
<snip>
> 
> We (upstream) believe this satisfies the TeX license requirements (we
> don't falsely pretend to be TeX) without impeding usability (the name
> of the command remains 'tex', which we believe is not an issue as the
> license is agnostic w.r.t. how TeX is to be invoked).
> 
Thanks for clarification.

3 patches attached. makempx.in.diff should be added to patch-tmp. I
didn't test yet, if the package builds.

H. 
-- 
sigmentation fault
--- NEWS.Debian.orig	Mon Aug  2 17:20:15 2004
+++ NEWS.Debian	Thu Aug  5 14:26:07 2004
@@ -12,6 +12,14 @@
     Knuth's compiler, revert the changes there and modify the soft links
     in /usr/bin. Normally that should be not necessary, as e-TeX is fully
     compatible to Knuth's TeX.
+    If you use plain TeX (which is not yet e-TeX) with the option
+    --parse-first-line and call there other formats than plain TeX make
+    sure you've create the appropriate format files using Knuth TeX. I.e.:
+$format		tex		pattern-file		arguments
+    e.g. for LaTeX this reads:
+latex		tex		language.dat		latex.ini
+    in /etc/texmf/fmt.d/00tetex.cnf. This is not necessary for a normal
+    LaTeX call but for that special case.
 
    [1] http://article.gmane.org/gmane.comp.tex.latex.latex3/330
    [2] /usr/share/doc/texmf/etex/base/etex-man.pdf.gz
--- changelog.orig	Mon Aug  2 23:28:35 2004
+++ changelog	Thu Aug  5 14:35:23 2004
@@ -1,3 +1,11 @@
+tetex-bin (2.0.2-17.1) unstable; urgency=high
+
+  * update makempx from beta upstream. It calls now LaTeX when TeX is
+    called with --parse-first-line and %&latex is found in the first line.
+    See NEWS.Debian for details. (Closes: #263296)
+
+ -- Frank KÃŒster <frank@debian.org>  Mon,  2 Aug 2004 17:34:23 +0200
+
 tetex-bin (2.0.2-17) unstable; urgency=high
 
   * Change build-dependency from libtiff3g-dev, which has vanished from
--- tetex-bin-2.0.2/texk/web2c/mpware/makempx.in.orig	2003-02-09 14:30:48.000000000 +0000
+++ tetex-bin-2.0.2/texk/web2c/mpware/makempx.in	2004-08-05 11:08:20.000000000 +0000
@@ -1,11 +1,11 @@
 #!/bin/sh
-# '$Id: makempx.in,v 1.9 2001/10/26 13:22:46 olaf Exp $'
+# '$Id: makempx.in,v 1.16 2004/06/19 08:21:32 olaf Exp $'
 # Make an MPX file from the labels in a MetaPost source file,
 # using mpto and either dvitomp (TeX) or dmp (troff).
 # From John Hobby's original (though there's not much of it left by now).
 # Public domain.
 
-rcs_revision='$Revision: 1.9 $'
+rcs_revision='$Revision: 1.16 $'
 version=`set - $rcs_revision; echo $2`
 
 : ${DMP=dmp}
@@ -15,8 +15,7 @@
 : ${MPTOTEX='mpto -tex'}
 : ${MPTOTR='mpto -troff'}
 : ${NEWER=newer}
-: ${TEX='tex --parse-first-line'}
-: ${TROFF='eqn -d\$\$ | troff -Tpost'}
+: ${TROFF='eqn -Tpost -d\$\$ | troff -Tpost'}
 
 # convert relative path to absolute in $MAKEMPX_BINDIR:
 case "$MAKEMPX_BINDIR" in
@@ -89,10 +88,10 @@
   exit 1
 fi
 
-trap "rm -f mpx$$.* $ERRLOG; exit 4" 1 2 3 15
+trap "rm -f mpx$$.* \"$ERRLOG\"; exit 4" 1 2 3 15
 
 # If MPX file is up-to-date, do nothing.
-if $NEWER $MPFILE $MPXFILE; then
+if $NEWER "$MPFILE" "$MPXFILE"; then
 
   # Have to remake.
   # Step 0: Check typesetter mode for consistency.
@@ -104,12 +103,12 @@
   esac
   
   # Step 1: Extract typesetter source from MetaPost source.
-  if $MPTO $MPFILE >mpx$$.tex 2>$ERRLOG; then :;
+  if $MPTO "$MPFILE" >mpx$$.tex 2>"$ERRLOG"; then :;
     # success
   else
     # failure
     echo "$0: Command failed: $MPTO $MPFILE" >&2
-    cat $ERRLOG >&2
+    cat "$ERRLOG" >&2
     rm -f mpx$$.tex
     exit 1
   fi
@@ -119,20 +118,24 @@
   
   # Step 2: Run typesetter.
   if test "$mode" = tex; then
-    if test -r $MPTEXPRE; then
+    if test -r "$MPTEXPRE"; then
       # Prepend user file.
-      cat $MPTEXPRE mpx$$.tex >mpx$$.tmp
+      cat "$MPTEXPRE" mpx$$.tex >mpx$$.tmp
       mv mpx$$.tmp mpx$$.tex
     fi
 
+    test -z "$TEX" && \
+      TEX=`sed -n '1s/%\&[ 	]*\([^ 	
]*\).*$/\1 --parse-first-line/p;q' mpx$$.tex`
+    test -z "$TEX" && TEX='tex --parse-first-line'
+
     if $TEX --interaction=batchmode mpx$$.tex </dev/null >/dev/null; then
       WHATEVER_TO_MPX="$DVITOMP"
       INFILE=mpx$$.dvi
       INERROR=$DVIERR
     else
       # failure
-      mv -f mpx$$.tex $TEXERR
-      mv -f mpx$$.log $ERRLOG
+      mv -f mpx$$.tex "$TEXERR"
+      mv -f mpx$$.log "$ERRLOG"
       echo "$0: Command failed: $TEX $TEXERR; see $ERRLOG" >&2
       exit 2
     fi
@@ -144,7 +147,7 @@
       INERROR=$TROFF_OUTERR
     else
       # failure
-      mv -f mpx$$.i $TROFF_INERR
+      mv -f mpx$$.i "$TROFF_INERR"
       echo "$0: Command failed: cat $TROFF_INERR | $TROFF" >&2
       rm -f mpx$$.t
       exit 2
@@ -155,22 +158,22 @@
   fi
 
   # Step 3: Translate typesetter output to a MetaPost MPX.
-  if $WHATEVER_TO_MPX $INFILE $MPXFILE >$ERRLOG; then
+  if $WHATEVER_TO_MPX "$INFILE" "$MPXFILE" >"$ERRLOG"; then
     : # success
   else 
     # failure
-    mv -f $INFILE $INERROR
-    test $mode = troff && mv -f mpx$$.i $TROFF_INERR
+    mv -f "$INFILE" "$INERROR"
+    test $mode = troff && mv -f mpx$$.i "$TROFF_INERR"
     echo "$0: Command failed: $WHATEVER_TO_MPX $INERROR $MPXFILE" >&2
     # Better to remove $MPXFILE if something went wrong rather than
     # leaving behind an unfinished or unusable version since $NEWER
     # might think that all is fine if $MPXFILE exists.
-    rm -f $MPXFILE
-    cat $ERRLOG >&2
+    rm -f "$MPXFILE"
+    cat "$ERRLOG" >&2
     exit 3
   fi
 
-  rm -f $ERRLOG mpx$$.*
+  rm -f "$ERRLOG" mpx$$.*
 fi
 
 exit 0

Reply to: