bug-texinfo
[Top][All Lists]
Advanced

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

Re: Fw: bug in texi2dvi, and hack patch


From: Stepan Kasal
Subject: Re: Fw: bug in texi2dvi, and hack patch
Date: Mon, 24 Jan 2005 09:34:21 +0100
User-agent: Mutt/1.4.1i

Hi,

On Sun, Jan 23, 2005 at 08:15:32PM -0500, Karl Berry wrote:
> Regarding texi2dvi and cygwin, please see if the new version (below) works.

>   for dir in $PATH; do
>     # use test -x rather than test -f for DJGPP, where test -x checks
>     # for .exe.  But test -x will also return true for directories, so
>     # explicitly ignore those.
>     if test -x "$dir/$1" && test ! -d "$dir/$1"; then

I see two problems:

1) on a unix-style platforms, if /tmp/etex is a special file (eg. a named pipe)
and if /tmp is in PATH, the code will think this is a binary.
As you don't remember the path, this problem would only hit if a named pipe
existed, while the binary did not.  Unlikely.

2) On cygwin, if both $dir/tex.exe exists and a directory $dir/tex/ exist,
this function misses the existence of tex.exe.

I'm afraid the later can actually happen; so the proposed code would cause
problems on Cygwin.

I see two possible ways of solution:

Fix the problem exactly as reported:
the configure script tests for the problem:

        AC_SUBST(TESTF, "test -f")
        testfile=conf$$.exe
        touch $testfile
        if test -x $testfile; then
                test -f $testfile || TESTF=:
        fi
        rm -f $testfile

and use
        for dir in $PATH; do
          if test -x "$dir/$1" && @TESTF@ "$dir/$1"; then
or
        testf="@TESTF@"
        ...
        for dir in $PATH; do
          if test -x "$dir/$1" && $testf "$dir/$1"; then

in texi2dvi.in .

Another way to fix the problem is to adopt the solution used by autoconf:
make sure that the variable $ac_executable_extensions, which is set in
config.site on some platforms, gets substituted:

        AC_SUBST(ac_executable_extensions)

and put the following to texi2dvi.in:

        for dir in $PATH; do
          for exec_ext in '' @ac_executable_extensions@; do
            if test -f "$dir/$1" && test -x "$dir/$1"; then
                ...

Or you can write configure.ac in a more sofisticated way:

        AC_SUBST(exeext_for, "")
        AC_SUBST(exeext_done, "")
        if test -n "$ac_executable_extensions"; then
          exeext_for="for exec_ext in '' @ac_executable_extensions@; do"
          exeext_done=done
        fi

and texi2dvi.in would contain

        for dir in $PATH; do
          @exeext_for@
            if test -f "$dir/$1" && test -x "$dir/$1"; then
                ...
            fi
          @exeext_done@
        done

This way would texi2dvi stay simpler on unix-like platforms.

(Sorry, Karl, I don't volunteer tro prepare any patch, at least not now.
And I don't have any DJGPP or mingw system an hand for debugging.)

Have a nice day,
        Stepan




reply via email to

[Prev in Thread] Current Thread [Next in Thread]