bug-guix
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#21829: guix import hackage failures


From: Federico Beffa
Subject: bug#21829: guix import hackage failures
Date: Wed, 11 Nov 2015 22:29:20 +0100

On Wed, Nov 11, 2015 at 12:18 PM, Ludovic Courtès <address@hidden> wrote:
> Federico Beffa <address@hidden> skribis:
>
>> * I do not get backtraces, but the following error:
>
> The backtrace thing was fixed in 5453de3d.
>
>> * The following packages fail because the file has DOS line endings:
>>
>>   happy, base-compat, base-orphans, fast-logger, generic-deriving, 
>> ObjectName,
>>   SDL, setenv, split, StateVar, syb, transformers-base, wai, xmonad (+ 1 more
>>   problem), zlib (+ 1 more problem).
>>
>>  Changing the encoding to UNIX line endings fixes the problem. This is
>> the number 1 problem. Is there a Guile way to easily fix this?
>
> Could you explain how if fails exactly?

The extra character '\r' screws up the parsing because it was not
accounted for in the logic to recognize multi-line values and
indentation based block separation.

What do you think of a kind of piped filter as follows:

(define (call-with-input-file-eol-crlf->lf proc port)
  (let* ((port-pair (pipe))
         (input-port (match port-pair ((in . out) in)))
         (output-port (match port-pair ((in . out) out))))
    (letpar ((transcoder
              (let loop ((line (get-line port)))
                (unless (eof-object? line)
                  (write-line (string-trim-right line #\return) output-port)
                  (loop (get-line port)))
                (flush-output-port output-port)))
             (result (proc input-port)))
            (close-output-port output-port)
            (close-input-port input-port)
            result)))

Then instead of calling (read-cabal port) I would call
(call-with-input-file-eol-crlf->lf read-cabal port).

Regards,
Fede





reply via email to

[Prev in Thread] Current Thread [Next in Thread]