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.
2005-05-24 Stepan Kasal <[EMAIL PROTECTED]> * 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
-- 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/