texlive/texlive-mktexlsr_fixes.patch

94 lines
3.8 KiB
Diff

## 10_mktexlsr_fixes by <frank@debian.org> etc etc
##
## DP: Fixes wrong paths in various scripts to make lintian shut up.
## DP: Fix creation of ls-R in root's homedir
## DP: Also add a note to the man page of mktexlsr about the above fix
build/source/texk/kpathsea/mktexlsr | 24 ++++++++++++------------
texmf/doc/man/man1/mktexlsr.1 | 9 +++++++++
2 files changed, 21 insertions(+), 12 deletions(-)
Index: texlive-bin-2006.svn3816/build/source/texk/kpathsea/mktexlsr
===================================================================
--- texlive-bin-2006.svn3816.orig/build/source/texk/kpathsea/mktexlsr 2006-12-25 19:44:43.000000000 +0100
+++ texlive-bin-2006.svn3816/build/source/texk/kpathsea/mktexlsr 2007-01-26 03:55:05.000000000 +0100
@@ -82,6 +82,9 @@
'
set x `kpsewhich --show-path=ls-R | tr : '
' | sort | uniq`; shift
+ if test "`id -u`" -eq 0; then
+ NOROOTHOME=true
+ fi
IFS=$OIFS
}
@@ -89,6 +92,10 @@
# Prepend cwd if the directory was relative.
case "$TEXMFLS_R" in
"") continue ;; # Strictly speaking, it is an error if this case is taken.
+ $HOME/*) if test -n "$NOROOTHOME"; then
+ tty -s && echo "$progname: Skipping $TEXMFLS_R" >&2
+ continue
+ fi ;;
/* | [A-z]:/*) ;;
*) TEXMFLS_R="`pwd`/$TEXMFLS_R"
esac
@@ -112,9 +119,9 @@
db_dir=`echo "$db_file" | sed 's%/[^/][^/]*$%%'` # can't rely on dirname
test -d "$db_dir" || continue
- test -w "$db_dir" || { echo "$progname: $db_dir: directory not writable. Skipping..." >&2; continue; }
if test ! -f "$db_file"; then
+ test -w "$db_dir" || { echo "$progname: $db_dir: directory not writable. Skipping..." >&2; continue; }
cp /dev/null "$db_file"
# Use same permissions as parent directory, minus x,s, or t bits.
chmod `kpsestat -xst "$db_dir"` "$db_file"
@@ -128,11 +135,8 @@
# Skip if we cannot write the file:
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; }
- db_file_tmp="$db_dir_tmp/lsR$$.tmp"
- rm -f "$db_file_tmp"
+ db_file_tmp=`mktemp -t ls-R.XXXXXXXXXX` \
+ || { echo "$progname: could not create temporary file for '$db_file'. Skipping..." >&2; continue; }
$verbose && echo "$progname: Updating $db_file... " >&2
echo "$ls_R_magic" >"$db_file_tmp"
@@ -152,12 +156,8 @@
| sed -e '/\.svn.*:$/,/^$/d' \
>>"$db_file_tmp"
- # To be really safe, a loop.
- until PERMS=`kpsestat = "$db_file"`; do sleep 1; done
- chmod $PERMS "$db_file_tmp"
- rm -f "$db_file"
- mv "$db_file_tmp" "$db_file"
- rm -rf "$db_dir_tmp"
+ cat "$db_file_tmp" > "$db_file"
+ rm -f "$db_file_tmp"
done
$verbose && echo "$progname: Done." >&2
exit 0
Index: texlive-bin-2006.svn3816/texmf/doc/man/man1/mktexlsr.1
===================================================================
--- texlive-bin-2006.svn3816.orig/build/source/texk/kpathsea/mktexlsr.man 2007-01-14 19:01:06.000000000 +0100
+++ texlive-bin-2006.svn3816/build/source/texk/kpathsea/mktexlsr.man 2007-01-26 03:55:05.000000000 +0100
@@ -44,3 +44,12 @@
.B --version
.rb
Print version information and exit.
+.\"=====================================================================
+.SH NOTES
+When called by root with no arguments, \fBmktexlsr\fP in Debian ignores
+TEXMF trees under \fI$HOME\fP. This is to avoid creating undesirable files
+such as \fI/root/texmf/ls-R\fP when doing usual maintainance (it is generally
+a bad idea to work with TeX as root, therefore having a file such as
+\fI/root/texmf/ls-R\fP in the first place is rather pointless). If you really
+want to update the ls-R databases for such TEXMF trees, simply list them
+explicitely on the command-line.