Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 334785 - dev-ruby/ruby-fcgi-0.8.8-r1 and dev-lang/ruby-1.9.2 not working
Summary: dev-ruby/ruby-fcgi-0.8.8-r1 and dev-lang/ruby-1.9.2 not working
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:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-08-27 10:00 UTC by Dmitry Kravtsov
Modified: 2013-03-04 06:54 UTC (History)
1 user (show)

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


Attachments
Proposed patch for ruby-fcgi-0.8.8-r2.ebuild (ruby-fcgi-0.8.8-r2.ebuild.patch,484 bytes, patch)
2011-12-18 10:10 UTC, Tomoh K.
Details | Diff
Proposed patch for lib/fcgi.rb (ruby-fcgi-0.8.8-ruby19_github.patch,611 bytes, patch)
2011-12-18 10:11 UTC, Tomoh K.
Details | Diff
Proposed patch for ext/fcgi/fcgi.c (ruby-fcgi-0.8.8-ruby19_rubyforge.patch,9.50 KB, patch)
2011-12-18 10:11 UTC, Tomoh K.
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Dmitry Kravtsov 2010-08-27 10:00:51 UTC
I tried to make a simple fastcgi application on Ruby (without ROR). And combination mod_fastcgi(mod_fcgid)+Apache+ruby-fcgi+ruby works only with ruby 1.8. Part of error.log from Apache2:

[Fri Aug 27 20:49:35 2010] [notice] Apache/2.2.15 (Unix) mod_ssl/2.2.15 OpenSSL/1.0.0a mod_fcgid/2.3.5 configured -- resuming normal operations                                                                                   
/usr/lib64/ruby/gems/1.9.1/gems/fcgi-0.8.8/lib/fcgi.rb:454:in `read_length': undefined method `>>' for "\x12":String ([Fri Aug 27 20:49:55 2010] [warn] [client 127.0.0.1] (104)Connection reset by peer: mod_fcgid: error reading data from FastCGI server                                                                                        
NoMethodError)                                                                                                   
    from /usr/lib64/ruby/gems/1.9.1/gems/fcgi-0.8.8/lib/fcgi.rb:448:in `read_pair'                               
[Fri Aug 27 20:49:55 2010] [error] [client 127.0.0.1] Premature end of script headers: test.rb.fcgi              
    from /usr/lib64/ruby/gems/1.9.1/gems/fcgi-0.8.8/lib/fcgi.rb:441:in `parse_values'                            
    from /usr/lib64/ruby/gems/1.9.1/gems/fcgi-0.8.8/lib/fcgi.rb:435:in `parse'                                   
    from /usr/lib64/ruby/gems/1.9.1/gems/fcgi-0.8.8/lib/fcgi.rb:195:in `read_record'                             
    from /usr/lib64/ruby/gems/1.9.1/gems/fcgi-0.8.8/lib/fcgi.rb:126:in `next_request'                            
    from /usr/lib64/ruby/gems/1.9.1/gems/fcgi-0.8.8/lib/fcgi.rb:116:in `session'                                 
    from /usr/lib64/ruby/gems/1.9.1/gems/fcgi-0.8.8/lib/fcgi.rb:104:in `each_request'                            
    from /usr/lib64/ruby/gems/1.9.1/gems/fcgi-0.8.8/lib/fcgi.rb:36:in `each'                                     
    from /usr/lib64/ruby/gems/1.9.1/gems/fcgi-0.8.8/lib/fcgi.rb:609:in `each_cgi'                                
    from /var/www/localhost/htdocs/test.rb.fcgi:5:in `<main>'                                                    
[Fri Aug 27 20:49:55 2010] [error] [client 127.0.0.1] File does not exist: /var/www/localhost/htdocs/favicon.ico 
[Fri Aug 27 20:49:57 2010] [warn] [client 127.0.0.1] (104)Connection reset by peer: mod_fcgid: error reading data from FastCGI server

Also if I use ruby 1.8 it can't find module fcgi.rb and I have to use an absolute path in "require".

And a test fcgi script, that I used to produce it:
#!/usr/bin/ruby -w                                                                                               
require '/usr/lib64/ruby/gems/1.9.1/gems/fcgi-0.8.8/lib/fcgi'                                                    
                                                                                                                 
count = 0                                                                                                        
FCGI.each_cgi do                                                                                                 
    puts "Content-type: text/html\n\n"                                                                           
    puts "Hello, Ruby! FastCGI(#{count})"                                                                        
    puts $LOADPATH                                                                                               
    count = count + 1                                                                                            
end
Comment 1 Diego Elio Pettenò (RETIRED) gentoo-dev 2010-08-27 10:28:11 UTC
Please provide your emerge --info or we'll be unable to help you at all.
Comment 2 Dmitry Kravtsov 2010-08-27 10:40:44 UTC
# emerge --info
Portage 2.1.8.3 (default/linux/amd64/10.0, gcc-4.4.4, glibc-2.12.1-r1, 2.6.35-gentoo-r4 x86_64)
=================================================================
System uname: Linux-2.6.35-gentoo-r4-x86_64-Intel-R-_Core-TM-_i7_CPU_920_@_2.67GHz-with-gentoo-2.0.1
Timestamp of tree: Fri, 27 Aug 2010 07:30:01 +0000
app-shells/bash:     4.1_p7
dev-java/java-config: 2.1.11
dev-lang/python:     2.6.5-r3, 3.1.2-r4
dev-util/cmake:      2.8.1-r2
sys-apps/baselayout: 2.0.1
sys-apps/openrc:     0.6.2
sys-apps/sandbox:    2.3-r1
sys-devel/autoconf:  2.13, 2.65-r1
sys-devel/automake:  1.8.5-r4, 1.9.6-r3, 1.10.3, 1.11.1
sys-devel/binutils:  2.20.1-r1
sys-devel/gcc:       4.4.4-r1
sys-devel/gcc-config: 1.4.1
sys-devel/libtool:   2.2.10
sys-devel/make:      3.81-r2
virtual/os-headers:  2.6.35
ACCEPT_KEYWORDS="amd64 ~amd64"
ACCEPT_LICENSE="* -@EULA"
CBUILD="x86_64-pc-linux-gnu"
CFLAGS="-march=core2 -msse4 -msse4.1 -msse4.2 -mcx16 -msahf -O2 -pipe"
CHOST="x86_64-pc-linux-gnu"
CONFIG_PROTECT="/etc /usr/share/X11/xkb /usr/share/config /var/lib/hsqldb"
CONFIG_PROTECT_MASK="/etc/ca-certificates.conf /etc/env.d /etc/env.d/java/ /etc/fonts/fonts.conf /etc/gconf /etc/gentoo-release /etc/php/apache2-php5/ext-active/ /etc/php/cgi-php5/ext-active/ /etc/php/cli-php5/ext-active/ /etc/revdep-rebuild /etc/sandbox.d /etc/splash /etc/terminfo /etc/texmf/language.dat.d /etc/texmf/language.def.d /etc/texmf/updmap.d /etc/texmf/web2c"
CXXFLAGS="-march=core2 -msse4 -msse4.1 -msse4.2 -mcx16 -msahf -O2 -pipe"
DISTDIR="/usr/portage/distfiles"
FEATURES="assume-digests distlocks fixpackages news parallel-fetch protect-owned sandbox sfperms strict unmerge-logs unmerge-orphans userfetch"
GENTOO_MIRRORS="http://mirror.yandex.ru/gentoo-distfiles/"
LANG="ru_RU.UTF-8"
LC_ALL=""
LDFLAGS="-Wl,-O1 -Wl,--as-needed"
LINGUAS="en ru"
MAKEOPTS="-j9"
PKGDIR="/usr/portage/packages"
PORTAGE_CONFIGROOT="/"
PORTAGE_RSYNC_OPTS="--recursive --links --safe-links --perms --times --compress --force --whole-file --delete --stats --timeout=180 --exclude=/distfiles --exclude=/local --exclude=/packages"
PORTAGE_TMPDIR="/var/tmp"
PORTDIR="/usr/portage"
PORTDIR_OVERLAY="/var/lib/layman/desktop-effects /var/lib/layman/sunrise /var/lib/layman/ruby"
SYNC="rsync://rsync.gentoo.org/gentoo-portage"
USE="3dnow X a52 aac acl acpi additions alsa amd64 autoipd avahi bash-completion berkdb bookmarks branding bzip2 cairo cdda cddax cddb cdio cdr chm cli consolekit contrast cpudetection cracklib crypt ctype cue cups cxx cyrillic daemon dbus djvu dri dts dvd dvipdfm emovix encode espeak extras faac faad ffmpeg fits flac font-server fontconfig fortran gconf gdbm gimp git glib gmp gnutls gphoto2 gpm gstreamer gtk hal iconv id3tag ipod ipv6 jadetex java jpeg jpeg2k kde kpathsea lame latex latex3 lcms lensfun libnotify live mad matroska mdnsresponder-compat midi mmx mng modules mp3 mp3tunes mpeg mudflap multilib multislot musepack musicbrainz mysql ncurses netbeans nls nptl nptlonly nsplugin ogg opencore-amr opengl openmp oss pam pcre perl php png policykit pppd pronounce pstricks python qt3support qt4 rar readline reflection rss ruby sdl secure-delete semantic-desktop session shorten simplexml skins slp sndfile sox spell spl sql sqlite sse sse2 ssl subversion suid svg sysfs system-libvncserver taglib tcpd templates theora threads tiff timezone truetype udev unicode usb v41 v412 v4l vcd vhosts vorbis wav wavpack webkit winetricks wmf wxwidgets wxwindows x264 xcb xinerama xml xmlrpc xorg xulrunner xv xvid xvmc zip zlib" ALSA_CARDS="ali5451 als4000 atiixp atiixp-modem bt87x ca0106 cmipci emu10k1x ens1370 ens1371 es1938 es1968 fm801 hda-intel intel8x0 intel8x0m maestro3 trident usb-audio via82xx via82xx-modem ymfpci" ALSA_PCM_PLUGINS="adpcm alaw asym copy dmix dshare dsnoop empty extplug file hooks iec958 ioplug ladspa lfloat linear meter mmap_emul mulaw multi null plug rate route share shm softvol" APACHE2_MODULES="actions alias auth_basic authn_alias authn_anon authn_dbm authn_default authn_file authz_dbm authz_default authz_groupfile authz_host authz_owner authz_user autoindex cache cgi cgid dav dav_fs dav_lock deflate dir disk_cache env expires ext_filter file_cache filter headers include info log_config logio mem_cache mime mime_magic negotiation rewrite setenvif speling status unique_id userdir usertrack vhost_alias" ELIBC="glibc" INPUT_DEVICES="evdev" KERNEL="linux" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" LINGUAS="en ru" RUBY_TARGETS="ruby18 ruby19" USERLAND="GNU" VIDEO_CARDS="nvidia" XTABLES_ADDONS="quota2 psd pknock lscan length2 ipv4options ipset ipp2p iface geoip fuzzy condition tee tarpit sysrq steal rawnat logmark ipmark dhcpmac delude chaos account" 
Unset:  CPPFLAGS, CTARGET, EMERGE_DEFAULT_OPTS, FFLAGS, INSTALL_MASK, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS
Comment 3 Dmitry Kravtsov 2010-08-27 10:53:13 UTC
ok, done it
Comment 4 Tomoh K. 2011-12-18 10:08:28 UTC
I confirmed this issue while testing www-servers/gorg. Same error occurred. dev-ruby/ruby-fcgi-0.8.8-r2 cannot use with ruby19. Tested on lighttpd and Apache/mod_fcgid.

1)
lib/fcgi.rb (pure ruby implementation) is broken on ruby19.
Fix was committed on upstream ruby-fcgi repo [1].
But these patches break ruby18 compatibility, So I patched them only for ruby19.
(this is not required if fcgi.c is fixed(see below). fcgi.so works fine with unpatched fcgi.rb.)

2)
ext/fcgi/fcgi.c (C implementation) cannot build with ruby19.
Details are described in Flameeyes' Blog [2].
This issue is fixed in fcgi-0.8.8 from RubyForge project page [3].
ruby-fcgi-0.8.8-r2.ebuild pulls the gem from rubygems.org, that gem is differ to fcgi-0.8.8.gem from RubyForge project page.
I made a patch from RubyForge's tarball.
(IMHO, It is better to get the gem from RubyForge instead patching. But both of gems have same name and broken gem is already in the Gentoo distfiles mirror, so I did patch this time.)

Proposal ebuild and patches are attached.

Regards.

[1] https://github.com/saks/ruby-fcgi/commits/master
https://github.com/saks/ruby-fcgi/commit/ade9470d01093cb3f0a16d68e58869912d34427e
https://github.com/saks/ruby-fcgi/commit/f289d592a135f4112ec4eb54a77fadf7d0c9bb8f
[2] http://blog.flameeyes.eu/2010/02/03/ruby-ng-the-nth-fork
[3] http://rubyforge.org/projects/fcgi/
Comment 5 Tomoh K. 2011-12-18 10:10:11 UTC
Created attachment 296205 [details, diff]
Proposed patch for ruby-fcgi-0.8.8-r2.ebuild
Comment 6 Tomoh K. 2011-12-18 10:11:07 UTC
Created attachment 296207 [details, diff]
Proposed patch for lib/fcgi.rb
Comment 7 Tomoh K. 2011-12-18 10:11:57 UTC
Created attachment 296209 [details, diff]
Proposed patch for ext/fcgi/fcgi.c
Comment 8 Vadim A. Misbakh-Soloviov (mva) gentoo-dev 2013-01-17 01:09:47 UTC
please use dev-ruby/ruby-fcgi-ng for now ( wait for #452624 )
Comment 9 Hans de Graaff gentoo-dev Security 2013-03-04 06:54:12 UTC
(In reply to comment #8)
> please use dev-ruby/ruby-fcgi-ng for now ( wait for #452624 )

This is now in the tree as fcgi 0.9.1.