[tex-k] Does remote_dots() in kpathsea work?

Albert Chin tex-k at mlists.thewrittenword.com
Fri Dec 23 00:09:41 CET 2005


Does remove_dots() in texk/kpathsea/progname.c work? If I build it
with -DTEST to run the small test suite, I get:
  $ cd /opt/build/tetex-src-3.0/texk/kpathsea
  $ cc -DTEST progname.c .libs/libkpathsea.a
  $ ./a.out
  /w/kpathsea
  /w/kpathsea
  /w/kpathsea
  /opt/build/tetex-src-3.0/texk/kpathsea
  /opt/build/tetex-src-3.0/texk/kpathsea
  /opt/build/tetex-src-3.0/texk/kpathsea
  /opt/build/tetex-src-3.0/texk/kpathsea
  /kpathsea/foo
  /w/kpathsea
  /w/kpathsea
  /te/bin/gnu

Based on this output, "/kpathsea/foo" <- "/kpathsea/../foo". But, this
isn't right. Why doesn't:
  remove_dots ("/kpathsea/../foo") -> "/foo"
  remove_dots ("/te/share/texmf/../../../../bin/gnu") -> "/bin/gnu"

This is relative to kpathsea v3.5.4 in tetex-3.0. The patch below
fixes the problem for us.

-- 
albert chin (china at thewrittenword.com)

-- snip snip
Index: texk/kpathsea/progname.c
===================================================================
--- texk/kpathsea/progname.c.orig	2003-09-15 01:05:29.000000000 -0500
+++ texk/kpathsea/progname.c	2005-12-22 12:24:27.702849000 -0600
@@ -305,7 +305,8 @@
             /* If we have `/../', that's the same as `/'.  */
             if (last > 1) {
               ret[last - 1] = 0;
-            }
+            } else
+              ret[last] = 0;
             break;
           }
         }



More information about the tex-k mailing list