GNU bug report logs - #22901
drain-input doesn't decode

Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.

Package: guile; Reported by: Zefram <zefram@HIDDEN>; dated Fri, 4 Mar 2016 03:11:01 UTC; Maintainer for guile is bug-guile@HIDDEN.

Message received at 22901 <at> debbugs.gnu.org:


Received: (at 22901) by debbugs.gnu.org; 26 Feb 2017 17:58:52 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sun Feb 26 12:58:52 2017
Received: from localhost ([127.0.0.1]:57009 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1ci35w-0001CR-5w
	for submit <at> debbugs.gnu.org; Sun, 26 Feb 2017 12:58:52 -0500
Received: from mail-pg0-f43.google.com ([74.125.83.43]:33455)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <matt.wette@HIDDEN>) id 1ci35v-0001CG-Hb
 for 22901 <at> debbugs.gnu.org; Sun, 26 Feb 2017 12:58:51 -0500
Received: by mail-pg0-f43.google.com with SMTP id 25so3977041pgy.0
 for <22901 <at> debbugs.gnu.org>; Sun, 26 Feb 2017 09:58:51 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025;
 h=from:mime-version:subject:date:references:to:in-reply-to:message-id;
 bh=ghCk00pcAedZhHRh+u+bpHN7LfGBV9hLp1pgj/hn8cs=;
 b=lXTEq6+BvDaXTbHvNWSKx6DMbY+SXpeE3Zfl+NhImEzy7bIxmnRxN6q4TbP/bVN5bM
 Cch/VCbatjnLzKKB7fMZAsExtgVlJjR6uRQJYts+gEbIuyATxf372a0wdkczb366W57f
 vMNvpSyyGJbBl42F0aYtmbwpaAA4A+n1P5PbVYXOEcSZI7Y0JnIgHScBGwKTMh+NXByA
 vwDLvCje3EceQT/Uo+rLaUuqtBI0QFutolX7DklQYdYp/L0G+wJcRLQZ6jypr3uuLjVb
 nUOAszlkEzN6iVIy7wK4/rQhqg0kfro75+bIWegr0yKq5NMssFTRHG19cHRxD701Ffh0
 CTZg==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20161025;
 h=x-gm-message-state:from:mime-version:subject:date:references:to
 :in-reply-to:message-id;
 bh=ghCk00pcAedZhHRh+u+bpHN7LfGBV9hLp1pgj/hn8cs=;
 b=sDQ0tzeS3gFKUNO9awEQtW9OdAz5KTeEPD+yOYeUJm+ze6U9gP3jFcur/UIK1lvknJ
 gZCcNhyMOJY+wFYegd07q7DRL5PuCUTKdCzwpCDU+e7dSCWRne9wv3MUHt2xr7SiY/5R
 MP0kHj93axKjYDZmB18W1XEatVRimf2cyJc4Z+TD3TH1Wf+7z/WrHnZENFFjelIgWRnD
 4qgvjgBODP0RLyvFGzqanxiwiCdc10aPS0B2gAAzt8CIb25lWJvZsmzJ2IOARMY0927e
 IfaEOojBqO0TXB8u4KrVPb/QqskFaovQZFVdufs8970a7JU/pOJ0uYrScerQbqZzfnYN
 rjLA==
X-Gm-Message-State: AMke39nM33VAAVs5jFBjf09tQjlM40W1TKM1Gma3CoR58lPiafSGoeT7Rx+kkA+sM5iWwg==
X-Received: by 10.84.128.8 with SMTP id 8mr19067534pla.24.1488131925170;
 Sun, 26 Feb 2017 09:58:45 -0800 (PST)
Received: from nautilus.championbroadband.com
 (216-165-246-244.championbroadband.com. [216.165.246.244])
 by smtp.gmail.com with ESMTPSA id s20sm25813476pfg.11.2017.02.26.09.58.43
 for <22901 <at> debbugs.gnu.org>
 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128);
 Sun, 26 Feb 2017 09:58:43 -0800 (PST)
From: Matt Wette <matt.wette@HIDDEN>
Content-Type: multipart/alternative;
 boundary="Apple-Mail=_5BEEB7CA-2CE6-44FE-A41B-94FCE628AC2B"
Mime-Version: 1.0 (Mac OS X Mail 10.2 \(3259\))
Subject: Re: drain-input doesn't decode
Date: Sun, 26 Feb 2017 09:58:42 -0800
References: <B5C0BF5C-7316-44AA-A89C-FF3CDE0E804C@HIDDEN>
To: 22901 <at> debbugs.gnu.org
In-Reply-To: <B5C0BF5C-7316-44AA-A89C-FF3CDE0E804C@HIDDEN>
Message-Id: <4496E82C-4E88-4CDE-B73E-655CC3179E25@HIDDEN>
X-Mailer: Apple Mail (2.3259)
X-Spam-Score: -0.1 (/)
X-Debbugs-Envelope-To: 22901
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -0.1 (/)


--Apple-Mail=_5BEEB7CA-2CE6-44FE-A41B-94FCE628AC2B
Content-Transfer-Encoding: quoted-printable
Content-Type: text/plain;
	charset=utf-8


> On Feb 26, 2017, at 9:46 AM, Matt Wette <matt.wette@HIDDEN> wrote:
>=20
> I put together a test and tried on 2.1.7 - my test fails.  See =
attached.
>=20
>  (pass-if "encoded input"
>    (let ((fn (test-file))
> 	  (nc "utf-8")
> 	  (st "\u03b2\u03b1\u03b4 \u03b1\u03c3\u03c3 am I.")
> 	  ;;(st "hello, world\n")
> 	  )
>      (let ((p1 (open-output-file fn #:encoding nc)))
> 	;;(display st p1)
> 	(string-for-each (lambda (ch) (write-char ch p1)) st)
> 	(close p1))
>      (let* ((p0 (open-input-file fn #:encoding nc))
> 	     (s0 (begin (unread-char (read-char p0) p0) (drain-input =
p0))))
> 	(simple-format #t "~S\n" s0)
> 	(equal? s0 st))))
>=20

My bad.  The failure was on guile-2.0.13.  It seems to work on =
guile-2.1.7:

mwette$ guile-2.1.7-dev3/meta/guile port-di.test
"=CE=B2=CE=B1=CE=B4 =CE=B1=CF=83=CF=83 am I."
PASS: drain-input: encoded input


--Apple-Mail=_5BEEB7CA-2CE6-44FE-A41B-94FCE628AC2B
Content-Transfer-Encoding: quoted-printable
Content-Type: text/html;
	charset=utf-8

<html><head><meta http-equiv=3D"Content-Type" content=3D"text/html =
charset=3Dutf-8"></head><body style=3D"word-wrap: break-word; =
-webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" =
class=3D""><br class=3D""><div><blockquote type=3D"cite" class=3D""><div =
class=3D"">On Feb 26, 2017, at 9:46 AM, Matt Wette &lt;<a =
href=3D"mailto:matt.wette@HIDDEN" =
class=3D"">matt.wette@HIDDEN</a>&gt; wrote:</div><br =
class=3D"Apple-interchange-newline"><div class=3D"">I put together a =
test and tried on 2.1.7 - my test fails. &nbsp;See attached.<br =
class=3D""><br class=3D""> &nbsp;(pass-if "encoded input"<br class=3D""> =
&nbsp;&nbsp;&nbsp;(let ((fn (test-file))<br class=3D""><span =
class=3D"Apple-tab-span" style=3D"white-space:pre">	</span> =
&nbsp;(nc "utf-8")<br class=3D""><span class=3D"Apple-tab-span" =
style=3D"white-space:pre">	</span> &nbsp;(st "\u03b2\u03b1\u03b4 =
\u03b1\u03c3\u03c3 am I.")<br class=3D""><span class=3D"Apple-tab-span" =
style=3D"white-space:pre">	</span> &nbsp;;;(st "hello, world\n")<br =
class=3D""><span class=3D"Apple-tab-span" style=3D"white-space:pre">	=
</span> &nbsp;)<br class=3D""> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;(let ((p1 =
(open-output-file fn #:encoding nc)))<br class=3D""><span =
class=3D"Apple-tab-span" style=3D"white-space:pre">	=
</span>;;(display st p1)<br class=3D""><span class=3D"Apple-tab-span" =
style=3D"white-space:pre">	</span>(string-for-each (lambda (ch) =
(write-char ch p1)) st)<br class=3D""><span class=3D"Apple-tab-span" =
style=3D"white-space:pre">	</span>(close p1))<br class=3D""> =
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;(let* ((p0 (open-input-file fn #:encoding =
nc))<br class=3D""><span class=3D"Apple-tab-span" =
style=3D"white-space:pre">	</span> &nbsp;&nbsp;&nbsp;&nbsp;(s0 =
(begin (unread-char (read-char p0) p0) (drain-input p0))))<br =
class=3D""><span class=3D"Apple-tab-span" style=3D"white-space:pre">	=
</span>(simple-format #t "~S\n" s0)<br class=3D""><span =
class=3D"Apple-tab-span" style=3D"white-space:pre">	</span>(equal? =
s0 st))))<br class=3D""><br class=3D""></div></blockquote><br =
class=3D""></div><div>My bad. &nbsp;The failure was on guile-2.0.13. =
&nbsp;It seems to work on guile-2.1.7:</div><div><br =
class=3D""></div><div><div style=3D"margin: 0px; font-size: 13px; =
line-height: normal; font-family: Menlo; background-color: rgb(255, 255, =
255);" class=3D""><span style=3D"font-variant-ligatures: =
no-common-ligatures" class=3D"">mwette$ guile-2.1.7-dev3/meta/guile =
port-di.test</span></div><div style=3D"margin: 0px; font-size: 13px; =
line-height: normal; font-family: Menlo; background-color: rgb(255, 255, =
255);" class=3D""><span style=3D"font-variant-ligatures: =
no-common-ligatures" class=3D"">"=CE=B2=CE=B1=CE=B4 =CE=B1=CF=83=CF=83 =
am I."</span></div><div style=3D"margin: 0px; font-size: 13px; =
line-height: normal; font-family: Menlo; background-color: rgb(255, 255, =
255);" class=3D""><span style=3D"font-variant-ligatures: =
no-common-ligatures" class=3D"">PASS: drain-input: encoded =
input</span></div><div class=3D""><span style=3D"font-variant-ligatures: =
no-common-ligatures" class=3D""><br =
class=3D""></span></div></div></body></html>=

--Apple-Mail=_5BEEB7CA-2CE6-44FE-A41B-94FCE628AC2B--




Information forwarded to bug-guile@HIDDEN:
bug#22901; Package guile. Full text available.

Message received at 22901 <at> debbugs.gnu.org:


Received: (at 22901) by debbugs.gnu.org; 26 Feb 2017 17:46:27 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sun Feb 26 12:46:27 2017
Received: from localhost ([127.0.0.1]:57005 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1ci2tv-0000wS-1E
	for submit <at> debbugs.gnu.org; Sun, 26 Feb 2017 12:46:27 -0500
Received: from mail-pg0-f54.google.com ([74.125.83.54]:35330)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <matt.wette@HIDDEN>) id 1ci2ts-0000wE-Iy
 for 22901 <at> debbugs.gnu.org; Sun, 26 Feb 2017 12:46:24 -0500
Received: by mail-pg0-f54.google.com with SMTP id b129so33435450pgc.2
 for <22901 <at> debbugs.gnu.org>; Sun, 26 Feb 2017 09:46:24 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025;
 h=from:mime-version:subject:message-id:date:to;
 bh=C81sAg3zpi+JH+Uwlc2+injY0mHZVCy68rdPtnUDiZE=;
 b=t3H/dqDtTPXURflHv3JFd/MWIAsYB1urVUEA1iBjKRSj6bimq+0ETfh6Y3V+AKxsqu
 2/J7YqBeexWRPqByrRmHL0LrNEJemq1xaFqIe7gTa5SJiMUGfrCXaLwSvYeHspPUJiZi
 yrb/fsY5Bawg8Y62Mt4ZJxJ8rHXl8t6e+lJht25cHX0qLU8oJEv65KmdlONXzE8j1EFl
 AQvcYWptrUYwNTb5JDrHWrD02JT8FvG8UFy7Aa7VwDuhh2w2Z5syjRUdWAa7YeEsS0Wx
 71PGY7JohsyCHy/P1UcDehjsS4KYCokY3b6AKVAOoqupPPr+Dpq/0DbaAgVAkWzCyRpo
 zh5Q==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20161025;
 h=x-gm-message-state:from:mime-version:subject:message-id:date:to;
 bh=C81sAg3zpi+JH+Uwlc2+injY0mHZVCy68rdPtnUDiZE=;
 b=WEW2qRMHWEkLrE/CdW7a1vLr40JuNDYCDiBcXC3Rqvqh0IDjp5X3pmFnYYiEwLowOy
 rtL7lRJrgDBCq8uDy3Crj3vScEJ0NGrwgqLgoYWKm/6ANQ6w2UzedTl+xh7q3Ak0QzoH
 gSgxge0oxxVhorTBckoMV0B/a2iD9nNLMd6KmiHgPEBFKhZzuBk0WCufbIpL79DOperm
 VmPRC8nQ2ynkdTQ4HFfVTbnmqFFox5pEovyb2f0c98NIpfXPeFJtgrOfNERZuNmBcY0Z
 MrxxdAvPMZQU1BQMPPpXkL7jZO5tSyyr+ZJfG+6V5kOP1wz0EHK0TXrikLeF3vQ7z0kA
 hVpw==
X-Gm-Message-State: AMke39nKErSG7LZiWprtepC0/lE3CLlUG3YoyUVEdj5eNOjNgaJ+QAJcLgNbUbfgCu6SPQ==
X-Received: by 10.84.224.65 with SMTP id a1mr18913419plt.28.1488131178097;
 Sun, 26 Feb 2017 09:46:18 -0800 (PST)
Received: from nautilus.championbroadband.com
 (216-165-246-244.championbroadband.com. [216.165.246.244])
 by smtp.gmail.com with ESMTPSA id 80sm4513996pgd.39.2017.02.26.09.46.15
 for <22901 <at> debbugs.gnu.org>
 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128);
 Sun, 26 Feb 2017 09:46:16 -0800 (PST)
From: Matt Wette <matt.wette@HIDDEN>
Content-Type: multipart/mixed;
 boundary="Apple-Mail=_19CBBA5B-69D5-4EA2-BA05-F73A8BAABA16"
Mime-Version: 1.0 (Mac OS X Mail 10.2 \(3259\))
Subject: drain-input doesn't decode
Message-Id: <B5C0BF5C-7316-44AA-A89C-FF3CDE0E804C@HIDDEN>
Date: Sun, 26 Feb 2017 09:46:14 -0800
To: 22901 <at> debbugs.gnu.org
X-Mailer: Apple Mail (2.3259)
X-Spam-Score: -0.0 (/)
X-Debbugs-Envelope-To: 22901
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -0.0 (/)


--Apple-Mail=_19CBBA5B-69D5-4EA2-BA05-F73A8BAABA16
Content-Transfer-Encoding: 7bit
Content-Type: text/plain;
	charset=us-ascii

I put together a test and tried on 2.1.7 - my test fails.  See attached.

  (pass-if "encoded input"
    (let ((fn (test-file))
	  (nc "utf-8")
	  (st "\u03b2\u03b1\u03b4 \u03b1\u03c3\u03c3 am I.")
	  ;;(st "hello, world\n")
	  )
      (let ((p1 (open-output-file fn #:encoding nc)))
	;;(display st p1)
	(string-for-each (lambda (ch) (write-char ch p1)) st)
	(close p1))
      (let* ((p0 (open-input-file fn #:encoding nc))
	     (s0 (begin (unread-char (read-char p0) p0) (drain-input p0))))
	(simple-format #t "~S\n" s0)
	(equal? s0 st))))


--Apple-Mail=_19CBBA5B-69D5-4EA2-BA05-F73A8BAABA16
Content-Disposition: attachment;
	filename=port-di.test
Content-Type: application/octet-stream;
	x-unix-mode=0644;
	name="port-di.test"
Content-Transfer-Encoding: 7bit

;; port-di.text  -*- scheme -*-

(add-to-load-path "guile-2.1.7-dev3/test-suite")

(use-modules (test-suite lib))

(define (test-file)
  (string-append (getcwd) "/ports-test.tmp"))

(with-test-prefix "drain-input"
  
  (pass-if "encoded input"
    (let ((fn (test-file))
	  (nc "utf-8")
	  (st "\u03b2\u03b1\u03b4 \u03b1\u03c3\u03c3 am I.")
	  ;;(st "hello, world\n")
	  )
      (let ((p1 (open-output-file fn #:encoding nc)))
	;;(display st p1)
	(string-for-each (lambda (ch) (write-char ch p1)) st)
	(close p1))
      (let* ((p0 (open-input-file fn #:encoding nc))
	     (s0 (begin (unread-char (read-char p0) p0) (drain-input p0))))
	(simple-format #t "~S\n" s0)
	(equal? s0 st))))

  )

;; --- last line ---

--Apple-Mail=_19CBBA5B-69D5-4EA2-BA05-F73A8BAABA16--




Information forwarded to bug-guile@HIDDEN:
bug#22901; Package guile. Full text available.

Message received at 22901 <at> debbugs.gnu.org:


Received: (at 22901) by debbugs.gnu.org; 20 Jun 2016 16:13:02 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Mon Jun 20 12:13:01 2016
Received: from localhost ([127.0.0.1]:47930 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1bF1or-0003L0-JM
	for submit <at> debbugs.gnu.org; Mon, 20 Jun 2016 12:13:01 -0400
Received: from pb-sasl1.pobox.com ([64.147.108.66]:62952
 helo=sasl.smtp.pobox.com) by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <wingo@HIDDEN>) id 1bF1op-0003Kj-UT
 for 22901 <at> debbugs.gnu.org; Mon, 20 Jun 2016 12:13:00 -0400
Received: from sasl.smtp.pobox.com (unknown [127.0.0.1])
 by pb-sasl1.pobox.com (Postfix) with ESMTP id B6871234B8;
 Mon, 20 Jun 2016 12:12:59 -0400 (EDT)
DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=pobox.com; h=from:to:cc
 :subject:references:date:in-reply-to:message-id:mime-version
 :content-type; s=sasl; bh=y4R4cYS9EkYmfXQv09LXm8Itk7w=; b=ERnacB
 mLvkD4zAv3Pl7n95yTv27yNPKPnb8gbURxkX3wiqkX8TI2K3A/bcz3h5IJIR77y6
 6V9eRqIUXYflsePzJRfvLhkhqlVRDQKawJW1WEgZajbyaxguwkiwkoFOB0U3oTDj
 G0y8EksJ0VValrx9UjRVQ8xcKNdW+Xw9Tgj28=
DomainKey-Signature: a=rsa-sha1; c=nofws; d=pobox.com; h=from:to:cc
 :subject:references:date:in-reply-to:message-id:mime-version
 :content-type; q=dns; s=sasl; b=IsjO+jwE6DP1FymnJbvgWW7fqMqXQHKX
 0shWKnjA5RUrZUXhyMJSmGIkavh5Bo98JZAVoNuzKNOSXfsf18S7nvhSkBACeJ48
 GTd+nr7/sB6fPN6AkqB5OcGIGglXoVCTMMhLzmAzyoZxdbxmcONJa6e5SsuRxvFp
 478xAdOan+0=
Received: from pb-sasl1.nyi.icgroup.com (unknown [127.0.0.1])
 by pb-sasl1.pobox.com (Postfix) with ESMTP id AFC49234B7;
 Mon, 20 Jun 2016 12:12:59 -0400 (EDT)
Received: from clucks (unknown [88.160.190.192])
 (using TLSv1 with cipher ECDHE-RSA-AES256-SHA (256/256 bits))
 (No client certificate requested)
 by pb-sasl1.pobox.com (Postfix) with ESMTPSA id BCEFB234B1;
 Mon, 20 Jun 2016 12:12:58 -0400 (EDT)
From: Andy Wingo <wingo@HIDDEN>
To: Zefram <zefram@HIDDEN>
Subject: Re: bug#22901: drain-input doesn't decode
References: <20160304030944.GA1318@HIDDEN>
Date: Mon, 20 Jun 2016 18:12:50 +0200
In-Reply-To: <20160304030944.GA1318@HIDDEN> (zefram@HIDDEN's message of
 "Fri, 4 Mar 2016 03:09:44 +0000")
Message-ID: <87d1nbg7p9.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.5 (gnu/linux)
MIME-Version: 1.0
Content-Type: text/plain
X-Pobox-Relay-ID: DB0ED0CA-3701-11E6-A060-C1836462E9F6-02397024!pb-sasl1.pobox.com
X-Spam-Score: -1.4 (-)
X-Debbugs-Envelope-To: 22901
Cc: 22901 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.4 (-)

On Fri 04 Mar 2016 04:09, Zefram <zefram@HIDDEN> writes:

> The documentation for drain-input says that it returns a string of
> characters, implying that the result is equivalent to what you'd get
> from calling read-char some number of times.  In fact it differs in a
> significant respect: whereas read-char decodes input octets according to
> the port's selected encoding, drain-input ignores the selected encoding
> and always decodes according to ISO-8859-1 (thus preserving the octet
> values in character form).
>
> $ echo -n $'\1a\2b\3c' | guile-2.0 -c '(set-port-encoding!
> (current-input-port) "UCS-2BE") (write (port-encoding
> (current-input-port))) (newline) (write (map char->integer (let r ((l
> '\''())) (let ((c (read-char (current-input-port)))) (if (eof-object?
> c) (reverse l) (r (cons c l))))))) (newline)'
> "UCS-2BE"
> (353 610 867)
> $ echo -n $'\1a\2b\3c' | guile-2.0 -c '(set-port-encoding!
> (current-input-port) "UCS-2BE") (write (port-encoding
> (current-input-port))) (newline) (peek-char (current-input-port))
> (write (map char->integer (string->list (drain-input
> (current-input-port))))) (newline)'
> "UCS-2BE"
> (1 97 2 98 3 99)

Thanks for the test case!  FWIW, this is fixed in Guile 2.1.3.  I am not
sure what we should do about Guile 2.0.  I guess we should make it do
the documented thing though!

Andy




Information forwarded to bug-guile@HIDDEN:
bug#22901; Package guile. Full text available.

Message received at submit <at> debbugs.gnu.org:


Received: (at submit) by debbugs.gnu.org; 4 Mar 2016 03:10:05 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Thu Mar 03 22:10:05 2016
Received: from localhost ([127.0.0.1]:60716 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1abg7x-0004UD-7B
	for submit <at> debbugs.gnu.org; Thu, 03 Mar 2016 22:10:05 -0500
Received: from eggs.gnu.org ([208.118.235.92]:37103)
 by debbugs.gnu.org with esmtp (Exim 4.84)
 (envelope-from <zefram@HIDDEN>) id 1abg7v-0004Tg-TA
 for submit <at> debbugs.gnu.org; Thu, 03 Mar 2016 22:10:04 -0500
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
 (envelope-from <zefram@HIDDEN>) id 1abg7p-0000bM-OJ
 for submit <at> debbugs.gnu.org; Thu, 03 Mar 2016 22:09:58 -0500
X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org
X-Spam-Level: 
X-Spam-Status: No, score=0.8 required=5.0 tests=BAYES_50 autolearn=disabled
 version=3.3.2
Received: from lists.gnu.org ([2001:4830:134:3::11]:54346)
 by eggs.gnu.org with esmtp (Exim 4.71)
 (envelope-from <zefram@HIDDEN>) id 1abg7p-0000bI-LC
 for submit <at> debbugs.gnu.org; Thu, 03 Mar 2016 22:09:57 -0500
Received: from eggs.gnu.org ([2001:4830:134:3::10]:56307)
 by lists.gnu.org with esmtp (Exim 4.71)
 (envelope-from <zefram@HIDDEN>) id 1abg7o-0006Xa-Hk
 for bug-guile@HIDDEN; Thu, 03 Mar 2016 22:09:57 -0500
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
 (envelope-from <zefram@HIDDEN>) id 1abg7l-0000b1-92
 for bug-guile@HIDDEN; Thu, 03 Mar 2016 22:09:56 -0500
Received: from river.fysh.org ([87.98.248.19]:55145)
 by eggs.gnu.org with esmtp (Exim 4.71)
 (envelope-from <zefram@HIDDEN>) id 1abg7l-0000ao-2X
 for bug-guile@HIDDEN; Thu, 03 Mar 2016 22:09:53 -0500
Received: from zefram by river.fysh.org with local (Exim 4.80 #2 (Debian))
 id 1abg7c-0001TA-SN; Fri, 04 Mar 2016 03:09:44 +0000
Date: Fri, 4 Mar 2016 03:09:44 +0000
From: Zefram <zefram@HIDDEN>
To: bug-guile@HIDDEN
Subject: drain-input doesn't decode
Message-ID: <20160304030944.GA1318@HIDDEN>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic]
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x
X-Received-From: 2001:4830:134:3::11
X-Spam-Score: -5.0 (-----)
X-Debbugs-Envelope-To: submit
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -5.0 (-----)

The documentation for drain-input says that it returns a string of
characters, implying that the result is equivalent to what you'd get
from calling read-char some number of times.  In fact it differs in a
significant respect: whereas read-char decodes input octets according to
the port's selected encoding, drain-input ignores the selected encoding
and always decodes according to ISO-8859-1 (thus preserving the octet
values in character form).

$ echo -n $'\1a\2b\3c' | guile-2.0 -c '(set-port-encoding! (current-input-port) "UCS-2BE") (write (port-encoding (current-input-port))) (newline) (write (map char->integer (let r ((l '\''())) (let ((c (read-char (current-input-port)))) (if (eof-object? c) (reverse l) (r (cons c l))))))) (newline)'
"UCS-2BE"
(353 610 867)
$ echo -n $'\1a\2b\3c' | guile-2.0 -c '(set-port-encoding! (current-input-port) "UCS-2BE") (write (port-encoding (current-input-port))) (newline) (peek-char (current-input-port)) (write (map char->integer (string->list (drain-input (current-input-port))))) (newline)'
"UCS-2BE"
(1 97 2 98 3 99)

The practical upshot is that the input returned by drain-input can't
be used in the same way as regular input from read-char.  It can still
be used if the code doing the reading is totally aware of the encoding,
so that it can perform the decoding manually, but this seems a failure
of abstraction.  The value returned by drain-input ought to be coherent
with the abstraction level at which it is specified.

I can see that there is a reason for drain-input to avoid performing
decoding: the problem that occurs if the buffer ends in the middle
of a character.  If drain-input is to return decoded characters then
presumably in this case it would have to read further octets beyond the
buffer contents, in an unbuffered manner, until it reaches a character
boundary.  If this is too unpalatable, perhaps drain-input should be
permitted only on ports configured for single-octet character encodings.

If, on the other hand, it is decided to endorse the current non-decoding
behaviour, then the break of abstraction needs to be documented.

-zefram




Acknowledgement sent to Zefram <zefram@HIDDEN>:
New bug report received and forwarded. Copy sent to bug-guile@HIDDEN. Full text available.
Report forwarded to bug-guile@HIDDEN:
bug#22901; Package guile. Full text available.
Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.
Last modified: Mon, 25 Nov 2019 12:00:02 UTC

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