From: "Andrej Borsenkow" <Andrej.Borsenkow@mow.siemens.ru>
To: <cygwin@cygwin.com>, "Michael Schaap" <cygwin@mscha.com>
Cc: "ZSH Workers Mailing List" <zsh-workers@sunsite.dk>
Subject: RE: Zsh observations
Date: Thu, 5 Jul 2001 15:33:26 +0400 [thread overview]
Message-ID: <000501c10546$4e7318e0$21c9ca95@mow.siemens.ru> (raw)
In-Reply-To: <5.1.0.14.2.20010705112435.03520c60@imap.mscha.org>
>
> 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);
}
next parent reply other threads:[~2001-07-05 11:34 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <5.1.0.14.2.20010705112435.03520c60@imap.mscha.org>
2001-07-05 11:33 ` Andrej Borsenkow [this message]
2001-07-05 13:15 ` Michael Schaap
2001-07-08 12:57 ` Michael Schaap
2001-07-08 17:07 ` Andrej Borsenkow
[not found] ` <Pine.SV4.4.33.0107082101110.3442-100000@itsrm2.mow.siemens .ru>
2001-07-08 17:30 ` Michael Schaap
2001-07-09 5:49 ` Andrej Borsenkow
2001-07-09 9:31 ` Michael Schaap
2001-07-09 11:28 ` Bart Schaefer
2001-07-09 11:44 ` Sven Wischnowsky
2001-07-09 17:30 ` Andrej Borsenkow
[not found] ` <Pine.SV4.4.33.0107092120020.12110-100000@itsrm2.mow.siemen s.ru>
2001-07-09 19:22 ` Michael Schaap
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='000501c10546$4e7318e0$21c9ca95@mow.siemens.ru' \
--to=andrej.borsenkow@mow.siemens.ru \
--cc=cygwin@cygwin.com \
--cc=cygwin@mscha.com \
--cc=zsh-workers@sunsite.dk \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.vuxu.org/mirror/zsh/
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).