[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#5994: base64: I/O should be performed in binary-mode
From: |
Yutaka Amanai |
Subject: |
bug#5994: base64: I/O should be performed in binary-mode |
Date: |
Wed, 21 Apr 2010 18:46:23 +0900 |
User-agent: |
Mozilla/5.0 (Windows; U; Windows NT 5.1; ja; rv:1.9.1.9) Gecko/20100317 Thunderbird/3.0.4 |
base64 doesn't call freopen() nor setmode() against stdin, and doesn't
give "rb" flag to fopen(). So, base64 sometimes fails to encode data
correctly on some environment. For example, zsh on Cygwin forces stdin
to be text-mode.
Test case (zsh on Cygwin, filesystems are mounted as binary-mode):
$ printf '\x0D\x0A' > crlf-src
$ base64 < crlf-src | base64 -d > crlf-dst
$ cmp crlf-src crlf-dst
crlf-src crlf-dst differ: char 1, line 1
- bug#5994: base64: I/O should be performed in binary-mode,
Yutaka Amanai <=