Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 123938 - Ruby Syck(YAML) fails with parse error on parsing multiple documents
Summary: Ruby Syck(YAML) fails with parse error on parsing multiple documents
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: [OLD] Development (show other bugs)
Hardware: All Linux
: High normal (vote)
Assignee: Gentoo Ruby Team
URL: http://rubyforge.org/tracker/index.ph...
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2006-02-24 07:09 UTC by Hannes Wyss
Modified: 2006-02-27 06:35 UTC (History)
0 users

See Also:
Package list:
Runtime testing required: ---


Attachments
The complete Backport-patch (ruby-1.8.4-yaml.diff,11.89 KB, patch)
2006-02-24 07:10 UTC, Hannes Wyss
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Hannes Wyss 2006-02-24 07:09:32 UTC
I've filed this report upstream too, but I would appreciate if the existing patch ruby-1.8.4-yaml.diff could be replaced by a more complete one (attached to the upstream report).

Here's the upstream report:

195-documents.yaml is a File (12M) containing 195 complex YAML-Documents (I can provide the file if necessary)

Without custom domain-types
ruby -r'yaml' -e 'docs = []; File.open("195-documents.yaml") { |fh| YAML.each_document(fh) { |doc| docs.push(doc) } }; puts docs.size'
-> 18

With custom domain-types
ruby -r'yaml' -r'domain-types' -e 'docs = []; File.open("195-documents.yaml") { |fh| YAML.each_document(fh) { |doc| docs.push(doc) } }; puts docs.size'
-> /usr/lib/ruby/1.8/yaml.rb:217:in `load_documents': syntax error on line 23806, col 36: `on (<0,1%). Rarement
peuvent se' (ArgumentError)
        from /usr/lib/ruby/1.8/yaml.rb:217:in `each_document'
        from -e:1
        from -e:1


With a backport from ruby 1.9 the Problem goes away. Here is a minimal patch:

diff -Nbr -U4 ruby-1.8.4/ext/syck/syck.c yarv-0.4.0/ext/syck/syck.c
--- ruby-1.8.4/ext/syck/syck.c  2005-09-13 05:58:32.000000000 +0200
+++ yarv-0.4.0/ext/syck/syck.c  2006-02-20 07:16:38.000000000 +0100
@@ -1,9 +1,9 @@
 /*
  * syck.c
  *
- * $Author: why $
- * $Date: 2005/09/13 03:58:32 $
+ * $Author: ocean $
+ * $Date: 2006/02/03 06:10:21 $
  *
  * Copyright (C) 2003 why the lucky stiff
  */
 #include "ruby.h"
@@ -409,11 +409,8 @@
     if ( p->token == NULL )
         return 0;

     skip = p->limit - p->token;
-    if ( skip < 1 )
-        return 0;
-
     if ( ( count = p->token - p->buffer ) )
     {
         S_MEMMOVE( p->buffer, p->token, char, skip );
         p->token = p->buffer;



Without custom domain-types
ruby -r'yaml' -e 'docs = []; File.open("195-documents.yaml") { |fh| YAML.each_document(fh) { |doc| docs.push(doc) } }; puts docs.size'
-> 195

With custom domain-types
ruby -r'yaml' -r'domain-types' -e 'docs = []; File.open("195-documents.yaml") { |fh| YAML.each_document(fh) { |doc| docs.push(doc) } }; puts docs.size'
-> 195



hwyss@lapdog ~ $ emerge --info
Portage 2.0.54 (default-linux/ppc/2005.0, gcc-3.4.4, glibc-2.3.5-r3, 2.6.15-rc5 ppc)
=================================================================
System uname: 2.6.15-rc5 ppc 7447A, altivec supported
Gentoo Base System version 1.12.0_pre15
dev-lang/python:     2.3.5-r2, 2.4.2
sys-apps/sandbox:    1.2.12
sys-devel/autoconf:  2.13, 2.59-r6
sys-devel/automake:  1.4_p6, 1.5, 1.6.3, 1.7.9-r1, 1.8.5-r3, 1.9.6-r1
sys-devel/binutils:  2.16.1
sys-devel/libtool:   1.5.22
virtual/os-headers:  2.6.11-r2
ACCEPT_KEYWORDS="ppc"
AUTOCLEAN="yes"
CBUILD="powerpc-unknown-linux-gnu"
CFLAGS="-O2 -pipe -mtune=powerpc -mcpu=7450 -maltivec -mabi=altivec -mpowerpc-gfxopt -fsigned-char"
CHOST="powerpc-unknown-linux-gnu"
CONFIG_PROTECT="/etc /usr/kde/2/share/config /usr/kde/3.4/env /usr/kde/3.4/share/config /usr/kde/3.4/shutdown /usr/kde/3.5/env /usr/kde/3.5/share/config /usr/kde/3.5/shutdown /usr/kde/3/share/config /usr/lib/X11/xkb /usr/lib/mozilla/defaults/pref /usr/share/config /usr/share/texmf/dvipdfm/config/ /usr/share/texmf/dvips/config/ /usr/share/texmf/tex/generic/config/ /usr/share/texmf/tex/platex/config/ /usr/share/texmf/xdvi/ /var/qmail/control"
CONFIG_PROTECT_MASK="/etc/gconf /etc/terminfo /etc/env.d"
CXXFLAGS="-O2 -pipe -mtune=powerpc -mcpu=7450 -maltivec -mabi=altivec -mpowerpc-gfxopt -fsigned-char"
DISTDIR="/usr/portage/distfiles"
FEATURES="autoconfig distlocks sandbox sfperms"
GENTOO_MIRRORS="ftp://mirror.switch.ch/mirror/gentoo/ ftp://ibiblio.org/pub/Linux/distributions/gentoo"
LC_ALL="en_US.ISO8859-1"
MAKEOPTS="-j2"
PKGDIR="/usr/portage/packages"
PORTAGE_TMPDIR="/var/tmp"
PORTDIR="/usr/portage"
PORTDIR_OVERLAY="/usr/local/portage"
SYNC="rsync://rsync.europe.gentoo.org/gentoo-portage"
USE="ppc X aac aalib aim alsa altivec apache2 apm arts async audiofile berkdb bitmap-fonts bonobo bzip2 cairo caps cddb cdparanoia cdr chroot crypt cups curl curlwrappers dba dga directfb dmx dts dv dvd dvdread edl eds emboss ethereal evo exif expat fam fastcgi fbcon fbdev ffmpeg flac font-server foomaticdb fortran gcj gd gdbm ggi gif gimpprint glut gmp gnome gphoto2 gpm gstreamer gtk gtk2 gtkhtml guile hal idn ieee1394 image imagemagick imlib imlib2 ipv6 jack jack-tmpfs java javacomm jikes jpeg junit kde kdeenablefinal kdexdeltas lcms libcaca libwww live lua lzo lzw mad maildir mailwrapper mhash mikmod mng mono motif mozdevelop mozilla moznocompose moznoirc moznomail mozsha1 mozsvg mozxmlterm mp3 mpeg mpm-worker mysql ncurses nls nodrm offensive ogg oggvorbis openal opengl pam pbbuttonsd pci pcre pda pdflib perl php png postgres python qt quicktime readline recode rtc ruby samba sasl scanner sdl sheep slang speex spell sqlite ssl svg tcltk tcpd tetex tga theora threads tiff truetype truetype-fonts type1 type1-fonts udev unicode usb vnc vorbis xanim xine xinerama xml xml2 xmms xv xvid zlib video_cards_radeon userland_GNU kernel_linux elibc_glibc"
Unset:  ASFLAGS, CTARGET, LANG, LDFLAGS, LINGUAS
Comment 1 Hannes Wyss 2006-02-24 07:10:21 UTC
Created attachment 80603 [details, diff]
The complete Backport-patch
Comment 2 Hannes Wyss 2006-02-27 00:40:48 UTC
Here's the upstream response:

<quote source=http://rubyforge.org/tracker/?func=detail&atid=1698&aid=3654&group_id=426>
Sender: Hirokazu Yamamoto

Hello. My syck/yaml patches were already backported to ruby_1_8
branch. More accuratly, I commited that patches to both branches
same time :-)

You can get ruby_1_8 snapshot from
ftp://ftp.ruby-lang.org/pub/ruby/stable-snapshot.tar.gz
</quote>

Any chance of a fresh ebuild that uses the latest stable ruby?

thanks in advance
Hannes
Comment 3 Caleb Tennis (RETIRED) gentoo-dev 2006-02-27 06:35:10 UTC
I just committed ruby-1.8.4.20060226.  That should fix this issue.  Thanks for the report.