Subject: Re: Fw: bug in texi2dvi, and hack patch
From: "Eli Zaretskii" <[email-masked]>
To: Eric Blake <[email-masked]>
Cc: [email-masked], [email-masked], [email-masked]
Date: Tue, 18 Jan 2005 22:18:41 +0200

> Date: Tue, 18 Jan 2005 06:29:08 -0700
> From: Eric Blake <[email-masked]>
> Cc: [email-masked], [email-masked]
> 
> This was sent to a cygwin list, but is more properly a texinfo problem in
> the texi2dvi script (version 4.7).  $COMSPEC has meaning in djgpp and
> perhaps mingw, but is just a worthless environment variable when inherited
> into cygwin.

That snippet was never meant to DTRT for Cygwin, so it's not a
surprise it doesn't.

> Instead of using $COMSPEC for determining the path
> separator, you should use autoconf's approach (look at any recent
> configure script generated by autoconf 2.59 for this snippet):
> 
> if test "${PATH_SEPARATOR+set}" != set; then
>   echo "#! /bin/sh" >conf$$.sh
>   echo  "exit 0"   >>conf$$.sh
>   chmod +x conf$$.sh
>   if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then
>     PATH_SEPARATOR=';'
>   else
>     PATH_SEPARATOR=:
>   fi
>   rm -f conf$$.sh
> fi

If this is what Autoconf 2.59 really does (i.e., no typos etc. in this
snippet), then Autoconf 2.59 is broken, at least for DJGPP, because it
will always produce PATH_SEPARATOR=:.  This is because it invalidates
PATH, and therefore defeats the DJGPP magic that looks for sh.exe
along PATH if /bin/sh.exe does not exist.  (And /bin/sh.exe does not
exists on almost every DJGPP installation.)

Instead of such complicated jumps through the hoops, I'd suggest to
keep the original test, but augment it with something specific to
Cygwin.  Is there some environment variable, like OSTYPE or something,
whose value shows that a Cygwin Bash is being run?  If there is such a
variable, we could look at it in addition to COMSPEC.

> Additionally, according to autoconf, `test -x' is not portable.

But needed for DJGPP/MinGW, where "test -f tex" does not find tex.exe,
but "test -x tex" does.

So if this is changed to not use "test -x", the non-Posix systems will
still need "test -x" (which is okay for those systems, since the
ported Bash supports "test -x").

> Your best bet may be to make texi2dvi a generated file from
> texi2dvi.in, and let autoconf determine @PATH_SEPARATOR@ and even
> the location of tex up front at configure time

Again, doing the latter (i.e. determining the location of TeX at
configure time) might be okay on Posix systems, but not on
DJGPP/MinGW, since it is _very_ customary on those systems to download
pre-compiled binaries, and thus configure-time settings are usually
invalid.  (Actually, I think Cygwin users will not like your
suggestion either, since AFAIK they, too, tend to download binaries.)

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/