From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: ludo@gnu.org (Ludovic =?utf-8?Q?Court=C3=A8s?=) Newsgroups: gmane.lisp.guile.user Subject: Re: guile 2.0.9 build on mingw Date: Wed, 19 Jun 2013 21:26:34 +0200 Message-ID: <87bo71dhqt.fsf@gnu.org> References: <83sj1hv2ml.fsf@gnu.org> <874ndx9y7h.fsf@pobox.com> <83ip2bt4qk.fsf@gnu.org> <8761xqhyyt.fsf@gnu.org> <83li6mt18y.fsf@gnu.org> <83wqq3mcq9.fsf@gnu.org> <87k3m3kor5.fsf@gnu.org> <83ehcalysu.fsf@gnu.org> <87sj0pvl4a.fsf@tines.lan> <837gi1n3v5.fsf@gnu.org> <87k3m1vg8b.fsf@tines.lan> <83txl4lhby.fsf@gnu.org> <838v2fky99.fsf@gnu.org> <83ip1iw2lu.fsf@gnu.org> <877ghu14qg.fsf@gnu.org> <83zjuosq1s.fsf@gnu.org> <87sj0frvv5.fsf@gnu.org> <87hagvcav6.fsf@tines.lan> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Trace: ger.gmane.org 1371670326 32380 80.91.229.3 (19 Jun 2013 19:32:06 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Wed, 19 Jun 2013 19:32:06 +0000 (UTC) Cc: guile-user@gnu.org To: Mark H Weaver Original-X-From: guile-user-bounces+guile-user=m.gmane.org@gnu.org Wed Jun 19 21:32:05 2013 Return-path: Envelope-to: guile-user@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1UpO6u-00081m-E6 for guile-user@m.gmane.org; Wed, 19 Jun 2013 21:32:04 +0200 Original-Received: from localhost ([::1]:45802 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UpO6u-00030f-22 for guile-user@m.gmane.org; Wed, 19 Jun 2013 15:32:04 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:38854) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UpO6j-0002v0-W5 for guile-user@gnu.org; Wed, 19 Jun 2013 15:31:56 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UpO6i-0005OZ-2y for guile-user@gnu.org; Wed, 19 Jun 2013 15:31:53 -0400 Original-Received: from hera.aquilenet.fr ([141.255.128.1]:48311) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UpO6f-0005NN-Ps; Wed, 19 Jun 2013 15:31:50 -0400 Original-Received: from localhost (localhost [127.0.0.1]) by hera.aquilenet.fr (Postfix) with ESMTP id 3CCA4E02; Wed, 19 Jun 2013 21:26:44 +0200 (CEST) Original-Received: from hera.aquilenet.fr ([127.0.0.1]) by localhost (hera.aquilenet.fr [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id ob4uhWu-DY24; Wed, 19 Jun 2013 21:26:44 +0200 (CEST) Original-Received: from pluto (LDijon-156-64-49-137.w217-128.abo.wanadoo.fr [217.128.51.137]) by hera.aquilenet.fr (Postfix) with ESMTPSA id 67000DE2; Wed, 19 Jun 2013 21:26:43 +0200 (CEST) X-URL: http://www.fdn.fr/~lcourtes/ X-Revolutionary-Date: 1 Messidor an 221 de la =?utf-8?Q?R=C3=A9volution?= X-PGP-Key-ID: 0xEA52ECF4 X-PGP-Key: http://www.fdn.fr/~lcourtes/ludovic.asc X-PGP-Fingerprint: 83C4 F8E5 10A3 3B4C 5BEA D15D 77DD 95E2 EA52 ECF4 X-OS: x86_64-unknown-linux-gnu In-Reply-To: <87hagvcav6.fsf@tines.lan> (Mark H. Weaver's message of "Tue, 18 Jun 2013 18:28:13 -0400") User-Agent: Gnus/5.130007 (Ma Gnus v0.7) Emacs/24.3 (gnu/linux) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x [fuzzy] X-Received-From: 141.255.128.1 X-BeenThere: guile-user@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: General Guile related discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guile-user-bounces+guile-user=m.gmane.org@gnu.org Original-Sender: guile-user-bounces+guile-user=m.gmane.org@gnu.org Xref: news.gmane.org gmane.lisp.guile.user:10478 Archived-At: Hi Mark! Mark H Weaver skribis: > ludo@gnu.org (Ludovic Court=C3=A8s) writes: > >> Eli Zaretskii skribis: >> >>> It's due to the CRLF thing. These files are open in the "w" mode, but >>> then read using the "rb" mode. So the CR character is left after the >>> newline is stripped, and botches the comparison. The debug lines you >>> added show this (note the \r at the end): >>> >>> ;;; (line "\xe4\xb8\x80\xe4\xba\x8c\xe4\xb8\x89\r") >>> FAIL: ports.test: file: binary mode ignores port encoding >>>=20=20=20=20=20=20 >>> ;;; (line2 "\xe4\xb8\x80\xe4\xba\x8c\xe4\xb8\x89\r") >>> FAIL: ports.test: file: binary mode ignores file coding declaration >> >> I think this patch solves the problem: >> >> diff --git a/libguile/rdelim.c b/libguile/rdelim.c >> index 9d14967..9f16c69 100644 >> --- a/libguile/rdelim.c >> +++ b/libguile/rdelim.c >> @@ -154,6 +154,7 @@ SCM_DEFINE (scm_read_line, "%read-line", 0, 1, 0, >> { >> case EOF: >> case '\n': >> + case '\r': >> delim =3D buf[index]; >> break; >>=20=20 >> >> Probably the extra case should be #ifdef __MINGW32__, to make sure it >> has no effect on non-Windows users. Thoughts? > > I think this is a bad idea for multiple reasons: Well yes, agreed on all points. I think now we just need to augments ports with CR/LF handling in 2.1. [...] > To my mind, this is a bug in those tests. So how about the following > patch instead? [...] > diff --git a/test-suite/tests/ports.test b/test-suite/tests/ports.test > index 9b1c6c0..758f8f6 100644 > --- a/test-suite/tests/ports.test > +++ b/test-suite/tests/ports.test > @@ -238,7 +238,7 @@ > (pass-if "file: binary mode ignores port encoding" > (with-fluids ((%default-port-encoding "UTF-8")) > (let* ((filename (test-file)) > - (port (open-file filename "w")) > + (port (open-file filename "wb")) > (test-string "=E4=B8=80=E4=BA=8C=E4=B8=89") > (binary-test-string > (apply string > @@ -257,7 +257,7 @@ > (pass-if "file: binary mode ignores file coding declaration" > (with-fluids ((%default-port-encoding "UTF-8")) > (let* ((filename (test-file)) > - (port (open-file filename "w")) > + (port (open-file filename "wb")) > (test-string "=E4=B8=80=E4=BA=8C=E4=B8=89") > (binary-test-string > (apply string Yes, looks good. The tests would actually make more sense if %default-port-encoding was set to something different from UTF-8, because here we can=E2=80=99t tell if it=E2=80=99s ignored. Thanks, Ludo=E2=80=99.