zsh-workers
 help / color / mirror / code / Atom feed
* forward: fix for problem under cygwin
@ 2001-12-15  1:13 Peter Stephenson
  2001-12-17 14:43 ` Borsenkow Andrej
  0 siblings, 1 reply; 2+ messages in thread
From: Peter Stephenson @ 2001-12-15  1:13 UTC (permalink / raw)
  To: Zsh hackers list


------- Forwarded Message

From: JohnW@bops.com
To: coordinator@zsh.org
Subject: fix for problem under cygwin
Date: Mon, 10 Dec 2001 13:52:31 -0600
MIME-Version: 1.0
Content-Type: text/plain;
	charset="iso-8859-1"

I found a Unixism in zsh that prevents autoloading and function compilation
from working under cygwin. There are several bits of code that assume
character offsets are the same as byte offsets in files. I've fixed this by
either opening files in binary mode or relaxing the error checking. Here are
the lines I had to change:

exec.c:3473:
    off_t len, textlen;
exec:c:3493:
		if ((textlen = read(fd, d, len)) >= 0) {
exec.c:3497-8:
		    d[textlen] = '\0';
		    d = metafy(d, textlen, META_REALLOC);
parse.c:2408:
    if ((fd = open(name, O_RDONLY | O_BINARY)) < 0) {
parse.c:2545:
    int dfd, fd, hlen, tlen, flen, ona = noaliases, textlen;
parse.c:2580: (DELETED)
	file[flen] = '\0';
parse.c:2581:
	if ((textlen = read(fd, file, flen)) < 0) {
parse.c:2591:
	file[textlen] = '\0';
	file = metafy(file, textlen, META_REALLOC);
parse.c:3017:
	    if ((fd = open(file, O_RDONLY | O_BINARY)) < 0 ||

------- End of Forwarded Message


^ permalink raw reply	[flat|nested] 2+ messages in thread

* RE: forward: fix for problem under cygwin
  2001-12-15  1:13 forward: fix for problem under cygwin Peter Stephenson
@ 2001-12-17 14:43 ` Borsenkow Andrej
  0 siblings, 0 replies; 2+ messages in thread
From: Borsenkow Andrej @ 2001-12-17 14:43 UTC (permalink / raw)
  To: 'Zsh hackers list'; +Cc: JohnW



> 
> I found a Unixism in zsh that prevents autoloading and function
compilation
> from working under cygwin. There are several bits of code that assume
> character offsets are the same as byte offsets in files. I've fixed
this by
> either opening files in binary mode or relaxing the error checking.

No. We must never assume files are DOS text files because it makes them
non-portable not only between Cygwin/Unix but even between two different
Cygwin instances (just think about remounting the same directory in
binary mode after creating file in text mode).

We must ensure that read/write of zwc files always happens in binary
mode. This will make it possible to share files between Cygwin/Unix as
well. Your patch has several O_BINARY for reading but I do not see
O_BINARY for writing.

Of course, after doing it one probably has to recreate zwc files to be
sure.

-andrej


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2001-12-17 14:43 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-12-15  1:13 forward: fix for problem under cygwin Peter Stephenson
2001-12-17 14:43 ` Borsenkow Andrej

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).