Index | Thread | Search

From:
Jeremie Courreges-Anglas <jca@wxcvbn.org>
Subject:
sysutils/cdrtools diff to test
To:
ports@openbsd.org
Date:
Fri, 28 Feb 2025 17:41:14 +0100

Download raw body.

Thread
  • Jeremie Courreges-Anglas:

    sysutils/cdrtools diff to test

cdrtools has this horrid unportable "stack scanning" code that already
broke during a clang update.  It now breaks with clang 19 on arm64:
the avoffset program, used to detect argv offset and stack direction,
loops indefinitely.

The diff below drops all the stack scanning code.  The get_progname()
function still works in cdrecord, but it's hard to tell what other
subsystems could break so I'd like to get some feedback from actual
users.


Index: Makefile
===================================================================
RCS file: /home/cvs/ports/sysutils/cdrtools/Makefile,v
diff -u -p -r1.27 Makefile
--- Makefile	7 Nov 2023 14:19:44 -0000	1.27
+++ Makefile	28 Feb 2025 16:01:21 -0000
@@ -1,7 +1,7 @@
 COMMENT=		ISO 9660 filesystem and CD/DVD/BD creation tools
 
 DISTNAME=		cdrtools-3.00
-REVISION=		3
+REVISION=		4
 CATEGORIES=		sysutils
 HOMEPAGE=		https://cdrtools.sourceforge.net/private/cdrtools.html
 
Index: patches/patch-inc_avoffset_c
===================================================================
RCS file: patches/patch-inc_avoffset_c
diff -N patches/patch-inc_avoffset_c
--- patches/patch-inc_avoffset_c	25 Nov 2023 11:57:57 -0000	1.2
+++ /dev/null	1 Jan 1970 00:00:00 -0000
@@ -1,14 +0,0 @@
-Backport llvm fix from 3.01
-
-Index: inc/avoffset.c
---- inc/avoffset.c.orig
-+++ inc/avoffset.c
-@@ -103,7 +103,7 @@ main(ac, av)
- 	 * Note: Scanning the stack to look for argc/argv
- 	 *	 works only in the main thread.
- 	 */
--	while (fp->fr_savfp) {
-+	while (i <= 1000 && fp->fr_savfp) {
- 		if (fp->fr_savpc == 0)
- 			break;
- 
Index: patches/patch-inc_avoffset_mk
===================================================================
RCS file: patches/patch-inc_avoffset_mk
diff -N patches/patch-inc_avoffset_mk
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ patches/patch-inc_avoffset_mk	28 Feb 2025 15:28:57 -0000
@@ -0,0 +1,15 @@
+Avoid stack scanning: unportable and undefined behavior, frequently breaks
+with compiler updates.
+
+Index: inc/avoffset.mk
+--- inc/avoffset.mk.orig
++++ inc/avoffset.mk
+@@ -8,7 +8,7 @@ include		$(SRCROOT)/$(RULESDIR)/rules.top
+ INSDIR=		include/schily/$(OARCH)
+ TARGET=		avoffset.h
+ TARGETC=	avoffset
+-CPPOPTS +=	-DUSE_SCANSTACK
++CPPOPTS +=	-DNO_SCANSTACK
+ CPPOPTS +=	-D__OPRINTF__
+ CFILES=		avoffset.c
+ 
Index: patches/patch-libschily_libschily_mk
===================================================================
RCS file: patches/patch-libschily_libschily_mk
diff -N patches/patch-libschily_libschily_mk
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ patches/patch-libschily_libschily_mk	28 Feb 2025 15:28:26 -0000
@@ -0,0 +1,15 @@
+Avoid stack scanning: unportable and undefined behavior, frequently breaks
+with compiler updates.
+
+Index: libschily/libschily.mk
+--- libschily/libschily.mk.orig
++++ libschily/libschily.mk
+@@ -10,7 +10,7 @@ VPATH=		.:stdio:$(ARCHDIR)
+ INSDIR=		lib
+ TARGETLIB=	schily
+ CPPOPTS +=	-Istdio
+-CPPOPTS +=	-DUSE_SCANSTACK	# Try to scan stack frames
++CPPOPTS +=	-DNO_SCANSTACK	# Try to scan stack frames
+ CPPOPTS +=	-DPORT_ONLY	# Add missing funcs line snprintf for porting
+ include		Targets
+ LIBS=		
Index: patches/patch-libschily_libschily_p_mk
===================================================================
RCS file: patches/patch-libschily_libschily_p_mk
diff -N patches/patch-libschily_libschily_p_mk
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ patches/patch-libschily_libschily_p_mk	28 Feb 2025 15:48:37 -0000
@@ -0,0 +1,15 @@
+Avoid stack scanning: unportable and undefined behavior, frequently breaks
+with compiler updates.
+
+Index: libschily/libschily_p.mk
+--- libschily/libschily_p.mk.orig
++++ libschily/libschily_p.mk
+@@ -12,7 +12,7 @@ VPATH=		.:stdio:$(ARCHDIR)
+ INSDIR=		lib
+ TARGETLIB=	schily
+ CPPOPTS +=	-Istdio
+-CPPOPTS +=	-DUSE_SCANSTACK	# Try to scan stack frames
++CPPOPTS +=	-DNO_SCANSTACK	# Try to scan stack frames
+ CPPOPTS +=	-DPORT_ONLY	# Add missing funcs line snprintf for porting
+ COPTS +=	$(COPTGPROF)
+ include		Targets
Index: patches/patch-libschily_shlschily_mk
===================================================================
RCS file: patches/patch-libschily_shlschily_mk
diff -N patches/patch-libschily_shlschily_mk
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ patches/patch-libschily_shlschily_mk	28 Feb 2025 15:35:51 -0000
@@ -0,0 +1,15 @@
+Avoid stack scanning: unportable and undefined behavior, frequently breaks
+with compiler updates.
+
+Index: libschily/shlschily.mk
+--- libschily/shlschily.mk.orig
++++ libschily/shlschily.mk
+@@ -11,7 +11,7 @@ VPATH=		.:stdio:$(ARCHDIR)
+ INSDIR=		lib
+ TARGETLIB=	schily
+ CPPOPTS +=	-Istdio
+-CPPOPTS +=	-DUSE_SCANSTACK	# Try to scan stack frames
++CPPOPTS +=	-DNO_SCANSTACK	# Try to scan stack frames
+ CPPOPTS +=	-DPORT_ONLY	# Add missing funcs line snprintf for porting
+ include		Targets
+ LIBS=		-lc

-- 
jca