From mboxrd@z Thu Jan 1 00:00:00 1970 From: Federico Beffa Subject: bug#21829: guix import hackage failures Date: Fri, 13 Nov 2015 18:08:33 +0100 Message-ID: References: <87d1vghjhk.fsf@gnu.org> <87vb971t74.fsf@gnu.org> <87lha3ufxv.fsf@gnu.org> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:55789) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZxHqV-0006bD-Bd for bug-guix@gnu.org; Fri, 13 Nov 2015 12:09:08 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZxHqR-0005BC-12 for bug-guix@gnu.org; Fri, 13 Nov 2015 12:09:07 -0500 Received: from debbugs.gnu.org ([208.118.235.43]:47679) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZxHqQ-0005B6-TV for bug-guix@gnu.org; Fri, 13 Nov 2015 12:09:02 -0500 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.80) (envelope-from ) id 1ZxHqQ-0001DH-4h for bug-guix@gnu.org; Fri, 13 Nov 2015 12:09:02 -0500 Sender: "Debbugs-submit" Resent-Message-ID: In-Reply-To: <87lha3ufxv.fsf@gnu.org> List-Id: Bug reports for GNU Guix List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-guix-bounces+gcggb-bug-guix=m.gmane.org@gnu.org Sender: bug-guix-bounces+gcggb-bug-guix=m.gmane.org@gnu.org To: Ludovic =?UTF-8?Q?Court=C3=A8s?= Cc: 21829@debbugs.gnu.org On Thu, Nov 12, 2015 at 9:21 PM, Ludovic Court=C3=A8s wrote: > If we go for the CRLF conversion port, we should avoid the pipe and > extra thread. Instead, I would suggest something like: > > (define (canonical-newline-port port) > "Return an input port that wraps PORT such that all newlines consist > of a single carriage return." > (make-custom-binary-input-port =E2=80=A6)) I like this suggestion :-) I never used custom ports. Is something like this OK? (Seems to work in the REPL.) --------------------------------------------------------------- (define (canonical-newline-port port) "Return an input port that wraps PORT such that all newlines consist of a single carriage return." (define (get-position) (if (port-has-port-position? port) (port-position port) #f)) (define (set-position! position) (if (port-has-set-port-position!? port) (set-port-position! position port) #f)) (define (close) (close-port port)) (define (read! bv start n) (let loop ((count 0) (byte (get-u8 port))) (cond ((or (eof-object? byte) (=3D count n)) count) ((eqv? byte (char->integer #\return)) (loop count (get-u8 port)= )) (else (bytevector-u8-set! bv (+ start count) byte) (loop (+ count 1) (get-u8 port)))))) (make-custom-binary-input-port "canonical-newline-port" read! get-position set-position! close)) --------------------------------------------------------------- IMO this is general enough that it could go into "guix/utils.scm". Are you OK with this? Regards, Fede