tibbs / rpms / texlive

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