[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: mktexlsr_fixes error when HOME is empty



Dear Patrice,

thanks a lot for the patch ... please send all these stuff to
debian-tex-maint@lists.debian.org (and me if you want, but I read the
list ;-).

For all the list guys, please read through the email.

Patrice: Do you mean when /home/ is empty or when $HOME is empty? And
what does "all the directories are skipped" mean? Does it mean that no
ls-R files are generated at all because mktexlsr just breaks?

Thanks and all the best

Norbert

On So, 06 Jan 2008, Patrice Dumas wrote:
> Hello,
> 
> When HOME is empty and user is root all the directories are skipped. 
> I propose the attached patch that should not exhibit this problem.
> It is rediffed, and I apply it with -p1 while we applied the previous
> with -p3 (in fedora texlive).
> 
> --
> Pat

> diff -up texlive-2007/texk/kpathsea/mktexlsr.man.mktexlsr_fixes texlive-2007/texk/kpathsea/mktexlsr.man
> --- texlive-2007/texk/kpathsea/mktexlsr.man.mktexlsr_fixes	2006-01-17 22:41:51.000000000 +0100
> +++ texlive-2007/texk/kpathsea/mktexlsr.man	2008-01-06 16:13:33.000000000 +0100
> @@ -44,3 +44,12 @@ Print help message and exit.
>  .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.
> diff -up texlive-2007/texk/kpathsea/mktexlsr.mktexlsr_fixes texlive-2007/texk/kpathsea/mktexlsr
> --- texlive-2007/texk/kpathsea/mktexlsr.mktexlsr_fixes	2006-12-25 19:44:43.000000000 +0100
> +++ texlive-2007/texk/kpathsea/mktexlsr	2008-01-06 16:37:22.000000000 +0100
> @@ -82,10 +82,21 @@ test $# = 0 && {
>  '
>    set x `kpsewhich --show-path=ls-R | tr : '
>  ' | sort | uniq`; shift
> +  if test "`id -u`" -eq 0; then
> +    NOROOTHOME=true
> +  fi
>    IFS=$OIFS
>  }
>  
>  for TEXMFLS_R in "$@"; do
> +  if [ "z$HOME" != 'z' ]; then
> +    case "$TEXMFLS_R" in
> +    $HOME/*) if test -n "$NOROOTHOME"; then
> +  		tty -s && echo "$progname: Skipping $TEXMFLS_R" >&2
> +		continue
> +	   fi ;;
> +    esac
> +  fi
>    # Prepend cwd if the directory was relative.
>    case "$TEXMFLS_R" in
>    "") continue ;;  # Strictly speaking, it is an error if this case is taken.
> @@ -112,9 +123,9 @@ for TEXMFLS_R in "$@"; do
>    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 +139,8 @@ for TEXMFLS_R in "$@"; do
>    # 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 +160,8 @@ for TEXMFLS_R in "$@"; do
>     | 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


-------------------------------------------------------------------------------
Dr. Norbert Preining <preining@logic.at>        Vienna University of Technology
Debian Developer <preining@debian.org>                         Debian TeX Group
gpg DSA: 0x09C5B094      fp: 14DF 2E6C 0307 BE6D AD76  A9C0 D2BF 4AA3 09C5 B094
-------------------------------------------------------------------------------
MOFFAT (n. tailoring term)
That part of your coat which is designed to be sat on by the person
next of you on the bus.
			--- Douglas Adams, The Meaning of Liff


Reply to: