--- Begin Message ---
Subject: |
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
--- End Message ---
--- Begin Message ---
Subject: |
Re: bug#5996: [PATCH] base64: always treat input in binary mode |
Date: |
Thu, 22 Apr 2010 19:52:14 +0200 |
Eric Blake wrote:
> On 04/22/2010 11:00 AM, Glenn Morris wrote:
>>
>> Hi,
>>
>> The following message got resent to bug-gnu-emacs rather than
>> bug-coreutils, because debbugs got confused.
>
> Well, my screw-up with To: fields means that my planned review period
> was delayed...
>
>>> Thanks for the report. I'll commit this later today if there are no
>>> objections; it should have no impact for any platform that does not
>>> have O_BINARY, and although it is not perfect on Cygwin, it is not
>>> too much to add to my workload for creating the cygwin port of coreutils
>>> 8.5. And someday I'll get around to creating the new gnulib interface
>>> for gracefully enforcing binary streams without clobbering O_APPEND.
>
> But I'd still like to commit this in time for coreutils 8.5 later today
> if there are no complaints.
That patch looks fine.
You're welcome to push it. Thanks!
--- End Message ---