diff options
author | Karl Berry <karl@freefriends.org> | 2011-06-09 17:27:39 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2011-06-09 17:27:39 +0000 |
commit | a1a826137709656ed9db61a29636a04aa586cfab (patch) | |
tree | a89138bb24efe660660e63b6d27269c4a337e3f6 /Build/source/texk | |
parent | b5b940489821d04a595ef7d8b556af3f4631fef8 (diff) |
mktexlsr: support spaces in directory names
git-svn-id: svn://tug.org/texlive/trunk@22885 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Build/source/texk')
-rw-r--r-- | Build/source/texk/kpathsea/ChangeLog | 6 | ||||
-rwxr-xr-x | Build/source/texk/kpathsea/mktexlsr | 43 |
2 files changed, 34 insertions, 15 deletions
diff --git a/Build/source/texk/kpathsea/ChangeLog b/Build/source/texk/kpathsea/ChangeLog index a1e63f0bcd7..707092e4326 100644 --- a/Build/source/texk/kpathsea/ChangeLog +++ b/Build/source/texk/kpathsea/ChangeLog @@ -1,3 +1,9 @@ +2011-06-09 Karl Berry <karl@tug.org> + + * mktexlsr: write directory args to a file and read them back, + so we can support spaces (though not newlines) in the directory names. + Reword some error messages. + 2011-06-08 Akira Kakuto <kakuto@fuk.kindai.ac.jp> * hash.c: leave original letter cases also on win32. diff --git a/Build/source/texk/kpathsea/mktexlsr b/Build/source/texk/kpathsea/mktexlsr index de68ea0161c..b57143899db 100755 --- a/Build/source/texk/kpathsea/mktexlsr +++ b/Build/source/texk/kpathsea/mktexlsr @@ -66,6 +66,10 @@ if tty -s; then verbose=true; else verbose=false; fi dry_run=false trees= +treefile="${TMPDIR-/tmp}/mktexlsrtrees$$.tmp" +trap 'cd /; rm -f $treefile; test -z "$db_dir_tmp" || rm -rf "$db_dir_tmp"; + exit' 0 1 2 3 7 13 15 + # A copy of some stuff from mktex.opt, so we can run in the presence of # terminally damaged ls-R files. while test $# -gt 0; do @@ -86,11 +90,21 @@ while test $# -gt 0; do elif test "x$1" = x--; then : elif echo "x$1" | grep '^x-' >/dev/null; then - echo "$progname: unknown option $1, try --help if you need it." >&2 + echo "$progname: unknown option \`$1', try --help if you need it." >&2 exit 1 else - test -d "$1" || echo "$progname: $1 not a directory." >&2 - trees="$trees $1" # don't want to update system dirs + if test ! -d "$1"; then + echo "$progname: $1: not a directory, skipping." >&2 + continue + fi + # By saving the argument in a file, we can later get it back while + # supporting spaces in the name. This still doesn't support + # newlines in the directory names, but nobody ever complains about + # that, and it seems much too much trouble to use \0 terminators. + (umask 077 && touch "$treefile" ) \ + || { echo "$progname: $treefile: could not create arg file, goodbye." >&2;\ + exit 1; } + echo "$1" >"$treefile" fi shift done @@ -101,20 +115,19 @@ ls_R_magic='% ls-R -- filename database for kpathsea; do not change this line.' # The old string, which should continue to work. old_ls_R_magic='% ls-R -- maintained by MakeTeXls-R; do not change this line.' -trap 'cd /; test -z "$db_dir_tmp" || rm -rf "$db_dir_tmp"; exit' 0 1 2 3 7 13 15 - -# Get list of directories from $TEXMFDBS; eliminate duplicates. { - if test -n "$trees"; then - set x $trees - else - OIFS=$IFS # want just a newline - IFS=' + # Get list of directories from the explicit arguments (now saved in + # $treefile), or $TEXMFDBS if no explicit args. Eliminate duplicates. + saveIFS=$IFS # break only at newline + IFS=' ' + if test -s "$treefile"; then + set x `sort "$treefile" | uniq` + else set x `kpsewhich --show-path=ls-R | tr : ' ' | sort | uniq` - IFS=$OIFS fi + IFS=$saveIFS shift } @@ -156,16 +169,16 @@ for TEXMFLS_R in "$@"; do elif test -s "$db_file" \ && test "x`sed '1s/
$//;1q' \"$db_file\"`" != "x$ls_R_magic" \ && test "x`sed '1s/
$//;1q' \"$db_file\"`" != "x$old_ls_R_magic"; then - echo "$progname: $db_file lacks magic string. Skipping..." >&2 + echo "$progname: $db_file: no magic string, skipping..." >&2 continue fi # Skip if we cannot write the file: - kpseaccess -w "$db_file" || { echo "$progname: $db_file: no write permission. Skipping..." >&2; continue; } + kpseaccess -w "$db_file" || { echo "$progname: $db_file: no write permission, skipping..." >&2; continue; } db_dir_tmp="$db_dir/lsR$$.tmp" (umask 077 && mkdir "$db_dir_tmp" ) \ - || { echo "$progname: could not create directory '$db_dir_tmp'. Skipping..." >&2; continue; } + || { echo "$progname: $db_dir_tmp: could not create directory, skipping..." >&2; continue; } db_file_tmp="$db_dir_tmp/lsR$$.tmp" rm -f "$db_file_tmp" |