Index | Thread | Search

From:
Claudio Jeker <cjeker@diehard.n-r-g.com>
Subject:
fix radare2 and rizin
To:
ports@openbsd.org
Date:
Fri, 26 Jul 2024 10:28:05 +0200

Download raw body.

Thread
  • Claudio Jeker:

    fix radare2 and rizin

Here is a fix for radare2 and rizin to compile on -current.

The code in both project was just horribly wrong and me removing
PS_STOPPED made this horror pop up.

This has only been compile tested but it can't be worse than before.
-- 
:wq Claudio

Index: radare2/main/Makefile
===================================================================
RCS file: /cvs/ports/devel/radare2/main/Makefile,v
diff -u -p -r1.31 Makefile
--- radare2/main/Makefile	15 Nov 2023 17:13:46 -0000	1.31
+++ radare2/main/Makefile	26 Jul 2024 08:25:05 -0000
@@ -3,7 +3,7 @@
 COMMENT =		libre and portable reverse engineering framework
 
 V =			5.8.8
-REVISION =		0
+REVISION =		1
 SUBST_VARS +=		V
 
 GH_PROJECT =		radare2
Index: radare2/main/patches/patch-libr_debug_p_native_bsd_bsd_debug_c
===================================================================
RCS file: radare2/main/patches/patch-libr_debug_p_native_bsd_bsd_debug_c
diff -N radare2/main/patches/patch-libr_debug_p_native_bsd_bsd_debug_c
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ radare2/main/patches/patch-libr_debug_p_native_bsd_bsd_debug_c	26 Jul 2024 08:25:05 -0000
@@ -0,0 +1,32 @@
+Index: libr/debug/p/native/bsd/bsd_debug.c
+--- libr/debug/p/native/bsd/bsd_debug.c.orig
++++ libr/debug/p/native/bsd/bsd_debug.c
+@@ -189,18 +189,20 @@ RDebugInfo *bsd_info(RDebug *dbg, const char *arg) {
+ 		rdi->gid = kp->p__pgid;
+ 		rdi->exe = strdup (kp->p_comm);
+ 
+-		rdi->status = R_DBG_PROC_STOP;
+-
+-		if (kp->p_psflags & PS_ZOMBIE) {
+-				rdi->status = R_DBG_PROC_ZOMBIE;
+-		} else if (kp->p_psflags & PS_STOPPED) {
++		switch (kp->p_stat) {
++			case SDEAD:
++				rdi->status = R_DBG_PROC_DEAD;
++				break;
++			case SSTOP:
+ 				rdi->status = R_DBG_PROC_STOP;
+-		} else if (kp->p_psflags & PS_PPWAIT) {
++				break;
++			case SSLEEP:
+ 				rdi->status = R_DBG_PROC_SLEEP;
+-		} else if ((kp->p_psflags & PS_EXEC) || (kp->p_psflags & PS_INEXEC)) {
++				break;
++			default:
+ 				rdi->status = R_DBG_PROC_RUN;
++				break;
+ 		}
+-
+ 	}
+ 
+ 	kvm_close (kd);
Index: rizin/Makefile
===================================================================
RCS file: /cvs/ports/devel/rizin/Makefile,v
diff -u -p -r1.9 Makefile
--- rizin/Makefile	6 May 2024 12:23:32 -0000	1.9
+++ rizin/Makefile	26 Jul 2024 08:25:05 -0000
@@ -8,7 +8,7 @@ V =		0.7.2
 DISTNAME =	rizin-src-v${V}
 EXTRACT_SUFX =	.tar.xz
 PKGNAME =	rizin-${V}
-REVISION =	0
+REVISION =	1
 
 SITES =		https://github.com/rizinorg/rizin/releases/download/v${V}/
 
Index: rizin/patches/patch-librz_debug_p_native_bsd_bsd_debug_c
===================================================================
RCS file: rizin/patches/patch-librz_debug_p_native_bsd_bsd_debug_c
diff -N rizin/patches/patch-librz_debug_p_native_bsd_bsd_debug_c
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ rizin/patches/patch-librz_debug_p_native_bsd_bsd_debug_c	26 Jul 2024 08:25:05 -0000
@@ -0,0 +1,30 @@
+Index: librz/debug/p/native/bsd/bsd_debug.c
+--- librz/debug/p/native/bsd/bsd_debug.c.orig
++++ librz/debug/p/native/bsd/bsd_debug.c
+@@ -211,16 +211,19 @@ RzDebugInfo *bsd_info(RzDebug *dbg, const char *arg) {
+ 		rdi->gid = kp->p__pgid;
+ 		rdi->exe = strdup(kp->p_comm);
+ 
+-		rdi->status = RZ_DBG_PROC_STOP;
+-
+-		if (kp->p_psflags & PS_ZOMBIE) {
+-			rdi->status = RZ_DBG_PROC_ZOMBIE;
+-		} else if (kp->p_psflags & PS_STOPPED) {
++		switch (kp->p_stat) {
++		case SDEAD:
++			rdi->status = RZ_DBG_PROC_DEAD;
++			break;
++		case SSTOP:
+ 			rdi->status = RZ_DBG_PROC_STOP;
+-		} else if (kp->p_psflags & PS_PPWAIT) {
++			break;
++		case SSLEEP:
+ 			rdi->status = RZ_DBG_PROC_SLEEP;
+-		} else if ((kp->p_psflags & PS_EXEC) || (kp->p_psflags & PS_INEXEC)) {
++			break;
++		default:
+ 			rdi->status = RZ_DBG_PROC_RUN;
++			break;
+ 		}
+ 	}
+