From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 4320 invoked from network); 5 Jul 2001 11:34:13 -0000 Received: from sunsite.dk (130.225.51.30) by ns1.primenet.com.au with SMTP; 5 Jul 2001 11:34:13 -0000 Received: (qmail 11498 invoked by alias); 5 Jul 2001 11:33:13 -0000 Mailing-List: contact zsh-workers-help@sunsite.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 15253 Received: (qmail 11352 invoked from network); 5 Jul 2001 11:32:39 -0000 X-Envelope-Sender-Is: Andrej.Borsenkow@mow.siemens.ru (at relayer goliath.siemens.de) From: "Andrej Borsenkow" To: , "Michael Schaap" Cc: "ZSH Workers Mailing List" Subject: RE: Zsh observations Date: Thu, 5 Jul 2001 15:33:26 +0400 Message-ID: <000501c10546$4e7318e0$21c9ca95@mow.siemens.ru> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Priority: 3 (Normal) X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook IMO, Build 9.0.2416 (9.0.2911.0) In-Reply-To: <5.1.0.14.2.20010705112435.03520c60@imap.mscha.org> Importance: Normal X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2479.0006 > > At 07:59 5-7-2001, Andrej Borsenkow wrote: > >Zsh relies on system execve to find command. Basically, it does > > > >for dir in path > > execve dir/cmd > > > >until it succeeds. We recently have a brief discussion on > zsh-workers about > >it. Irrespectivley if you consider it a bug or feature this was > around for a > >very long time. So the above lets suspect problem in Cygwin exec > - sometimes > >it fails to execute /a/hello.exe. Can you reliably reproduce it? > > Yes, I've figured it out. > It only happens when "setopt correct" is set, the first instance > of a file > in the PATH has a .exe extension, and the second doesn't. Here's how to > reproduce it. > > I created an executable /tmp/a/dummy.exe which prints "a", and a script > "/tmp/b/dummy" which prints "b". > > Move all zsh initialisation files (/etc/z* and ~/.z*) away, and > open a new > zsh window. > You do not need it. Just do zsh -f. The only file that will be sourced (if exists) is /etc/zshenv. > Now type: > % PATH=/usr/bin:/tmp/a:/tmp/b > % dummy > a > > Open a new zsh window, and type: > % PATH=/usr/bin:/tmp/a:/tmp/b > % setopt correct > % dummy > b > > Conclusion: don't use "setopt correct" under Cygwin. :-( > Apply this patch and do it :-) It was lost when gcc stopped setting _WIN32 by default. Note, that it will make completion list executables twice - as foo and foo.exe. With new completion you may want to set something like zstyle ':completion::complete:-command-:*' ignored-patterns '*.(#i)(exe|dll)' to prevent *.exe and *.dll from appearing in the list (given, that every foo.exe is already hashed as foo, it is O.K.; and dll is not executable anyway - or is it?) With old completion you may set fignore parameter. cheers -andrej Index: Src/hashtable.c =================================================================== RCS file: /cvsroot/zsh/zsh/Src/hashtable.c,v retrieving revision 1.10 diff -u -r1.10 hashtable.c --- Src/hashtable.c 2001/05/19 09:22:07 1.10 +++ Src/hashtable.c 2001/07/05 11:27:21 @@ -630,9 +630,9 @@ Cmdnam cn; DIR *dir; char *fn; -#ifdef _WIN32 +#if defined(_WIN32) || defined(__CYGWIN__) char *exe; -#endif +#endif /* _WIN32 || _CYGWIN__ */ if (isrelative(*dirp) || !(dir = opendir(unmeta(*dirp)))) return; @@ -644,7 +644,7 @@ cn->u.name = dirp; cmdnamtab->addnode(cmdnamtab, ztrdup(fn), cn); } -#ifdef _WIN32 +#if defined(_WIN32) || defined(__CYGWIN__) /* Hash foo.exe as foo, since when no real foo exists, foo.exe will get executed by DOS automatically. This quiets spurious corrections when CORRECT or CORRECT_ALL is set. */ @@ -660,7 +660,7 @@ cmdnamtab->addnode(cmdnamtab, ztrdup(fn), cn); } } -#endif /* _WIN32 */ +#endif /* _WIN32 || __CYGWIN__ */ } closedir(dir); }