GNU bug report logs - #5994
base64: I/O should be performed in binary-mode

Previous Next

Package: coreutils;

Reported by: Yutaka Amanai <yasai-itame1942 <at> jade.plala.or.jp>

Date: Wed, 21 Apr 2010 12:35:01 UTC

Severity: normal

Tags: patch

Merged with 5996

Done: Jim Meyering <jim <at> meyering.net>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Yutaka Amanai <yasai-itame1942 <at> jade.plala.or.jp>
To: 5994 <at> debbugs.gnu.org
Subject: bug#5994: base64: I/O should be performed in binary-mode
Date: Wed, 21 Apr 2010 18:46:23 +0900
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





This bug report was last modified 15 years and 35 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.