From owner-freebsd-ports-bugs@FreeBSD.ORG Wed Mar 10 02:10:02 2010 Return-Path: Delivered-To: freebsd-ports-bugs@hub.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id E09D0106566B for ; Wed, 10 Mar 2010 02:10:01 +0000 (UTC) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2001:4f8:fff6::28]) by mx1.freebsd.org (Postfix) with ESMTP id BD71B8FC22 for ; Wed, 10 Mar 2010 02:10:01 +0000 (UTC) Received: from freefall.freebsd.org (localhost [127.0.0.1]) by freefall.freebsd.org (8.14.4/8.14.4) with ESMTP id o2A2A133023885 for ; Wed, 10 Mar 2010 02:10:01 GMT (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.14.4/8.14.4/Submit) id o2A2A1JH023884; Wed, 10 Mar 2010 02:10:01 GMT (envelope-from gnats) Resent-Date: Wed, 10 Mar 2010 02:10:01 GMT Resent-Message-Id: <201003100210.o2A2A1JH023884@freefall.freebsd.org> Resent-From: FreeBSD-gnats-submit@FreeBSD.org (GNATS Filer) Resent-To: freebsd-ports-bugs@FreeBSD.org Resent-Reply-To: FreeBSD-gnats-submit@FreeBSD.org, "Aaron D. Gifford" Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 55D581065675 for ; Wed, 10 Mar 2010 02:00:47 +0000 (UTC) (envelope-from nobody@FreeBSD.org) Received: from www.freebsd.org (www.freebsd.org [IPv6:2001:4f8:fff6::21]) by mx1.freebsd.org (Postfix) with ESMTP id 4558B8FC29 for ; Wed, 10 Mar 2010 02:00:47 +0000 (UTC) Received: from www.freebsd.org (localhost [127.0.0.1]) by www.freebsd.org (8.14.3/8.14.3) with ESMTP id o2A20lHq087133 for ; Wed, 10 Mar 2010 02:00:47 GMT (envelope-from nobody@www.freebsd.org) Received: (from nobody@localhost) by www.freebsd.org (8.14.3/8.14.3/Submit) id o2A20kdc087132; Wed, 10 Mar 2010 02:00:46 GMT (envelope-from nobody) Message-Id: <201003100200.o2A20kdc087132@www.freebsd.org> Date: Wed, 10 Mar 2010 02:00:46 GMT From: "Aaron D. Gifford" To: freebsd-gnats-submit@FreeBSD.org X-Send-Pr-Version: www-3.1 Cc: Subject: ports/144607: [patch] Get www/ruby-fcgi working under Ruby 1.9.1 X-BeenThere: freebsd-ports-bugs@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Ports bug reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 10 Mar 2010 02:10:02 -0000 >Number: 144607 >Category: ports >Synopsis: [patch] Get www/ruby-fcgi working under Ruby 1.9.1 >Confidential: no >Severity: non-critical >Priority: medium >Responsible: freebsd-ports-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: sw-bug >Submitter-Id: current-users >Arrival-Date: Wed Mar 10 02:10:01 UTC 2010 >Closed-Date: >Last-Modified: >Originator: Aaron D. Gifford >Release: FreeBSD 8 >Organization: >Environment: FreeBSD rubyfans.unite.everywhere.example.org 8.0-STABLE FreeBSD 8.0-STABLE #0: Wed Jan 27 19:46:39 MST 2010 root@rubyfans.unite.example.org:/usr/obj/usr/src/sys/RUBY.IS.SWEET amd64 >Description: The www/ruby-fcgi native (C) code uses some Ruby 1.8-isms that break under 1.9. The fix is to update the C code so it works under 1.9 but add some macros so it still works under 1.8 as well. It does require defining a new build variable to engage the macros under 1.8 (I chose RUBY_18, but that could be changed). A patch is included. A Ruby 1.9.1 fan hoping FreeBSD is soon more 1.9.1-friendly, Aaron out. >How-To-Repeat: >Fix: TWO PATCHES, one to the port Makefile, the other to ext/fcgi/fcgi.c: PATCH TO FCGI.C: ================ --- ext/fcgi/fcgi.c.orig 2010-03-08 23:18:38.934686443 -0700 +++ ext/fcgi/fcgi.c 2010-03-08 23:20:16.669821883 -0700 @@ -17,6 +17,13 @@ #include "fcgiapp.h" #endif +#ifdef RUBY_18 +#define RSTRING_LEN(x) ((x)->len) +#define RSTRING_PTR(x) ((x)->ptr) +#define RARRAY_LEN(x) ((x)->len) +#define RARRAY_PTR(x) ((x)->ptr) +#endif + static VALUE cFCGI; static VALUE eFCGIError; static VALUE cFCGIStream; @@ -222,7 +229,7 @@ rb_secure(4); Data_Get_Struct(self, FCGX_Stream, stream); str = rb_obj_as_string(str); - len = FCGX_PutStr(RSTRING(str)->ptr, RSTRING(str)->len, stream); + len = FCGX_PutStr(RSTRING_PTR(str), RSTRING_LEN(str), stream); if (len == EOF) CHECK_STREAM_ERROR(stream); return INT2NUM(len); } @@ -271,8 +278,8 @@ VALUE tmp; int i; - for (i=0; ilen; i++) { - tmp = RARRAY(ary)->ptr[i]; + for (i=0; iptr[RSTRING(line)->len-1] != '\n') { + if (RSTRING_PTR(line)[RSTRING_LEN(line)-1] != '\n') { fcgi_stream_write(out, rb_default_rs); } } @@ -379,7 +386,7 @@ rb_str_cat(str, buff, strlen(buff)); if (strchr(buff, '\n')) break; } - if (RSTRING(str)->len > 0) + if (RSTRING_LEN(str) > 0) return str; else return Qnil; PATCH to the PORT Makefile to define RUBY_18: ============================================= --- Makefile.orig 2010-03-08 23:15:44.555014059 -0700 +++ Makefile 2010-03-08 23:17:03.867500346 -0700 @@ -35,3 +35,8 @@ .endif .include + +.if ${RUBY_VER} == "1.8" +CFLAGS+= -DRUBY_18 +.endif + >Release-Note: >Audit-Trail: >Unformatted: