This is the mail archive of the cygwin mailing list for the Cygwin project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

zsh 4.3.9-1: text-mode stdin problem (breaking base64)

On Cygwin, zsh forces stdin to be text-mode. By this, some commands
don't work correctly on zsh. For example, when you encode stdin with
base64 on zsh, there is a possibility that base64 produces an incorrect

I wrote a test case. Save the script below as '':
printf '\x0D\x0A' > crlf-src
base64 < crlf-src | base64 -d > crlf-dst
if cmp crlf-src crlf-dst >/dev/null; then
  echo "OK"
  echo "NG"
And try this:
$ /bin/bash
$ /bin/zsh

Many commands, such as cat and gzip, explicitly call freopen() or
setmode() to set stdin as binary-mode. So, such commands work well even
on zsh. But, base64 doesn't take such measures and doesn't work well on
zsh. Some other commands might have the same problem.

To fix the problem, it is the easiest way to simply erase
cygwin_premain0() in main.c of zsh, and recompile zsh. If you don't
mount any filesystem as text-mode, there will be no problem. But it
seems that cygwin_premain0() is introduced for text-mode users. So, the
solution I mentioned might not work well for text-mode users.

Attachment: cygcheck.out
Description: Text document

Problem reports:
Unsubscribe info:

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]