guile-user
[Top][All Lists]
Advanced

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

Re: guile 2.0.9 build on mingw


From: Eli Zaretskii
Subject: Re: guile 2.0.9 build on mingw
Date: Mon, 17 Jun 2013 18:41:19 +0300

> From: address@hidden (Ludovic Courtès)
> Cc: address@hidden,  address@hidden
> Date: Sun, 16 Jun 2013 16:59:19 +0200
> 
> >      Running ports.test
> >      FAIL: ports.test: file: binary mode ignores port encoding
> >      FAIL: ports.test: file: binary mode ignores file coding declaration
> >
> >    Should I worry about this?
> 
> Possibly.  :-)
> 
> Can you try this patch, run ./check-guile ports.test, and report the
> debugging statements that are printed?

That pk thing is a useful trick, thanks.

Btw, is there documentation anywhere about how to use the GDB
interface functions in Guile?  I sometimes need to display Scheme
values while debugging, and I see there are functions for that, but I
found no description of how they are supposed to be used.  What am I
missing?

> diff --git a/test-suite/tests/ports.test b/test-suite/tests/ports.test
> index 9b1c6c0..6137181 100644
> --- a/test-suite/tests/ports.test
> +++ b/test-suite/tests/ports.test
> @@ -251,7 +251,7 @@
>                          (line (read-line in-port)))
>                     (close-port in-port)
>                     (delete-file filename)
> -                   (string=? line binary-test-string)))))
> +                   (string=? (pk 'line line) binary-test-string)))))
>  
>  ;;; binary mode ignores file coding declaration
>  (pass-if "file: binary mode ignores file coding declaration"
> @@ -272,7 +272,7 @@
>                          (line2 (read-line in-port)))
>                     (close-port in-port)
>                     (delete-file filename)
> -                   (string=? line2 binary-test-string)))))
> +                   (string=? (pk 'line2 line2) binary-test-string)))))
>  
>  ;; open-file ignores file coding declaration by default
>  (pass-if "file: open-file ignores coding declaration by default"

It's due to the CRLF thing.  These files are open in the "w" mode, but
then read using the "rb" mode.  So the CR character is left after the
newline is stripped, and botches the comparison.  The debug lines you
added show this (note the \r at the end):

     ;;; (line "\xe4\xb8\x80\xe4\xba\x8c\xe4\xb8\x89\r")
     FAIL: ports.test: file: binary mode ignores port encoding
     
     ;;; (line2 "\xe4\xb8\x80\xe4\xba\x8c\xe4\xb8\x89\r")
     FAIL: ports.test: file: binary mode ignores file coding declaration

I think the solution is to attach to the output port a transcoder that
leaves the single newline character at end of line intact.  But I
couldn't find any example or documentation that would show me how to
construct a transcoder for an encoding.  make-transcoder wants a
codec, but I see no documentation how to make one.  IOW, how do I take
a string like "iso-8859-15" and make a codec out of it?  I trust that
you will know, though ;-)

Thanks.




reply via email to

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