Subject: Re: guix import hackage failures

From: [email-masked] (Ludovic Courtès)
Date: Wed, 11 Nov 2015 12:18:47 +0100

Federico Beffa <[email-masked]> 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?

Not really “easily” unfortunately.  It depends on the APIs you use.

There’s the R6RS API from (rnrs io ports), which is supposed to
magically do line ending conversion but doesn’t seem to work:

--8<---------------cut here---------------start------------->8---
scheme@(guile-user)> (make-transcoder (utf-8-codec) (eol-style crlf))
$13 = #<r6rs:record:transcoder>
scheme@(guile-user)> (transcoded-port (open-string-input-port "foo\n\rbar\n\r") $13)
$14 = #<input: r6rs-transcoded-port 60725b0>
scheme@(guile-user)> (get-line $14)
$15 = "foo"
scheme@(guile-user)> (get-line $14)
$16 = "\rbar"
scheme@(guile-user)> (get-line $14)
$17 = "\r"
--8<---------------cut here---------------end--------------->8---

But then there are things like ‘string-tokenize’ that do the right
thing:

--8<---------------cut here---------------start------------->8---
scheme@(guile-user)> (string-tokenize "foo\n\rbar\n\rbaz")
$18 = ("foo" "bar" "baz")
--8<---------------cut here---------------end--------------->8---

Thanks,
Ludo’.