proposed patch to mktexlsr

[email protected] (Frank Küster)
Newsgroups gmane.comp.tex.tetex.beta
Message-ID <[email protected]>
Hi Thomas, hi Testers,

The following patch has been applied to Debian packages of teTeX since
2.0 or so, and I don't know whether it has been discussed here yet:

--- texk/kpathsea/mktexlsr.orig.tmp	Thu Mar 25 17:48:29 2004
+++ texk/kpathsea/mktexlsr	Thu Mar 25 17:48:29 2004
@@ -80,12 +80,13 @@
   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"
+  elif test ! -s "$db_file"; then true # it was touched, but is empty - no need to check for $ls_R_magic
   elif 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

That is: 

- if we don't have write permissions to the directory, but the file
  exists yet, we don't skip this directory. Below the script checks if
  the file is writeable, anyway:

  # Skip if we cannot write the file:
  access -w "$db_file" || { echo "$progname: $db_file: no write permission. Skipping..." >&2; continue; }

- The test for the magic can be skipped if the file is empty. It seems
  this had occurred to a Debian user under some weird circumstances.

Regards, Frank
-- 
Frank Küster, Biozentrum der Univ. Basel
Abt. Biophysikalische Chemie
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.