| 1 |
diff -up texlive-2007/texk/kpathsea/mktexlsr.man.mktexlsr_fixes texlive-2007/texk/kpathsea/mktexlsr.man
|
| 2 |
--- texlive-2007/texk/kpathsea/mktexlsr.man.mktexlsr_fixes 2006-01-17 22:41:51.000000000 +0100
|
| 3 |
+++ texlive-2007/texk/kpathsea/mktexlsr.man 2008-01-06 16:13:33.000000000 +0100
|
| 4 |
@@ -44,3 +44,12 @@ Print help message and exit.
|
| 5 |
.B --version
|
| 6 |
.rb
|
| 7 |
Print version information and exit.
|
| 8 |
+.\"=====================================================================
|
| 9 |
+.SH NOTES
|
| 10 |
+When called by root with no arguments, \fBmktexlsr\fP in Debian ignores
|
| 11 |
+TEXMF trees under \fI$HOME\fP. This is to avoid creating undesirable files
|
| 12 |
+such as \fI/root/texmf/ls-R\fP when doing usual maintainance (it is generally
|
| 13 |
+a bad idea to work with TeX as root, therefore having a file such as
|
| 14 |
+\fI/root/texmf/ls-R\fP in the first place is rather pointless). If you really
|
| 15 |
+want to update the ls-R databases for such TEXMF trees, simply list them
|
| 16 |
+explicitely on the command-line.
|
| 17 |
diff -up texlive-2007/texk/kpathsea/mktexlsr.mktexlsr_fixes texlive-2007/texk/kpathsea/mktexlsr
|
| 18 |
--- texlive-2007/texk/kpathsea/mktexlsr.mktexlsr_fixes 2006-12-25 19:44:43.000000000 +0100
|
| 19 |
+++ texlive-2007/texk/kpathsea/mktexlsr 2008-01-06 16:37:22.000000000 +0100
|
| 20 |
@@ -82,10 +82,21 @@ test $# = 0 && {
|
| 21 |
'
|
| 22 |
set x `kpsewhich --show-path=ls-R | tr : '
|
| 23 |
' | sort | uniq`; shift
|
| 24 |
+ if test "`id -u`" -eq 0; then
|
| 25 |
+ NOROOTHOME=true
|
| 26 |
+ fi
|
| 27 |
IFS=$OIFS
|
| 28 |
}
|
| 29 |
|
| 30 |
for TEXMFLS_R in "$@"; do
|
| 31 |
+ if [ "z$HOME" != 'z' ]; then
|
| 32 |
+ case "$TEXMFLS_R" in
|
| 33 |
+ $HOME/*) if test -n "$NOROOTHOME"; then
|
| 34 |
+ tty -s && echo "$progname: Skipping $TEXMFLS_R" >&2
|
| 35 |
+ continue
|
| 36 |
+ fi ;;
|
| 37 |
+ esac
|
| 38 |
+ fi
|
| 39 |
# Prepend cwd if the directory was relative.
|
| 40 |
case "$TEXMFLS_R" in
|
| 41 |
"") continue ;; # Strictly speaking, it is an error if this case is taken.
|
| 42 |
@@ -112,9 +123,9 @@ for TEXMFLS_R in "$@"; do
|
| 43 |
db_dir=`echo "$db_file" | sed 's%/[^/][^/]*$%%'` # can't rely on dirname
|
| 44 |
|
| 45 |
test -d "$db_dir" || continue
|
| 46 |
- test -w "$db_dir" || { echo "$progname: $db_dir: directory not writable. Skipping..." >&2; continue; }
|
| 47 |
|
| 48 |
if test ! -f "$db_file"; then
|
| 49 |
+ test -w "$db_dir" || { echo "$progname: $db_dir: directory not writable. Skipping..." >&2; continue; }
|
| 50 |
cp /dev/null "$db_file"
|
| 51 |
# Use same permissions as parent directory, minus x,s, or t bits.
|
| 52 |
chmod `kpsestat -xst "$db_dir"` "$db_file"
|
| 53 |
@@ -128,11 +139,8 @@ for TEXMFLS_R in "$@"; do
|
| 54 |
# Skip if we cannot write the file:
|
| 55 |
kpseaccess -w "$db_file" || { echo "$progname: $db_file: no write permission. Skipping..." >&2; continue; }
|
| 56 |
|
| 57 |
- db_dir_tmp="$db_dir/lsR$$.tmp"
|
| 58 |
- (umask 077 && mkdir "$db_dir_tmp" ) \
|
| 59 |
- || { echo "$progname: could not create directory '$db_dir_tmp'. Skipping..." >&2; continue; }
|
| 60 |
- db_file_tmp="$db_dir_tmp/lsR$$.tmp"
|
| 61 |
- rm -f "$db_file_tmp"
|
| 62 |
+ db_file_tmp=`mktemp -t ls-R.XXXXXXXXXX` \
|
| 63 |
+ || { echo "$progname: could not create temporary file for '$db_file'. Skipping..." >&2; continue; }
|
| 64 |
|
| 65 |
$verbose && echo "$progname: Updating $db_file... " >&2
|
| 66 |
echo "$ls_R_magic" >"$db_file_tmp"
|
| 67 |
@@ -152,12 +160,8 @@ for TEXMFLS_R in "$@"; do
|
| 68 |
| sed -e '/\.svn.*:$/,/^$/d' \
|
| 69 |
>>"$db_file_tmp"
|
| 70 |
|
| 71 |
- # To be really safe, a loop.
|
| 72 |
- until PERMS=`kpsestat = "$db_file"`; do sleep 1; done
|
| 73 |
- chmod $PERMS "$db_file_tmp"
|
| 74 |
- rm -f "$db_file"
|
| 75 |
- mv "$db_file_tmp" "$db_file"
|
| 76 |
- rm -rf "$db_dir_tmp"
|
| 77 |
+ cat "$db_file_tmp" > "$db_file"
|
| 78 |
+ rm -f "$db_file_tmp"
|
| 79 |
done
|
| 80 |
$verbose && echo "$progname: Done." >&2
|
| 81 |
exit 0
|