zsh-workers
 help / color / mirror / code / Atom feed
* text vs. binary file open on Cygwin
@ 2000-10-20  8:41 Andrej Borsenkow
  0 siblings, 0 replies; only message in thread
From: Andrej Borsenkow @ 2000-10-20  8:41 UTC (permalink / raw)
  To: ZSH workers mailing list

Under cygwin (and MS in general) they are different. Binary mode reads/write
files as is; text mode translates between internal LF and external CR-LF for
line ends.

Cygwin is using very elaborate scheme (at least, I like it) to allow both Unix
and Windows environment to coexist. The description is on
<http://www.cygwin.com/cygwin-ug-net/using-textbinary.html>. Side effect of
this implementation is, if you create file on binary-mounted directory, then
move it to text-mounted one and read, you probably won't get expected results.

As a rule of thumb (my own) - if you use binary file, use explicit O_BINARY;
if you use text file - leave it to system (a.k.a. cygwin) to decide.

Currently I see at least two places, where we must use binary:

- wordcode files (creation and reading). Is it possible for these files to
contain explicit NL and CR-NL? Casual tests did not show problems; still,
files are obviously binary.

- memory mapped files. We do not support mmap on Cygwin, but we emulate it.
And mmap is supposed to give you exact content of the file. Side effect is,
that $(<file) is (possibly) no more the same as $mapfiles[file], but I do not
see any workaround.

Is there any other place where Zsh must (internally) use binary mode?

Another question is, should we expose text vs. binary at user level? E.g.
option to force pipes and/or redirections to be in explicit mode? But it is
probably too far fetching.

-andrej

Have a nice DOS!
B >>


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2000-10-20  8:41 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2000-10-20  8:41 text vs. binary file open on Cygwin Andrej Borsenkow

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