Bug#313456: tetex-base: package configuration fails because of initex error
Marcin Owsiany <porridge@debian.org> wrote:
> I finally managed to reproduce it by doing apt-get install --reinstall
> tetex-base tetex-bin on that system. I got the same typescript that I initially
> submitted.
And I finally managed to get my head free from all the bug reports for
teTeX-3.0. Thanks for being patient.
> Then I tried the first of the failed commands directly from the command line.
> Here's the result:
>
> porridge@menel:/var/lib/texmf/web2c$ sudo pdftex -ini -translate-file=il2-pl -jobname=pdfmex-pl -progname=pdfmex-pl pdfmex.ini This is pdfTeX, Version 3.14159-1.10b (Web2C 7.4.5) (INITEX)
[...]
> Transcript written on pdfmex-pl.log.
> porridge@menel:/var/lib/texmf/web2c$
[...]
> In other words, looks fine, which is pretty puzzling.
> I tried dpkg --configure -a again, and this resulted in the same typescript as
> initially reported. Indeed, the pdfmex-pl.{log,fmt} were not modified during
> the dpkg run, but were during the direct invocation.
This is in fact strange. Did you also use "sudo" for the apt-get
invocation, or did you use an other method to gain root rights?
> /var/lib/texmf/web2c/fmtutil.cnf follows:
Just to be sure, the output of
kpsewhich --format='web2c files' fmtutil.cnf
called as root (the same way as apt-get was called) is in fact
/var/lib/texmf/web2c/fmtutil.cnf?
> # - Polish with translated messages (experimental):
> #! platex-pl tex - nls=tex-pl,il2-pl platex.ini
> #! mex-pl tex mexconf.tex nls=tex-pl,il2-pl mex.ini
> #! pdfmex-pl pdftex mexconf.tex nls=pdftex-pl,il2-pl pdfmex.ini
> #! pdfemex-pl pdfetex mexconf.tex nls=pdfetex-pl,il2-pl *pdfemex.ini
This is exactly what we provide with tetex-2.0.2
> ### From file: /etc/texmf/fmt.d/99postinst.cnf
[...]
> platex-pl tex - nls=tex-pl,il2-pl platex.ini
> mex-pl tex mexconf.tex nls=tex-pl,il2-pl mex.ini
> pdfmex-pl pdftex mexconf.tex nls=pdftex-pl,il2-pl pdfmex.ini
> pdfemex-pl pdfetex mexconf.tex nls=pdfetex-pl,il2-pl *pdfemex.ini
> ### End of file: /etc/texmf/fmt.d/99postinst.cnf
This is again the same as above; somehow the upgrade procedure (from
woody or older sarge-testing versions) thought that those were new lines
added by you (see the remark in 99postinst.cnf). Since they are the
same, it shouldn't have any effect.
So what can we do to further debug this? You could do the following:
Save the attached file as /usr/local/sbin/fmtutil and then run the
necessary commands to trigger the bug - "dpkg --configure -a" in the
simplest case, or "apt-get install tetex-bin", or whatever, but redirect
the stdout and stderr to a file (or copy it there), like this:
dpkg --configure -a 2>&1 | tee debug.log
There should be plenty of output, which is also in debug.log - please
send us this file.
TIA, Frank
--
Frank Küster
Inst. f. Biochemie der Univ. Zürich
Debian Developer
#!/bin/sh -x
###############################################################################
# fmtutil: utility to maintain format files.
#
# Thomas Esser, (C) 1998, 2001, 2002, 2003. Public domain.
#
# Commands:
# --all recreate all format files
# --missing create all missing format files
# --byfmt formatname (re)create format for `formatname'
# --byhyphen hyphenfile (re)create formats that depend on `hyphenfile'
# --showhyphen formatname print name of hyphenfile for format `formatname'
# --help show this message
#
# Options:
# --cnffile file set configfile for fmtutil
# --fmtdir directory set destination directory for format files
###############################################################################
###############################################################################
# program history:
# Wed Feb 19 21:14:52 CET 2003 add eomega support
# Sat Feb 15 22:01:35 CET 2003 let mf-nowin work without mf
# Wed Dec 25 09:47:44 CET 2002 bugfix for localized pool files
# Fri Oct 25 02:29:06 CEST 2002: now more careful about find_hyphenfile()
# Tue Oct 22 22:46:48 CEST 2002: -jobname, oft extension
# Fri Oct 4 22:33:17 CEST 2002: add more cli stuff: enablefmt
# disablefmt listcfg
# Sun Jul 7 21:28:37 CEST 2002: look at log file for possible problems,
# and issue a warning
# Tue Jun 4 21:52:57 CEST 2002: trap / cleanup code from updmap
# Tue Jun 4 19:32:44 CEST 2002: be smarter about stdout / stderr
# Tue Apr 9 22:46:34 CEST 2002: pass -progname=mpost for metafun
# Tue Apr 2 00:37:39 CEST 2002: added mktexfmt functionality
# Tue Jun 5 14:45:57 CEST 2001: added support for mf / mpost
###############################################################################
progname=fmtutil
version=2.0
test -f /bin/sh5 && test -z "$RUNNING_SH5" \
&& { UNAMES=`uname -s`; test "x$UNAMES" = xULTRIX; } 2>/dev/null \
&& { RUNNING_SH5=true; export RUNNING_SH5; exec /bin/sh5 $0 ${1+"$@"}; }
unset RUNNING_SH5
test -f /bin/bsh && test -z "$RUNNING_BSH" \
&& { UNAMES=`uname -s`; test "x$UNAMES" = xAIX; } 2>/dev/null \
&& { RUNNING_BSH=true; export RUNNING_BSH; exec /bin/bsh $0 ${1+"$@"}; }
unset RUNNING_BSH
# hack around a bug in zsh:
test -n "${ZSH_VERSION+set}" && alias -g '${1+"$@"}'='"$@"'
cnf=fmtutil.cnf # name of the config file
###############################################################################
# cleanup()
# clean up the temp area and exit with proper exit status
###############################################################################
cleanup()
{
rc=$?
$needsCleanup && test -n "$tmpdir" && test -d "$tmpdir" \
&& { rm -f "$tmpdir"/*; cd /; rmdir "$tmpdir"; }
exit $rc
}
###############################################################################
# setupTmpDir()
# set up a temp directory and a trap to remove it
###############################################################################
setupTmpDir()
{
$needsCleanup && return
trap 'cleanup' 1 2 3 7 13 15
needsCleanup=true
(umask 077; mkdir "$tmpdir") \
|| abort "could not create directory \`$tmpdir'"
}
###############################################################################
# configReplace(file, pattern, line)
# The first line in file that matches pattern gets replaced by line.
# line will be added at the end of the file if pattern does not match.
###############################################################################
configReplace()
{
file=$1; pat=$2; line=$3
if grep "$pat" "$file" >/dev/null; then
ed "$file" >/dev/null 2>&1 <<-eof
/$pat/
c
$line
.
w
q
eof
else
echo "$line" >> $file
fi
}
###############################################################################
# setmatch(match)
# setting the "match state" to true or false. Used to see if there was at
# least one match.
###############################################################################
setmatch()
{
match=$1
}
###############################################################################
# getmatch()
# return success if there was at least one match.
###############################################################################
getmatch()
{
test "x$match" = xtrue
}
###############################################################################
# cache_vars()
# locate files / kpathsea variables and export variables to environment
# this speeds up future calls to e.g. mktexupd
###############################################################################
cache_vars()
{
: ${MT_VARTEXFONTS=`kpsewhich --expand-var='$VARTEXFONTS' | sed 's%^!!%%'`}
: ${MT_TEXMFMAIN=`kpsewhich --expand-var='$TEXMFMAIN'`}
: ${MT_MKTEXNAM=`kpsewhich --format='web2c files' mktexnam`}
: ${MT_MKTEXNAM_OPT=`kpsewhich --format='web2c files' mktexnam.opt`}
: ${MT_MKTEXDIR=`kpsewhich --format='web2c files' mktexdir`}
: ${MT_MKTEXDIR_OPT=`kpsewhich --format='web2c files' mktexdir.opt`}
: ${MT_MKTEXUPD=`kpsewhich --format='web2c files' mktexupd`}
: ${MT_MKTEX_CNF=`kpsewhich --format='web2c files' mktex.cnf`}
: ${MT_MKTEX_OPT=`kpsewhich --format='web2c files' mktex.opt`}
: ${MT_LSR_PATH=`kpsewhich -show-path=ls-R`}
export MT_VARTEXFONTS MT_TEXMFMAIN MT_MKTEXNAM MT_MKTEXNAM_OPT MT_MKTEXDIR
export MT_MKTEXDIR_OPT MT_MKTEXUPD MT_MKTEX_CNF MT_MKTEX_OPT MT_LSR_PATH
}
###############################################################################
# help()
# display help message and exit
###############################################################################
help()
{
cat <<'eof'
Usage: fmtutil [option] ... cmd [argument]
Valid options:
--cnffile file
--fmtdir directory
--quiet (not implemented, just for compatibility)
--test (not implemented, just for compatibility)
--dolinks (not implemented, just for compatibility)
--force (not implemented, just for compatibility)
Valid commands:
--all recreate all format files
--missing create all missing format files
--byfmt formatname (re)create format for `formatname'
--byhyphen hyphenfile (re)create formats that depend on `hyphenfile'
--enablefmt formatname enable formatname in config file
--disablefmt formatname disable formatname in config file
--listcfg list (enabled and disabled) configurations
--showhyphen formatname print name of hyphenfile for format `formatname'
--edit edit fmtutil.cnf file
--help show this message
eof
true
cleanup
}
###############################################################################
# abort(errmsg)
# print `errmsg' to stderr and exit with error code 1
###############################################################################
abort()
{
echo "$progname: $1." >&2
false # some systems need this to set nonzero $?
cleanup
}
###############################################################################
# byebye()
# report any failures and exit the program
###############################################################################
byebye()
{
if $has_errors; then
{
cat <<eof
###############################################################################
$progname: Error! Not all formats have been built successfully.
Visit the log files in directory
$destdir
for details.
###############################################################################
This is a summary of all \`failed' messages and warnings:
$log_failure_msg
eof
} >&2
false # some systems need this to set nonzero $?
cleanup
else
true
cleanup
fi
}
###############################################################################
# init_log_failure()
# reset the list of failure messages
###############################################################################
init_log_failure()
{
log_failure_msg=
has_errors=false
}
###############################################################################
# log_failure(errmsg)
# report and save failure message `errmsg'
###############################################################################
log_failure()
{
echo "Error: $@" >&2
if test -z "$log_failure_msg"; then
log_failure_msg="$@"
else
OLDIFS=$IFS; IFS=
log_failure_msg="$log_failure_msg
$@"
IFS=$OLDIFS
fi
has_errors=true
}
###############################################################################
# verbose (cmd)
# execute cmd. Redirect output depending on $mktexfmtMode.
###############################################################################
verbose()
{
$mktexfmtMode && ${1+"$@"} >&2 || ${1+"$@"}
}
###############################################################################
# main()
# parse commandline arguments, initialize variables,
# switch into temp. direcrory, execute desired command
###############################################################################
main()
{
destdir= # global variable: where do we put the format files?
cnf_file= # global variable: full name of the config file
cmd= # desired action from command line
needsCleanup=false
need_find_hyphenfile=false
# mktexfmtMode: if called as mktexfmt, set to true. Will echo the generated
# filename after successful generation to stdout then (and nothing else).
mktexfmtMode=false
case $0 in
mktexfmt|*/mktexfmt)
mktexfmtMode=true
fullfmt=$1; shift
case $fullfmt in
*.eoft|*.oft|*.fmt|*.efmt|*.mem|*.base)
set x --byfmt `echo $fullfmt | sed 's@\.[a-z]*$@@'` ${1+"$@"}; shift
;;
*) abort "unknown format type: $fullfmt"
;;
esac
;;
esac
while
case $1 in
--cnffile)
shift; cnf_file=$1;;
--cnffile=*)
cnf_file=`echo "$1" | sed 's/--cnffile=//'`; shift ;;
--fmtdir)
shift; destdir=$1;;
--fmtdir=*)
destdir=`echo "$1" | sed 's/--fmtdir=//'`; shift ;;
--all|-a)
cmd=all;;
--edit|-e)
cmd=edit;;
--missing|-m)
cmd=missing;;
--byfmt|-f)
shift; cmd=byfmt; arg=$1;;
--byfmt=*)
cmd=byfmt; arg=`echo "$1" | sed 's/--byfmt=//'`; shift ;;
--byhyphen|-h)
shift; cmd=byhyphen; arg=$1;;
--byhyphen=*)
cmd=byhyphen; arg=`echo "$1" | sed 's/--byhyphen=//'`; shift ;;
--showhyphen|-s)
shift; cmd=showhyphen; arg=$1;;
--showhyphen=*)
cmd=showhyphen; arg=`echo "$1" | sed 's/--showhyphen=//'`; shift ;;
--help|-help)
cmd=help;;
--enablefmt)
shift; cmd=enablefmt; arg=$1;;
--enablefmt=*)
cmd=enablefmt; arg=`echo "$1" | sed 's/--enablefmt=//'`; shift ;;
--disablefmt)
shift; cmd=disablefmt; arg=$1;;
--disablefmt=*)
cmd=disablefmt; arg=`echo "$1" | sed 's/--disablefmt=//'`; shift ;;
--listcfg)
cmd=listcfg;;
--quiet|--test|--dolinks|--force)
;;
"") break;;
*) echo "$progname: unknown option \`$1' ignored." >&2;;
esac
do test $# -gt 0 && shift; done
case "$cmd" in
help|"") help;;
esac
cache_vars
# if no cnf_file from command-line, look it up with kpsewhich:
test -z "$cnf_file" && cnf_file=`kpsewhich --format='web2c files' $cnf`
test -f "$cnf_file" || abort "config file \`$cnf' not found"
# showhyphen and edit do not need any temp. directory, so do it here:
case "$cmd" in
showhyphen)
show_hyphen_file "$arg"
cleanup
;;
edit)
${VISUAL-${EDITOR-vi}} $cnf_file
cleanup
;;
enablefmt|disablefmt)
$cmd $arg
cleanup
;;
listcfg)
listcfg
cleanup
;;
esac
# set up destdir:
test -z "$MT_TEXMFMAIN" && abort "could not expand variable \$TEXMFMAIN"
if test -z "$destdir"; then
: ${VARTEXMF=`kpsewhich -expand-var='$VARTEXMF'`}
test -z "$VARTEXMF" && VARTEXMF=$MT_TEXMFMAIN
destdir=$VARTEXMF/web2c
fi
test -d "$destdir" || $MT_MKTEXDIR "$destdir" >/dev/null 2>&1
test -d "$destdir" || abort "format directory \`$destdir' does not exist"
# find mktexupd script:
test -n "$MT_MKTEXUPD" || MT_MKTEXUPD="$TEXMFMAIN/web2c/mktexupd"
thisdir=`pwd`
: ${KPSE_DOT=$thisdir}
export KPSE_DOT
tmpdir=${TMP-/tmp}/$progname.$$
setupTmpDir
cd "$tmpdir" || {
false # some systems need this to set nonzero $?
cleanup
}
# make local paths absolute:
case "$destdir" in
/*) ;;
*) destdir="$thisdir/$destdir";;
esac
case "$cnf_file" in
/*) ;;
*) cnf_file="$thisdir/$cnf_file";;
esac
init_log_failure
# execute the desired command:
case "$cmd" in
all)
recreate_all;;
missing)
create_missing;;
byfmt)
create_one_format "$arg";;
byhyphen)
recreate_by_hyphenfile "$arg";;
esac
# install the log files and format files:
for i in *.log; do
test -f "$i" || continue
rm -f "$destdir/$i"
mv "$i" "$destdir/$i"
done
for i in *.eoft *.oft *.fmt *.efmt *.mem *.base; do
test -f "$i" || continue
rm -f "$destdir/$i"
if mv "$i" "$destdir/$i"; then
verbose echo "$progname: $destdir/$i installed." >&2
$mktexfmtMode && echo "$destdir/$i"
fi
$MT_MKTEXUPD "$destdir" "$i"
done
# symlinks for "plain" (tex/etex/mf/mpost)
if test -f "$destdir/tex.fmt" && test ! -f "$destdir/plain.fmt"; then
ln -s tex.fmt "$destdir/plain.fmt"
$MT_MKTEXUPD "$destdir" plain.fmt
fi
if test -f "$destdir/tex.efmt" && test ! -f "$destdir/plain.efmt"; then
ln -s tex.efmt "$destdir/plain.efmt"
$MT_MKTEXUPD "$destdir" plain.efmt
fi
if test -f "$destdir/mf.base" && test ! -f "$destdir/plain.base"; then
ln -s mf.base "$destdir/plain.base"
$MT_MKTEXUPD "$destdir" mf.base
fi
if test -f "$destdir/mf.base" && test ! -f "$destdir/mf-nowin.base"; then
ln -s mf.base "$destdir/mf-nowin.base"
$MT_MKTEXUPD "$destdir" mf-nowin.base
fi
if test -f "$destdir/mf.base" && test ! -f "$destdir/mfw.base"; then
ln -s mf.base "$destdir/mfw.base"
$MT_MKTEXUPD "$destdir" mfw.base
fi
if test -f "$destdir/mpost.mem" && test ! -f "$destdir/plain.mem"; then
ln -s mpost.mem "$destdir/plain.mem"
$MT_MKTEXUPD "$destdir" plain.mem
fi
byebye
}
###############################################################################
# parse_line(config_line) sets global variables:
# format: name of the format, e.g. pdflatex
# engine: name of the TeX engine, e.g. tex, etex, pdftex
# texargs: flags for initex and name of the ini file (e.g. -mltex frlatex.ini)
# fmtfile: name of the format file (without directory, but with extension)
#
# Support for building internationalized formats sets:
# pool: base name of pool file (to support translated pool files)
# tcx: translation file used when creating the format
#
# Example (for fmtutil.cnf):
# mex-pl tex mexconf.tex nls=tex-pl,il2-pl mex.ini
#
# The nls parameter (pool,tcx) can only be specified as the first argument
# inside the 4th field in fmtutil.cnf.
#
# exit code: returns error code if the ini file is not installed
###############################################################################
parse_line()
{
format=$1
engine=$2
hyphenation=$3
shift; shift; shift
# handle nls support: pool + tcx
pool=; tcx=
case $1 in
nls=*)
pool=`echo $1 | sed 's@nls=@@; s@,.*@@'`
tcx=`echo $1 | sed 's@nls=[^,]*@@; s@^,@@'`
shift # nls stuff is not handled by the engine directly,
# so we shift this away
;;
esac
texargs="$@"
eval lastarg=\$$#
inifile=`echo $lastarg | sed 's%^\*%%'`
case "$engine" in
*etex) fmtfile="$format.efmt"; kpsefmt=tex;;
omega) fmtfile="$format.oft"; kpsefmt=tex;;
eomega) fmtfile="$format.eoft"; kpsefmt=tex;;
mpost) fmtfile="$format.mem"; kpsefmt=mpost;;
mf|mfw|mf-nowin) fmtfile="$format.base"; kpsefmt=mf;;
*) fmtfile="$format.fmt"; kpsefmt=tex;;
esac
# See if we can find $inifile for return code:
kpsewhich -progname=$format -format=$kpsefmt $inifile >/dev/null 2>&1
}
###############################################################################
# find_hyphenfile(format, hyphenation) searches for hyphenation along
# searchpath of format
# exit code: returns error is file is not found
###############################################################################
find_hyphenfile()
{
format="$1"; hyphenation="$2"
case $hyphenation in
-) ;;
*) kpsewhich -progname="$format" -format=tex "$hyphenation";;
esac
}
###############################################################################
# find_info_for_name(format)
# Look up the config line for format `format' and call parse_line to set
# global variables.
###############################################################################
find_info_for_name()
{
format="$1"
set x `awk '$1 == format {print; exit}' format="$format" "$cnf_file"`; shift
test $# = 0 && abort "no info for format \`$format'"
parse_line "$@"
}
###############################################################################
# run_initex()
# Calls initex. Assumes that global variables are set by parse_line.
###############################################################################
run_initex()
{
# install a pool file and set tcx flag if requested in lang= option:
rm -f *.pool
poolfile=
tcxflag=
test -n "$pool" \
&& poolfile=`(kpsewhich -progname=$engine $pool.pool) 2>/dev/null`
if test -n "$poolfile" && test -f "$poolfile"; then
verbose echo "$progname: attempting to create localized format using pool=$pool and tcx=$tcx." >&2
cp "$poolfile" $engine.pool
test -n "$tcx" && tcxflag=-translate-file=$tcx
localpool=true
else
localpool=false
fi
jobswitch="-jobname=$format"
case "$format" in
metafun) prgswitch=-progname=mpost;;
cont-??) prgswitch=-progname=context;;
*) prgswitch=-progname=$format;;
esac
rm -f $fmtfile
verbose echo "running \`$engine -ini $tcxflag $jobswitch $prgswitch $texargs' ..."
# run in a subshell to get a local effect of TEXPOOL manipulation:
(
# If necessary, set TEXPOOL. Use absolute path, because of KPSE_DOT.
$localpool && { TEXPOOL="`pwd`:$TEXPOOL"; export TEXPOOL; }
verbose $engine -ini $tcxflag $jobswitch $prgswitch $texargs
) </dev/null
if test -f $fmtfile; then
grep '^! ' $format.log >/dev/null 2>&1 &&
log_failure "\`$engine -ini $tcxflag $jobswitch $prgswitch $texargs' possibly failed."
else
log_failure "\`$engine -ini $tcxflag $jobswitch $prgswitch $texargs' failed"
fi
}
###############################################################################
# recreate_loop(hyphenfile)
# for each line in config file: check match-condition and recreate format
# if there is a match
###############################################################################
recreate_loop()
{
OIFS=$IFS
IFS='
'
set `echo x; sed '/^#/d; /^[ ]*$/d' "$cnf_file"`; shift
IFS=$OIFS
for line
do
parse_line $line || continue
check_match || continue
echo; echo
run_initex
done
}
###############################################################################
# check_match()
# recreate all formats
###############################################################################
check_match()
{
$need_find_hyphenfile && \
this_hyphenfile=`find_hyphenfile "$format" "$hyphenation"`
eval $match_cmd && setmatch true
}
###############################################################################
# create_one_format(fmtname)
# (re)create the format file for the format `fmtname'
###############################################################################
create_one_format()
{
fmtname=$1
find_info_for_name $fmtname || abort "format \`$fmtname' not available"
run_initex
}
###############################################################################
# create_missing()
# create all missing format files
###############################################################################
create_missing()
{
# match_cmd='test ! -f $destdir/$fmtfile'
match_cmd='test ! -f "`kpsewhich -progname=$format $fmtfile`"'
recreate_loop
}
###############################################################################
# recreate_all()
# recreate all formats
###############################################################################
recreate_all()
{
match_cmd=true
recreate_loop
}
###############################################################################
# recreate_by_hyphenfile(hyphenfile)
# recreate all formats that depend on hyphenfile
###############################################################################
recreate_by_hyphenfile()
{
hyphenfile=$1
need_find_hyphenfile=true
match_cmd="test x\$this_hyphenfile = x$hyphenfile"
# No match before the loop:
setmatch false
recreate_loop
# Now check if there was at least one match:
getmatch || abort "no format depends on \`$hyphenfile'"
}
###############################################################################
# show_hyphen_file(format)
# prints full name of the hyphenfile for format
#
# exit code: returns error code if the ini file is not installed or if
# the hyphen file cannot be found
###############################################################################
show_hyphen_file()
{
fmtname=$1
find_info_for_name "$fmtname" || abort "no info for format \`$fmtname'"
if test "x$hyphenation" = x-; then
echo -
cleanup
fi
find_hyphenfile "$format" "$hyphenation" \
|| abort "hyphenfile \`$hyphenation' not found"
}
###############################################################################
# listcfg()
# prints all format definitions in config files (enabled and disabled ones)
###############################################################################
listcfg()
{
egrep '^(#! *)?[a-zA-Z]' $cnf_file
}
###############################################################################
# disablefmt(format)
# disables format in configuration file
###############################################################################
disablefmt()
{
grep "^$1 " $cnf_file >/dev/null || return 0
ed $cnf_file >/dev/null 2>&1 <<-eof
/^$1 /s/^/#! /
w
q
eof
return 0
}
###############################################################################
# enablefmt(format)
# enables format in configuration file
###############################################################################
enablefmt()
{
grep "^#! *$1 " $cnf_file >/dev/null || return 0
ed $cnf_file >/dev/null 2>&1 <<-eof
/^#! *$1 /s/.. *//
w
q
eof
return 0
}
main ${1+"$@"}
true
cleanup
Reply to: