Bug#489943: texlive-base-bin: mktexpk does not work in directories containing spaces
Package: texlive-base-bin
Version: 2007.dfsg.2-3
Severity: normal
Tags: patch
The mktexpk script fails if it tries to build a .pk in a directory with space
(tested), tab or some backslash-character combinations (obvious from the
code).
I traced the space problem down to a single cd with unquoted argument.
However I also noticed use of echo+sed dirname replacement (with comment
"can't rely on dirname" -- basename was relied on on the next line though),
which would have problems with spaces at the end (backquote expansion eats
them) and backslashes in some shells (the rules for backslash processing in
echo differ from shell to shell). So my patch additionally includes
a replacement of those two statements with ${var##pattern} and ${var%pattern}
expansions. These expansions are POSIX and should thus be reasonably
portable.
##################################
patch (standard patch -p1 unified diff)
--- old/build/source/texk/kpathsea/mktexpk 2006-01-17 22:41:51.000000000 +0100
+++ new/build/source/texk/kpathsea/mktexpk 2008-07-08 21:49:14.000000000 +0200
@@ -199,8 +199,8 @@
IFS=$OIFS
PKDEST="$1"
-PKDESTDIR=`echo "$PKDEST" | sed 's%/[^/][^/]*$%%'` # can't rely on dirname
-PKNAME=`basename "$PKDEST"`
+PKDESTDIR=${PKDEST%/*}
+PKNAME=${PKDEST##*/}
GFNAME=$NAME.${DPI}gf
if test -r "$PKDESTDIR/$PKNAME"; then
@@ -250,7 +250,7 @@
# Use cp when mv fails, since DOS will fail mv for deeply-nested directories.
mv $PKNAME "$PKDESTDIR/pk$$.tmp" 2>/dev/null \
|| cp $PKNAME "$PKDESTDIR/pk$$.tmp" || exit 1
-cd $PKDESTDIR || exit 1
+cd "$PKDESTDIR" || exit 1
chmod `kpsestat -xst,go-w .` pk$$.tmp
test -r $PKNAME || mv pk$$.tmp $PKNAME || exit 1
##################################
minimal input file
No specific TeX input. The problem can be reproduced by putting any .mf font
source in a directory with spaces in name and using mktexpk to generate a .pk
from it.
##################################
other files
######################################
List of ls-R files
-rw-r--r-- 1 root root 1503 29. čen 13.37 /var/lib/texmf/ls-R
lrwxrwxrwx 1 root staff 25 25. pro 2007 /usr/local/share/texmf/ls-R -> /var/lib/texmf/ls-R-LOCAL
lrwxrwxrwx 1 root root 29 17. dub 19.55 /usr/share/texmf/ls-R -> /var/lib/texmf/ls-R-TEXMFMAIN
lrwxrwxrwx 1 root root 27 29. čen 13.29 /usr/share/texmf-texlive/ls-R -> /var/lib/texmf/ls-R-TEXLIVE
lrwxrwxrwx 1 root root 27 29. čen 13.29 /usr/share/texmf-texlive/ls-R -> /var/lib/texmf/ls-R-TEXLIVE
######################################
Config files
lrwxrwxrwx 1 root root 20 17. dub 19.55 /usr/share/texmf/web2c/texmf.cnf -> /etc/texmf/texmf.cnf
-rw-r--r-- 1 root root 7618 29. čen 13.37 /var/lib/texmf/web2c/fmtutil.cnf
-rw-r--r-- 1 root root 8073 29. čen 13.37 /var/lib/texmf/web2c/updmap.cfg
-rw-r--r-- 1 root root 4781 29. čen 13.37 /var/lib/texmf/tex/generic/config/language.dat
######################################
Files in /etc/texmf/web2c/
total 0
######################################
md5sums of texmf.d
42c20d7e8bd343542772b5a145bf8ad8 /etc/texmf/texmf.d/05TeXMF.cnf
5f7f6652cc8b8071c9e4ea6ba9e9f0a1 /etc/texmf/texmf.d/15Plain.cnf
f68e5add6afd6585b982f2f78e2e6a92 /etc/texmf/texmf.d/45TeXinputs.cnf
ea33127256c6a9f37145ae5b16fdb80c /etc/texmf/texmf.d/55Fonts.cnf
afccf1d3f87057411166a77c58e00bd1 /etc/texmf/texmf.d/65BibTeX.cnf
9da7c1c7b1eaf06f941af91f48a23068 /etc/texmf/texmf.d/75DviPS.cnf
8fee79ccdd5d1f56b1563dabfd53c717 /etc/texmf/texmf.d/85Misc.cnf
a8952d594677235951d447665ec46e9c /etc/texmf/texmf.d/90TeXDoc.cnf
30f4f13357c2761ed01a6a15f28725a5 /etc/texmf/texmf.d/95NonPath.cnf
1df66bc319cec731e202eaf39f5d85e1 /etc/texmf/texmf.d/96JadeTeX.cnf
-- System Information:
Debian Release: lenny/sid
APT prefers unstable
APT policy: (500, 'unstable'), (500, 'testing'), (500, 'stable'), (100, 'experimental')
Architecture: amd64 (x86_64)
Kernel: Linux 2.6.24-1-amd64 (SMP w/1 CPU core)
Locale: LANG=C, LC_CTYPE=cs_CZ.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
Versions of packages texlive-base-bin depends on:
ii ed 0.7-1 The classic unix line editor
ii libc6 2.7-12 GNU C Library: Shared libraries
ii libgcc1 1:4.3.1-5 GCC support library
ii libkpathsea4 2007.dfsg.2-3 TeX Live: path search library for
ii libncurses5 5.6+20080621-2 shared libraries for terminal hand
ii libpng12-0 1.2.27-1 PNG library - runtime
ii libpoppler3 0.8.4-1 PDF rendering library
ii libstdc++6 4.3.1-5 The GNU Standard C++ Library v3
ii libx11-6 2:1.1.4-2 X11 client-side library
ii libxaw7 2:1.0.4-2 X11 Athena Widget library
ii libxmu6 2:1.0.4-1 X11 miscellaneous utility library
ii libxpm4 1:3.5.7-1 X11 pixmap library
ii libxt6 1:1.0.5-3 X11 toolkit intrinsics library
ii mime-support 3.44-1 MIME files 'mime.types' & 'mailcap
ii perl 5.10.0-11 Larry Wall's Practical Extraction
ii texlive-common 2007.dfsg.1-2 TeX Live: Base component
ii zlib1g 1:1.2.3.3.dfsg-12 compression library - runtime
Versions of packages texlive-base-bin recommends:
ii perl-tk 1:804.028-1+b1 Perl module providing the Tk graph
ii texlive-base-bin-doc 2007.dfsg.2-3 TeX Live: Documentation files for
Versions of packages tex-common depends on:
ii debconf 1.5.22 Debian configuration management sy
ii ucf 3.007 Update Configuration File: preserv
Versions of packages texlive-base-bin is related to:
pn tetex-base <none> (no description available)
pn tetex-bin <none> (no description available)
pn tetex-extra <none> (no description available)
ii tex-common 1.11 common infrastructure for building
-- debconf information:
tex-common/check_texmf_wrong:
tex-common/check_texmf_missing:
tex-common/singleuser: false
--
Jan 'Bulb' Hudec <bulb@ucw.cz>
Reply to: