From nobody@FreeBSD.org  Mon Dec  5 01:57:05 2011
Return-Path: <nobody@FreeBSD.org>
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id C8500106566C
	for <freebsd-gnats-submit@FreeBSD.org>; Mon,  5 Dec 2011 01:57:05 +0000 (UTC)
	(envelope-from nobody@FreeBSD.org)
Received: from red.freebsd.org (red.freebsd.org [IPv6:2001:4f8:fff6::22])
	by mx1.freebsd.org (Postfix) with ESMTP id 9E6A88FC0A
	for <freebsd-gnats-submit@FreeBSD.org>; Mon,  5 Dec 2011 01:57:05 +0000 (UTC)
Received: from red.freebsd.org (localhost [127.0.0.1])
	by red.freebsd.org (8.14.4/8.14.4) with ESMTP id pB51v5TS078194
	for <freebsd-gnats-submit@FreeBSD.org>; Mon, 5 Dec 2011 01:57:05 GMT
	(envelope-from nobody@red.freebsd.org)
Received: (from nobody@localhost)
	by red.freebsd.org (8.14.4/8.14.4/Submit) id pB51v5iB078193;
	Mon, 5 Dec 2011 01:57:05 GMT
	(envelope-from nobody)
Message-Id: <201112050157.pB51v5iB078193@red.freebsd.org>
Date: Mon, 5 Dec 2011 01:57:05 GMT
From: Kan Sasaki <sasaki@fcc.ad.jp>
To: freebsd-gnats-submit@FreeBSD.org
Subject: [PATCH] devel/lua-sysctl: fix compile on 9.x
X-Send-Pr-Version: www-3.1
X-GNATS-Notify:

>Number:         163073
>Category:       ports
>Synopsis:       [PATCH] devel/lua-sysctl: fix compile on 9.x
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    garga
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          update
>Submitter-Id:   current-users
>Arrival-Date:   Mon Dec 05 02:00:21 UTC 2011
>Closed-Date:    Wed Dec 28 15:22:05 UTC 2011
>Last-Modified:  Wed Dec 28 15:30:15 UTC 2011
>Originator:     Kan Sasaki
>Release:        FreeBSD 9.0-PRERELEASE i386
>Organization:
>Environment:
>Description:
Lua-sysctl does not compile on 9.0 or later. This patch fixes the issue.
>How-To-Repeat:

>Fix:


Patch attached with submission follows:

diff -ruN lua-sysctl.orig/Makefile lua-sysctl/Makefile
--- lua-sysctl.orig/Makefile	2011-02-21 21:13:00.000000000 +0900
+++ lua-sysctl/Makefile	2011-12-05 10:15:01.000000000 +0900
@@ -21,7 +21,7 @@
 .include <bsd.port.pre.mk>
 
 .if ${OSVERSION} >= 900030
-BROKEN=	Does not build
+EXTRA_PATCHES+=	${FILESDIR}/extra-patch-src::lua_sysctl.c
 .endif
 
 do-install:
diff -ruN lua-sysctl.orig/files/extra-patch-src::lua_sysctl.c lua-sysctl/files/extra-patch-src::lua_sysctl.c
--- lua-sysctl.orig/files/extra-patch-src::lua_sysctl.c	1970-01-01 09:00:00.000000000 +0900
+++ lua-sysctl/files/extra-patch-src::lua_sysctl.c	2011-12-05 10:02:33.000000000 +0900
@@ -0,0 +1,45 @@
+--- src/lua_sysctl.c.orig	2011-12-05 09:47:49.000000000 +0900
++++ src/lua_sysctl.c	2011-12-05 09:57:48.000000000 +0900
+@@ -257,6 +257,7 @@
+     long longval;
+     unsigned long ulongval;
+     quad_t quadval;
++    u_quad_t uquadval;
+     size_t s, newsize = 0;
+     u_int kind;
+     char fmt[BUFSIZ], key[BUFSIZ], nvalbuf[BUFSIZ];
+@@ -293,7 +294,8 @@
+             (kind & CTLTYPE) == CTLTYPE_UINT ||
+             (kind & CTLTYPE) == CTLTYPE_LONG ||
+             (kind & CTLTYPE) == CTLTYPE_ULONG ||
+-            (kind & CTLTYPE) == CTLTYPE_QUAD) {
++            (kind & CTLTYPE) == CTLTYPE_S64 ||
++            (kind & CTLTYPE) == CTLTYPE_U64) {
+         if (strlen(newval) == 0)
+             return (luaL_error(L, "empty numeric value"));
+     }
+@@ -343,7 +345,7 @@
+         break;
+     case CTLTYPE_STRING:
+         break;
+-    case CTLTYPE_QUAD:
++    case CTLTYPE_S64:
+         quadval = (quad_t)strtonum(newval, LLONG_MIN, LLONG_MAX, &errmsg);
+         if (errmsg) {
+             return (luaL_error(L, "bad quad_t integer: %s (%s)",
+@@ -352,6 +354,15 @@
+         newval = &quadval;
+         newsize = sizeof(quadval);
+         break;
++    case CTLTYPE_U64:
++        uquadval = (u_quad_t)strtonum(newval, 0, ULLONG_MAX, &errmsg);
++        if (errmsg) {
++            return (luaL_error(L, "bad unsigned quad_t integer: %s (%s)",
++                        (char *)newval, errmsg));
++        }
++        newval = &uquadval;
++        newsize = sizeof(uquadval);
++        break;
+     case CTLTYPE_OPAQUE:
+         if (strcmp(fmt, "T,dev_t") == 0) {
+             set_T_dev_t(L, newval, &newval, &newsize);


>Release-Note:
>Audit-Trail:
Responsible-Changed-From-To: freebsd-ports-bugs->garga 
Responsible-Changed-By: edwin 
Responsible-Changed-When: Mon Dec 5 02:00:39 UTC 2011 
Responsible-Changed-Why:  
Over to maintainer (via the GNATS Auto Assign Tool) 

http://www.freebsd.org/cgi/query-pr.cgi?pr=163073 
State-Changed-From-To: open->closed 
State-Changed-By: garga 
State-Changed-When: Wed Dec 28 15:22:03 UTC 2011 
State-Changed-Why:  
Committed. Thanks! 

http://www.freebsd.org/cgi/query-pr.cgi?pr=163073 

From: dfilter@FreeBSD.ORG (dfilter service)
To: bug-followup@FreeBSD.org
Cc:  
Subject: Re: ports/163073: commit references a PR
Date: Wed, 28 Dec 2011 15:21:59 +0000 (UTC)

 garga       2011-12-28 15:21:51 UTC
 
   FreeBSD ports repository
 
   Modified files:
     devel/lua-sysctl     Makefile 
   Added files:
     devel/lua-sysctl/files extra-patch-src__lua_sysctl.c 
   Log:
   Fix build on 9.x
   
   PR:             ports/163073
   Submitted by:   Kan Sasaki <sasaki@fcc.ad.jp>
   
   Revision  Changes    Path
   1.5       +1 -1      ports/devel/lua-sysctl/Makefile
   1.1       +45 -0     ports/devel/lua-sysctl/files/extra-patch-src__lua_sysctl.c (new)
 _______________________________________________
 cvs-all@freebsd.org mailing list
 http://lists.freebsd.org/mailman/listinfo/cvs-all
 To unsubscribe, send any mail to "cvs-all-unsubscribe@freebsd.org"
 
>Unformatted:
