Menu

#1037 wrong path for TEXMFLOCAL install

closed-fixed
nobody
None
5
2011-09-11
2011-08-31
Anonymous
No

I'm using the default TeX Live 2011 installation. Gnuplot configuration says:
TeX files will be installed in /usr/local/usr//usr/local/texlive/2011/../texmf-local/tex/latex/gnuplot

That location both doesn't exist and is completely pointless since TeX won't find files under /usr/local/usr/usr/local/texlive. That should have been /usr/local/texlive/texmf-local or nothing.

The sequence comes from

TEXDIR="${prefix}"
test "x$TEXDIR" = xNONE && TEXDIR=$ac_default_prefix
TEXDIR=`$KPSEXPAND $TEXDIR/usr/'$TEXMFLOCAL'/tex/latex/gnuplot |sed "s%^.*share/%$TEXDIR/share/%"`

but that is completely wrong. If user doesn't provide TEXDIR, it concatenates:
- "/usr/local" from $ac_default_prefix
- "/usr/", explicitely, just to be on the safe side(???)
- "/usr/local/texlive/2011/../texmf-local" as a result of "kpsexpand '$TEXMFLOCAL'"
- "/tex/latex/gnuplot" (which is the only part that is really ok)

To compensate for that gnuplot just uses sed to clean up the mess, but that only works on some linux installation and is pure cheating. In general it doesn't work.

The proper behaviour would be the following:
- it texdir is given, use $texdir/tex/latex/gnuplot
- if texdir is absent, use kpsexpand '$TEXMFLOCAL/tex/latex/gnuplot'; however if kpsexpand $TEXMFLOCAL doesn't return anything, preferrably one should not install any files at all (and switch to --without-latex equivalent)

$TEXMFLOCAL may vary depending on where ksexpand lives. Changing PATH (in case of multiple TeX installations) will also change $TEXMFLOCAL

Discussion

  • Mojca Miklavec

    Mojca Miklavec - 2011-08-31

    One more thing. If I use --without-latex, this also prevents building documentation. What do I have to do if I want to build documentation, but don't want *.tex, *.sty and *.cfg files to be installed into my $TEXMFLOCAL?

     
  • Christoph Bersch

    Hi,

    I created a patch which should fix this problem. (I do not know how to add files when commenting, so I just post it as text):

    checktexdir.patch:

    Index: gnuplot/configure.in

    RCS file: /cvsroot/gnuplot/gnuplot/configure.in,v
    retrieving revision 1.284
    diff -u -r1.284 configure.in
    --- gnuplot/configure.in 9 Aug 2011 17:34:29 -0000 1.284
    +++ gnuplot/configure.in 31 Aug 2011 10:29:28 -0000
    @@ -117,10 +117,12 @@
    [texdir is not given and there is no kpsexpand, please tell where to install])
    dnl texdir has priority
    if test "$TEXDIR" = "no"; then
    - #in the case prefix = NONE us ac_default_prefix
    - TEXDIR="${prefix}"
    - test "x$TEXDIR" = xNONE && TEXDIR=$ac_default_prefix
    - TEXDIR=`$KPSEXPAND $TEXDIR/usr/'$TEXMFLOCAL'/tex/latex/gnuplot |sed "s%^.*share/%$TEXDIR/share/%"`
    + TEXDIR=`$KPSEXPAND '$TEXMFLOCAL'`
    + if test "$TEXDIR" = '$TEXMFLOCAL'; then
    + AC_MSG_ERROR([Could not expand \$TEXMFLOCAL, please tell where to install the TeX files])
    + else
    + TEXDIR="$TEXDIR"/tex/latex/gnuplot
    + fi
    fi
    fi
    dnl X Window System files.

     
  • Ethan Merritt

    Ethan Merritt - 2011-08-31

    I have just tested both 4.4 and 4.5 using texlive2011 (Mandriva 2011)
    When I run ./configure, it says:
    TeX files will be installed in /usr/local/share/texmf/tex/latex/gnuplot
    (use --with-texdir=DIR to change)

    That's because the distro set TEXMFLOCAL to /usr/local/share/texmf
    I unset TEXMFLOCAL, ./configure says
    TeX files will be installed in /usr/local/share/texmf-local/tex/latex/gnuplot
    (use --with-texdir=DIR to change)
    which also seems reasonable.

    If I do ./configure --with-texdir=/usr/share/texmf-dist/tex/latex/gnuplot
    then it correctly configures and installs to the main tex directories.

    So I can't reproduce the reported problem, and so far as I can see the configure script correctly describes how to change the installation directory if you don't like the default.

    Does --with-texdir=FOO not work for you?

    Note that kpsexpand is broken on most of the machines I have tried, so not installing the TeX files just because kpsexpand fails does not seem like a good idea to me.

     
  • Christoph Bersch

    I see the same weird behavior as Mojca does: On Debian squeeze with a manual installation of TeXLive 2011. ./configure says, TeX files will be installed in /home/christoph/usr/usr//usr/local/texlive/2011/../texmf-local/tex/latex/gnuplot which is completely unreasonable as default setting. And I think it is not strange to use a manual installation of TeXLive.

    Of course, one can use --with-texdir, but at least the default should give a valid suggestion.

    So the current code seems to give a valid path for Mandriva only, but not for other systems. So the suggestion was to use the path which kpsexpand '$TEXMFLOCAL' returns.

    Which systems do you refer to when you say that kpsexpand is broken?

     
  • Ethan Merritt

    Ethan Merritt - 2011-08-31

    The problem with your proposed fix is that it fails for builds with a local or relative root.
    For example, to build a standard distribution package from the gnuplot CVS tree:
    ./prepare; ./configure; make distcheck

    This fails after applying your patch because it tries to install to an absolute path:
    TeX files will be installed in /usr/local/share/texmf/tex/latex/gnuplot
    [...]
    test -z "/usr/local/share/texmf/tex/latex/gnuplot" || /bin/mkdir -p "/usr/local/share/texmf/tex/latex/gnuplot"
    /usr/bin/install -c -m 644 ../../../share/LaTeX/gnuplot.cfg ../../../share/LaTeX/gnuplot-lua-tikz.sty ../../../share/LaTeX/gnuplot-lua-tikz-common.tex ../../../share/LaTeX/gnuplot-lua-tikz.tex ../../../share/LaTeX/t-gnuplot-lua-tikz.tex '/usr/local/share/texmf/tex/latex/gnuplot'
    /usr/bin/install: cannot remove `/usr/local/share/texmf/tex/latex/gnuplot/gnuplot.cfg': Permission denied
    make[4]: *** [install-texDATA] Error 1

    By contrast, the code that you replaced successfully builds and installs into temporary/alternative directory trees. The key difference can be seen in these lines:
    TeX files will be installed in /home/merritt/cvs/gnuplot-cvs/gnuplot-4.5/_inst/share/texmf/tex/latex/gnuplot
    [...]
    test -z "/usr/local/share/texmf/tex/latex/gnuplot" || /bin/mkdir -p "/tmp/am-dc-10339//usr/local/share/texmf/tex/latex/gnuplot"

    So I am open to further suggestions as to how to make the process work more reliably, but it has to work for local builds and private installation as well as for system installation.

     
  • Nobody/Anonymous

    Ethan, try to remove sed (everything following the pipe except for `) from
    TEXDIR=`$KPSEXPAND $TEXDIR/usr/'$TEXMFLOCAL'/tex/latex/gnuplot |sed "s%^.*share/%$TEXDIR/share/%"`
    in ./configure script and try to run configure again. That sed script only works on a very very limited set of tex distributions.

    Where/how did you unset TEXMFLOCAL?

    --with-texdir probably works fine, but the default behaviour should never return such nonsense for texdir. (I don't need those files at all to be honest. I would prefer not to install them, but then I also cannot build pdf documentation.)

    On what machines is kpsexpand broken? Can you please send me at least one example what goes wrong? If kpsewhich is also broken, it hardly makes sense to install anything since TeX won't find that. I don't find anything wrong in the idea to install TeX files despite missing kesexpand, but I think that is that case user needs to suggest where to put those files. I don't believe that random results such as "TeX files will be installed in /usr/local/usr//home/mojca/context/tex/texmf-local/tex/latex/gnuplot" (which is what I just got) make it any easier for users to use those files. In this particular case I'm using a TeX installation in my home folder (/home/mojca/context/tex), so it should run smoothly in principle, however this would fails since I don't have permissions to write to /usr/local/ (to /usr/local/usr//home/mojca/...).

     
  • Ethan Merritt

    Ethan Merritt - 2011-08-31

    I have rewritten the logic for path construction in configure.in
    Let's see if this works any better.

     
  • Christoph Bersch

    Ethan,

    I didn't know about the relative vs. absolute path. The current solution works for me now.

    I would propose the extend the check for $TEXMFLOCAL to:

    TEXDIR=`$KPSEXPAND '$TEXMFLOCAL'`
    if test "x$TEXDIR" = "x" -o "$TEXDIR" = "\$TEXMFLOCAL"; then

    because here kpsexpand '$TEXMFLOCAL' returns the string $TEXMFLOCAL if it is not defined at all.

    Thanks!

     
  • Mojca Miklavec

    Mojca Miklavec - 2011-09-01

    Thank you. This works much better. However I still have some comments.

    1.) I tried to delete kpsexpand. (You said that broken kpsexpand should be no reason for not copying the files to random folder.) In that case I get

    configure: error: texdir is not given and there is no kpsexpand, please tell where to install

    (which is actually something that I would expect from configure script)

    2.) I tried to change $TEXMFLOCAL with $TEXMFLOCALL (to check what happens if TEXMFLOCAL is not defined in texmf.cnf). I then get

    TeX files will be installed in $TEXMFLOCALL/tex/latex/gnuplot

    My suggestion is the following: if kpsexpand returns a non-empty string, try to check if that directory actually exists on computer and fail otherwise (request an explicit --with-texdir). Actually, if kpsexpand returns something, that directoly *has to* exist. Alternatively you could check that the original string $TEXMFLOCAL is not part of result (it seems that if kpsexpand is not able to expand something, it just leaves the literal string there).

    This should not be a common problems though. Just a safeguard.

    3.) If I run ./configure --prefix=$PWD/inst (this is often the case since I don't want to install ten copies of gnuplot files all over the disk just to be able to run gnuplot) I get

    TeX files will be installed in /Users/mojca/app/gnuplot/original/inst//usr/local/texlive/2011/../texmf-local/tex/latex/gnuplot

    This is very very weird again.

    My suggestion: either put files to *unmodified* $TEXMFLOCAL (no prefixes please) or use $prefix/texmf/tex/latex/gnuplot by default. Getting vaild $TEXMFLOCAL setting and then prefixing it with something is pointless. The files will finally end in $prefix, but won't be usable for TeX.

     
  • Mojca Miklavec

    Mojca Miklavec - 2011-09-01

    And to be really picky ... two or three out of five files in tex/latex/gnuplot are not usable. The files should end up at

    tex/context/gnuplot/t-gnuplot-lua-tikz.tex
    tex/generic/gnuplot/gnuplot-lua-tikz-common.tex
    tex/latex/gnuplot-lua-tikz.sty
    tex/plain/gnuplot/gnuplot-lua-tikz.tex
    tex/latex/gnuplot/gnuplot.cfg

    inside TDS tree, else ConTeXt and plain TeX cannot find support files for TikZ terminal. All the files would be found if they were placed inside tex/generic/gnuplot, but that is a bad practice (going against "standard" that has been there for years).

     
  • Ethan Merritt

    Ethan Merritt - 2011-09-01

    Mojca:

    point (1): I didn't say files should be copied to a random folder. I just said that a failure to find kpsexpand should not result in disabling latex support.

    point (2): I assumed TEXMFLOCAL was part of the standard configuration. But yes, the script could test whether it was expanded or not.

    point (3) about ./configure --prefix=$PWD/inst
    Works for me. I don't know why you would get something strange here. The --prefix mechanism is a standard part of autoconf, it's not something special to gnuplot latex support.

     
  • Mojca Miklavec

    Mojca Miklavec - 2011-09-01

    I hate my browser. It eats comments. Let's see if this one works.

     
  • Mojca Miklavec

    Mojca Miklavec - 2011-09-01

    (1a) (Just for illustration.) My own TeX distribution (ConTeXt Minimals) doesn't ship latex binary. A failure to find latex binary (and thus inability to compile pdf docs from latex sources) should not result in t-gnuplot-lua-tikz.tex, gnuplot-lua-tikz-common.tex & others not being copied to my TEXMFLOCAL. Using --with-texdir doesn't help me here and it seems that there is no way to decouple building of docs and installation of tex files.

    (1b) Vice versa. If I want to build pdf docs from latex sources, I should be able to prevent installing tex support files to TEXMFLOCAL or any other location for that matter.

    (1c) One should only use
    (i) $TEXDIR (if provided), with highest priority
    (ii) $TEXMFLOCAL (if kpsexpand works as expected and returns a valid folder***)
    (iii) either "$PREFIX/share/texmf" or "$PREFIX/share/gnuplot/$VERSION/texmf" or not install files at all (I would prefer the last choice).

    (1+3) In no case should one install TeX files to $PREFIX/$TEXMFLOCAL which is what happens now if --prefix= is provided.

    I have $TEXMFLOCAL set to /usr/local/texlive/2011/../texmf-local.
    I provide --prefix=$PWD/inst which is /tmp/gnuplot/inst.

    The command
    ./configure --prefix=$PWD/inst
    concatenates both and results in
    TeX files will be installed in /tmp/gnuplot/inst//usr/local/texlive/2011/../texmf-local/tex/latex/gnuplot
    which is both wrong and useless.

    *** check that results doesn't start with "{", that it doesn't contain "$". Optionally issue a warning if that folder doesn't exist. It should.

     
  • Ethan Merritt

    Ethan Merritt - 2011-09-01

    Mojca:
    You asked about examples of a broken kpsexpand. Note that the report from cbersch is one such case (returns $JUNK instead of "" if JUNK is not defined in tex.config).
    Other cases of missing/broken kpsexpand are not hard to find by Googling.

     
  • Christoph Bersch

    Hi,

    I look a bit more into the kpsexpand stuff:

    kpsexpand is merely a script which calls 'kpsewhich -expand-var'. I looked back until TeXLive 2007, the script is copyrighted 1997 (teTeX).

    In our case, this tries to expand '$TEXMFLOCAL' and returns the unchanged string if it can't. Calling kpsewhich -expand-path '$TEXMFLOCAL' returns an empty string, if the variable is not known. So this would lead to a more defined behaviour.

    kpsewhich -expand-var '$TEXMFLOCA' -> '$TEXMFLOCA'
    kpsewhich -expand-path '$TEXMFLOCA' -> ''

    I will try to see, if this behaviour is backward compatible with older TeX distributions.

    Regarding the prefixing I see again the same behaviour as Mojca.

    What I do not understand about this:

    ${ac_prefix_default} is set to /usr/local by default, ${prefix} must also be an absolute path (at least ./configure --prefix=../ tells me so), so in the current configure script, two absolute paths are concatenated when --prefix is used:

    if test "x$TEXDIR" = "x"; then
    TEXDIR="${ac_default_prefix}"/texmf
    fi
    TEXDIR=${TEXDIR}/tex/latex/gnuplot
    if test "x$prefix" != "xNONE"; then
    TEXDIR=${prefix}/${TEXDIR}
    fi

    gives ${prefix}/${ac_default_prefix}/texmf/tex/latex/gnuplot.

    Ethan, maybe this works for you because you changed the default settings of ${ac_default_prefix} on your machine? Usually this is /usr/local

    Christoph

     
  • Ethan Merritt

    Ethan Merritt - 2011-09-01

    Yet another attempt is now in 4.5 CVS

    Christoph: I also am using TeXLive 2007, but I see different behaviour. No idea why.

     
  • Mojca Miklavec

    Mojca Miklavec - 2011-09-01

    I took a look. kpsexpand is indeed a very simple shell script that calls kpsewhich and I don't have that script in my distribution either (I figured out that I don't need it, so I didn't bother adding it).

    I would also suggest to use
    kpsewhich -expand-path='$TEXMFLOCAL'
    instead of kpsexpand. Just in case: note that the resulting PATH might have multiple entries. This should not happen for TEXMFLOCAL, but there is no guarantee. Compare with
    kpsewhich -expand-path='$TEXMF'

    The command kpsewhich is probably the most vital part of any TeX distribution (except for ConTeXt where the author decided to rewrite functionality). If that one is missing, you can probably be sure that there is no TeX installed :)

    May I ask for some specific bugs with kpathsea/kpsexpand that you find with google (apart from missing kpsexpand)? The sole fact that it doesn't replace $JUNK with an empty string doesn't make it buggy. Missing kpsexpand might be a problem, but not something that you can fix now in tex distributions from 2003. I found many posts from people complaining about missing kpsexpand (they kept getting errors/warnings when running gnuplot), but many of them didn't have TeX installed at all.

     
  • Mojca Miklavec

    Mojca Miklavec - 2011-09-01

    Unrelated. ./configure --help gives some bad formatting (_ represents a space since spaces are eaten here on sourceforge):

    Optional Packages:
    __--with-PACKAGE[=ARG] use PACKAGE [ARG=yes]
    __--without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no)
    --without-latex disable latex support, (default enable)
    ____--with-texdir=DIR where to install latex style files

     
  • Mojca Miklavec

    Mojca Miklavec - 2011-09-01

    Ethan, the code doesn't do what I first wanted it to do (the ./configure --prefix=... now ignores kpsexpand completely), but I think that this is probably the proper behaviour and it works much better and more consistent than it did before.

    However you can change the order if you do that. There is no need to run kpsewhich if you replace it later anyway.

    if test "$with_latex" = yes; then
    test "$KPSEXPAND" = "no" -a "$TEXDIR" = "no" && AC_MSG_ERROR(dnl
    [texdir is not given and there is no kpsexpand, please tell where to install])
    dnl texdir has priority
    if test "$TEXDIR" = "no"; then
    if test "x$prefix" != "xNONE"; then
    TEXDIR=${prefix}/share/texmf
    else
    TEXDIR=`$KPSEXPAND '$TEXMFLOCAL'`
    if test "x$TEXDIR" = "x" -o "$TEXDIR" = "\$TEXMFLOCAL"; then
    TEXDIR=${ac_default_prefix}/share/texmf
    fi
    fi
    TEXDIR=${TEXDIR}/tex/latex/gnuplot
    fi

    Also, if you ignore kpsexpand, you can just as well use
    test "$KPSEXPAND" = "no" -a "$TEXDIR" = "no" -a "$TEXDIR" = "no" && AC_MSG_ERROR(dnl

    (Untested.)

    Some additional suggestions to follow ...

     
  • Mojca Miklavec

    Mojca Miklavec - 2011-09-01

    Some suggestions:

    (1) I would suggest to replace kpsexpand with
    kpsewhich --expand-path='$TEXMFLOCAL'
    The command kpsewhich is more common.

    (2) Just to be on the safe side, check that the result doesn't contain more that one directory. This should not happen, but it is not forbidden either.

    (3) Is there any chance to be able to install these files without having to have latex/pdflatex binary available?

    (4) Getting TDS structure right. But that means some additional work (it has to be clear where to install files and what --with-texdir means: TDS root or final destination with flat structure).

    (5) I have many more comments about KPSEXPAND. The source code inside gnuplot is "wrong" in many places which explains why I never managed to get TeX fonts to work in gnuplot (in pngs and so on). This needs heavy source code changes and a separate thread.

     
  • Ethan Merritt

    Ethan Merritt - 2011-09-11

    Fixed. I hope. Re-open or start a new bug report if not.

     
  • Ethan Merritt

    Ethan Merritt - 2011-09-11
    • status: open --> closed-fixed
     

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.