delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2005/05/24/08:23:49

Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com
Date: Tue, 24 May 2005 14:22:25 +0200
From: Stepan Kasal <kasal AT ucw DOT cz>
To: Karl Berry <karl AT freefriends DOT org>
Cc: ebb9 AT byu DOT net, dave AT boost-consulting DOT com, akim AT epita DOT fr, cygwin AT cygwin DOT com,
bug-texinfo AT gnu DOT org
Subject: Re: Fw: bug in texi2dvi, and hack patch
Message-ID: <20050524122225.GA29608@math.cas.cz>
Mail-Followup-To: Karl Berry <karl AT freefriends DOT org>, ebb9 AT byu DOT net, dave AT boost-consulting DOT com, akim AT epita DOT fr, cygwin AT cygwin DOT com, bug-texinfo AT gnu DOT org
References: <20050124083421 DOT GA2986 AT matsrv DOT math DOT cas DOT cz> <200502110143 DOT j1B1hnC00593 AT f7 DOT net>
Mime-Version: 1.0
In-Reply-To: <200502110143.j1B1hnC00593@f7.net>
User-Agent: Mutt/1.4.1i
X-Virus-Status: Clean

--jRHKVT23PllUwdXP
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline

Hello,

On Thu, Feb 10, 2005 at 08:43:49PM -0500, Karl Berry wrote:
> Back on this thread about texi2dvi and cygwin from a couple weeks ago.

Back, after 3 1/2 month.  This thread is immortal!

You added the comment:
	# But on cygwin, test -x foo will not find foo.exe.

This is not true.  test -x looks for .exe on both platforms.
The difference is that test -f doesn't look for .exe on DJGPP, while
on Cygwin it does.

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

So this is why `test ! -d' fails if both tex/ and tex.exe exist.

Anyway, your code fixed this case, but the proof would be different. ;-)

So my job was to fix the comment.  Well, I actually replaced the code
together with the comments, to get something which is easier to explain.
(Actually, my code is close to what Autoconf does.)

See the attached patch.
I hope I haven't screwed anything.

Have a nice day,
	Stepan Kasal

PS: if ebb9 or dave can actually fwd this to the cygwin list, that might be
a good idea; I'm not subscribed there.

--jRHKVT23PllUwdXP
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename="texinfo-20050524-test-x.patch"

2005-05-24  Stepan Kasal  <kasal AT ucw DOT cz>

	* util/texi2dvi (findprog): Rewrite the test for an executable and
	the explanation above.

Index: util/texi2dvi
===================================================================
RCS file: /cvsroot/texinfo/texinfo/util/texi2dvi,v
retrieving revision 1.50
diff -u -r1.50 texi2dvi
--- util/texi2dvi	15 May 2005 00:00:08 -0000	1.50
+++ util/texi2dvi	24 May 2005 12:17:53 -0000
@@ -130,16 +130,15 @@
   saveIFS=$IFS
   IFS=$path_sep  # break path components at the path separator
   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
-      foundprog=true
-      break
-
-    # But on cygwin, test -x foo will not find foo.exe.  So also check
-    # for that.
-    elif test -x "$dir/$1.exe"; then
+    # The basic test for an executable is `test -f $f && test -x $f'.
+    # `test -x' is not enough, because it can also be true for directories.
+    #
+    # On Cygwin and DJGPP, `test -x' also looks for .exe.  On Cygwin, also
+    # `test -f' has this enhancement, bot not on DJGPP.  (Both are design
+    # decisions, so there is little chance to make them consistent.)
+    # Thus we have to try `test -f' twice.
+    if  test -x "$dir/$1" &&
+	{ test -f "$dir/$1" || test -f "$dir/$1.exe"; }; then
       foundprog=true
       break
     fi


--jRHKVT23PllUwdXP
Content-Type: text/plain; charset=us-ascii

--
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/
--jRHKVT23PllUwdXP--

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019