unofficial mirror of guile-devel@gnu.org 
 help / color / mirror / Atom feed
* fencepost error in encoding processing
@ 2009-11-15  4:36 Ken Raeburn
  2009-11-15  8:48 ` Mike Gran
  2009-11-16 13:03 ` Ludovic Courtès
  0 siblings, 2 replies; 8+ messages in thread
From: Ken Raeburn @ 2009-11-15  4:36 UTC (permalink / raw)
  To: guile-devel

The Mac build started failing for me again, complaining about an  
unknown encoding "UTF-8;" -- yes, with a semicolon on the end.  So it  
may not be surprising to find that it's a minor fencepost error in  
processing the emacs-style encoding spec in boot-9.scm.

Why did this not show up before for you GNU/Linux guys? :-)  Well, it  
turns out, the GNU libc version of iconv_open is being "helpful":

iconv_t
iconv_open (const char *tocode, const char *fromcode)
{
   /* Normalize the name.  We remove all characters beside alpha- 
numeric,
      '_', '-', '/', '.', and ':'.  */
   ...

If there's reason to believe that all these characters might show up  
in valid encoding names, we might want to borrow that list for  
scm_i_scan_for_encoding too.  In fact, since we don't control the  
iconv implementation, we should probably be *at least* as lenient as  
glibc in accepting random characters.

Okay to check in?

Ken

     Fix fencepost error in processing Emacs-style coding declaration.

diff --git a/libguile/read.c b/libguile/read.c
index e403cc3..775612a 100644
--- a/libguile/read.c
+++ b/libguile/read.c
@@ -1513,7 +1513,7 @@ scm_i_scan_for_encoding (SCM port)
    if (i == 0)
      return NULL;

-  encoding = scm_gc_strndup (pos, i + 1, "encoding");
+  encoding = scm_gc_strndup (pos, i, "encoding");
    for (i = 0; i < strlen (encoding); i++)
      encoding[i] = toupper ((int) encoding[i]);






^ permalink raw reply related	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2009-11-16 22:03 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-11-15  4:36 fencepost error in encoding processing Ken Raeburn
2009-11-15  8:48 ` Mike Gran
2009-11-15 22:46   ` Neil Jerram
2009-11-16  7:32     ` Mike Gran
2009-11-16 22:03       ` Richard E. Harke
2009-11-16 13:03 ` Ludovic Courtès
2009-11-16 17:25   ` Ken Raeburn
2009-11-16 21:51     ` Ludovic Courtès

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).