From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: ludo@gnu.org (Ludovic =?UTF-8?Q?Court=C3=A8s?=) Newsgroups: gmane.lisp.guile.bugs Subject: bug#30066: 'get-bytevector-some' returns only 1 byte from unbuffered ports Date: Sat, 13 Jan 2018 21:53:34 +0100 Message-ID: <87zi5hmqep.fsf@gnu.org> References: <87zi5lrc3x.fsf@gnu.org> <87tvvtr9ge.fsf@gnu.org> <87fu7dptdn.fsf@igalia.com> <87o9m08nx2.fsf@gnu.org> <87fu7cf9wk.fsf@netris.org> <87po6gnm6y.fsf@gnu.org> <87a7xkxdph.fsf@netris.org> <87373bpi20.fsf@igalia.com> <87o9lzs7rn.fsf@gnu.org> <87mv1jnz7n.fsf@igalia.com> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Trace: blaine.gmane.org 1515876741 30140 195.159.176.226 (13 Jan 2018 20:52:21 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Sat, 13 Jan 2018 20:52:21 +0000 (UTC) User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.3 (gnu/linux) Cc: 30066@debbugs.gnu.org To: Andy Wingo Original-X-From: bug-guile-bounces+guile-bugs=m.gmane.org@gnu.org Sat Jan 13 21:52:16 2018 Return-path: Envelope-to: guile-bugs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1eaSme-00072C-RU for guile-bugs@m.gmane.org; Sat, 13 Jan 2018 21:52:09 +0100 Original-Received: from localhost ([::1]:36492 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eaSoe-0003Aa-KF for guile-bugs@m.gmane.org; Sat, 13 Jan 2018 15:54:12 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:57546) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eaSoY-0003AG-NT for bug-guile@gnu.org; Sat, 13 Jan 2018 15:54:08 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eaSoU-0003Si-G1 for bug-guile@gnu.org; Sat, 13 Jan 2018 15:54:06 -0500 Original-Received: from debbugs.gnu.org ([208.118.235.43]:47267) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1eaSoU-0003SA-BW for bug-guile@gnu.org; Sat, 13 Jan 2018 15:54:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1eaSoT-0007Fs-Td for bug-guile@gnu.org; Sat, 13 Jan 2018 15:54:01 -0500 X-Loop: help-debbugs@gnu.org Resent-From: ludo@gnu.org (Ludovic =?UTF-8?Q?Court=C3=A8s?=) Original-Sender: "Debbugs-submit" Resent-CC: bug-guile@gnu.org Resent-Date: Sat, 13 Jan 2018 20:54:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 30066 X-GNU-PR-Package: guile X-GNU-PR-Keywords: Original-Received: via spool by 30066-submit@debbugs.gnu.org id=B30066.151587682327863 (code B ref 30066); Sat, 13 Jan 2018 20:54:01 +0000 Original-Received: (at 30066) by debbugs.gnu.org; 13 Jan 2018 20:53:43 +0000 Original-Received: from localhost ([127.0.0.1]:55164 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1eaSo9-0007FJ-FV for submit@debbugs.gnu.org; Sat, 13 Jan 2018 15:53:43 -0500 Original-Received: from hera.aquilenet.fr ([185.233.100.1]:52428) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1eaSo7-0007FB-2c for 30066@debbugs.gnu.org; Sat, 13 Jan 2018 15:53:40 -0500 Original-Received: from localhost (localhost [127.0.0.1]) by hera.aquilenet.fr (Postfix) with ESMTP id E9EB910A6A; Sat, 13 Jan 2018 21:53:36 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at aquilenet.fr 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 u3Lj3GCz0_DO; Sat, 13 Jan 2018 21:53:36 +0100 (CET) Original-Received: from ribbon (unknown [IPv6:2a01:e0a:1d:7270:af76:b9b:ca24:c465]) by hera.aquilenet.fr (Postfix) with ESMTPSA id B06CD10845; Sat, 13 Jan 2018 21:53:35 +0100 (CET) X-URL: http://www.fdn.fr/~lcourtes/ X-Revolutionary-Date: 24 =?UTF-8?Q?Niv=C3=B4se?= an 226 de la =?UTF-8?Q?R=C3=A9volution?= X-PGP-Key-ID: 0x090B11993D9AEBB5 X-PGP-Key: http://www.fdn.fr/~lcourtes/ludovic.asc X-PGP-Fingerprint: 3CE4 6455 8A84 FDC6 9DB4 0CFB 090B 1199 3D9A EBB5 X-OS: x86_64-pc-linux-gnu In-Reply-To: <87mv1jnz7n.fsf@igalia.com> (Andy Wingo's message of "Fri, 12 Jan 2018 11:33:32 +0100") X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 208.118.235.43 X-BeenThere: bug-guile@gnu.org List-Id: "Bug reports for GUILE, GNU's Ubiquitous Extension Language" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-guile-bounces+guile-bugs=m.gmane.org@gnu.org Original-Sender: "bug-guile" Xref: news.gmane.org gmane.lisp.guile.bugs:8966 Archived-At: Hey, Andy Wingo skribis: > On Fri 12 Jan 2018 11:15, ludo@gnu.org (Ludovic Court=C3=A8s) writes: > >> Andy Wingo skribis: >> >>> On Thu 11 Jan 2018 22:55, Mark H Weaver writes: >> >> [...] >> >>>>>> Out of curiosity, is there a reason why you're using an unbuffered p= ort >>>>>> in your use case? >>>>> >>>>> It=E2=80=99s to implement redirect =C3=A0 la socat: >>>>> >>>>> https://git.savannah.gnu.org/cgit/guix.git/commit/?id=3D17af5d51de7= c40756a4a39d336f81681de2ba447 >>>> >>>> Why is an unbuffered port being used here? Can we change it to a >>>> buffered port? >>> >>> This was also a question I had! If you make it a buffered port at 4096 >>> bytes (for example), then get-bytevector-some works exactly like you >>> want it to, no? >> >> It might work, but that=E2=80=99s more by chance no? > > No, it is reliable. get-bytevector-some on a buffered port must either > return all the buffered bytes or perform exactly one read (up to the > buffer size) and either return those bytes or EOF. As far as I > understand, that is exactly what you want. Indeed, that works well, thanks! So, after all, problem solved? I think the confusion for me comes from the fact that we don=E2=80=99t have= a FILE*/fd distinction like in C. It=E2=80=99s as if we were always using FI= LE* in the sense that I=E2=80=99m never sure what=E2=80=99s going to happen or = whether a particular behavior can be relied on. Thank you, Ludo=E2=80=99.