public inbox for git-commits@fedoraproject.org
help / color / mirror / Atom feed
* [rpms/libsurvive] rawhide: Update to latest and unbundle crc32, hidapi, mpfit, zlib.
@ 2026-10-11 17:46 Jonathan Steffan
  0 siblings, 0 replies; only message in thread
From: Jonathan Steffan @ 2026-10-11 17:46 UTC (permalink / raw)
  To: git-commits

A new commit has been pushed.

Repo   : rpms/libsurvive
Branch : rawhide
Commit : 711f888c686989a36fdc1fef053afd6c065feb53
Author : Jonathan Steffan <jsteffan@fedoraproject.org>
Date   : 2026-10-11T11:45:51-06:00
Stats  : +83/-153 in 6 file(s)
URL    : https://src.fedoraproject.org/rpms/libsurvive/c/711f888c686989a36fdc1fef053afd6c065feb53?branch=rawhide

Log:
Update to latest and unbundle crc32, hidapi, mpfit, zlib.

---
diff --git a/libsurvive-fopencookie-off64.patch b/libsurvive-fopencookie-off64.patch
deleted file mode 100644
index bf5cd77..0000000
--- a/libsurvive-fopencookie-off64.patch
+++ /dev/null
@@ -1,50 +0,0 @@
-From: Jonathan Steffan <jonathansteffan@gmail.com>
-Subject: [PATCH] usbmon: fix fopencookie seek callback signature and semantics
-
-glibc's cookie_seek_function_t is always
-
-    int (*)(void *cookie, __off64_t *pos, int whence)
-
-regardless of _FILE_OFFSET_BITS.  gzip_cookie_seek() declared its position
-argument as z_off_t *, which zlib defines as off_t.  On LP64 targets off_t and
-__off64_t are both long, so the mismatch is invisible; on 32-bit targets such as
-i686, off_t is a 32-bit long while __off64_t is long long, and initialising
-cookie_io_functions_t::seek fails to compile:
-
-  src/driver_usbmon.c:796:99: error: initialization of
-    'int (*)(void *, __off64_t *, int)' {aka 'int (*)(void *, long long int *, int)'}
-    from incompatible pointer type 'int (*)(void *, off_t *, int)'
-    {aka 'int (*)(void *, long int *, int)'} [-Wincompatible-pointer-types]
-
-Use off64_t and gzseek64() so the type matches on every architecture.  The file
-already defines _GNU_SOURCE before any include, which implies
-_LARGEFILE64_SOURCE, so both are available.
-
-While here, follow the fopencookie(3) contract: the seek callback must return 0
-on success and -1 on error, storing the resulting offset in *pos.  The old code
-returned the new offset directly and never wrote back to *pos, so fseek()/
-ftell() on a compressed playback stream misbehaved on all architectures.
-
-gzip_cookie_seek() is also made static to match its siblings; its only user is
-the initialiser immediately below it.
-
-diff --git a/src/driver_usbmon.c b/src/driver_usbmon.c
---- a/src/driver_usbmon.c
-+++ b/src/driver_usbmon.c
-@@ -790,7 +790,14 @@
- 
- static ssize_t gzip_cookie_read(void *cookie, char *buf, size_t nbytes) { return gzread((gzFile)cookie, buf, nbytes); }
- 
--int gzip_cookie_seek(void *cookie, z_off_t *pos, int __w) { return gzseek((gzFile)cookie, *pos, __w); }
-+static int gzip_cookie_seek(void *cookie, off64_t *pos, int whence) {
-+	z_off64_t r = gzseek64((gzFile)cookie, (z_off64_t)*pos, whence);
-+	if (r < 0)
-+		return -1;
-+
-+	*pos = (off64_t)r;
-+	return 0;
-+}
- 
- cookie_io_functions_t gzip_cookie = {
- 	.close = gzip_cookie_close, .write = gzip_cookie_write, .read = gzip_cookie_read, .seek = gzip_cookie_seek};
- 

diff --git a/libsurvive-gss-scene-cleanup.patch b/libsurvive-gss-scene-cleanup.patch
new file mode 100644
index 0000000..30de176
--- /dev/null
+++ b/libsurvive-gss-scene-cleanup.patch
@@ -0,0 +1,53 @@
+--- a/src/driver_global_scene_solver.c
++++ b/src/driver_global_scene_solver.c
+@@ -63,29 +63,31 @@
+ 	SurviveSensorActivations *activations = &so->activations;
+
+-	// TT clean up scenes with invalid SurviveObjects
+-	unsigned int free_idx = 0;
+-	for (int i = 0; i < GSS_NUM_STORED_SCENES; i++) {
+-		if (gss->scenes[i].so == NULL) {
+-			continue;
+-		}
+-		
+-		bool is_still_valid = false;
+-		if (gss->scenes[i].so == so) {
+-			is_still_valid = true;
+-		}
+-		for (int j = 0; j < ctx->objs_ct; j++) {
+-			if (gss->scenes[i].so == ctx->objs[j]) {
+-				is_still_valid = true;
+-			}
++	// Drop stored scenes whose SurviveObject no longer exists (e.g. a tracker that was turned off and on again).
++	// Only the first min(scenes_cnt, N) slots hold scenes. Kept scenes are compacted to the front by swapping whole
++	// entries so each scene keeps its own pose and measurements and no meas buffer is shared or leaked.
++	size_t stored = gss->scenes_cnt < GSS_NUM_STORED_SCENES ? gss->scenes_cnt : GSS_NUM_STORED_SCENES;
++	size_t kept = 0;
++	for (size_t i = 0; i < stored; i++) {
++		bool is_still_valid = gss->scenes[i].so == so;
++		for (int j = 0; j < ctx->objs_ct && !is_still_valid; j++) {
++			is_still_valid = gss->scenes[i].so == ctx->objs[j];
+ 		}
+
+ 		if (is_still_valid) {
+-			gss->scenes[free_idx].so = gss->scenes[i].so;
+-			free_idx++;
++			if (kept != i) {
++				struct PoserDataGlobalScene tmp = gss->scenes[kept];
++				gss->scenes[kept] = gss->scenes[i];
++				gss->scenes[i] = tmp;
++			}
++			kept++;
+ 		} else {
+-			SV_WARN("in GlobalSceneSolver: deleted scene %d with SurviveObject at adress &%p", i, (void* )so);
++			SV_WARN("in GlobalSceneSolver: deleted scene %d with SurviveObject at address %p", (int)i,
++					(void *)gss->scenes[i].so);
++			gss->scenes[i].so = NULL;
+ 		}
+ 	}
+-	gss->scenes_cnt = free_idx;
++	// Only touch the ring position when something was actually removed
++	if (kept != stored)
++		gss->scenes_cnt = kept;
+
+ 	struct PoserDataGlobalScene *scene = &gss->scenes[gss->scenes_cnt % GSS_NUM_STORED_SCENES];

diff --git a/libsurvive-i686-imu-timecode.patch b/libsurvive-i686-imu-timecode.patch
deleted file mode 100644
index dab3f41..0000000
--- a/libsurvive-i686-imu-timecode.patch
+++ /dev/null
@@ -1,77 +0,0 @@
-From: Jonathan Steffan <jonathansteffan@gmail.com>
-Subject: [PATCH] driver_playback: parse IMU timecode as unsigned
-
-parse_and_run_imu() reads the IMU sample's timecode into a plain `int` via
-`sscanf(..., "%d", &timecode, ...)`. Every other timecode field in the
-.rec.gz replay format (light, sweep, sync) is correctly typed as
-survive_timecode (uint32_t) and parsed with %u; only the IMU path uses a
-signed int and %d.
-
-The recorded IMU timecode is a free-running 32-bit hardware counter, so it
-routinely exceeds INT32_MAX (2147483647) for the back half of any recording
-longer than about 45 seconds (2^31 ticks / 48MHz). On x86_64, glibc's %d
-conversion happens to round-trip these large values correctly because its
-internal accumulator is a 64-bit long; the out-of-range value is narrowed
-into the destination int via a bit-preserving truncation that gets
-reinterpreted correctly once passed on as a uint32_t. On i686, `long` is
-32 bits (same width as `int`), so the strtol-style overflow handling inside
-%d parsing saturates at LONG_MAX instead: every IMU timecode above
-INT32_MAX gets clamped to exactly 2147483647.
-
-That freezes SurviveSensorActivations::last_imu at 2147483647 for the rest
-of playback. SurviveSensorActivations_long_timecode_light() uses last_imu
-as the reference clock for a workaround that corrects for a known
-lightcap/IMU FPGA clock desync in multiples of 2^28 ticks
-(src/survive_sensor_activations.c). With last_imu stuck, that correction
-miscomputes and yanks the light timecode backward by 5 * 2^28 ticks
-(~5.58s), which trips
-`assert(tracker->model.t - t < 1)` in survive_kalman_tracker_report_state()
-and aborts the process. This is the cause of the compare-test-index,
-drone, haagh-tracking, stool-test2, tracker-bad-tracking and
-tracker-throw-compare test failures that are otherwise specific to the
-i686 build.
-
-Fix the parse to match every other timecode field: use survive_timecode
-(uint32_t) and %u.
-
-While auditing the surrounding desync-correction code, also switch
-`labs(time_sync_error)` to `llabs()`: time_sync_error is an int64_t, and
-labs() takes a `long`, which truncates it to 32 bits on i686. This did not
-reproduce any test failure on its own (DIV_ROUND_CLOSEST() already
-operates on the untruncated 64-bit value), but it is the same class of
-ILP32-vs-LP64 bug and is worth closing since it's right next to the
-timecode fix.
-
-diff --git a/src/driver_playback.c b/src/driver_playback.c
---- a/src/driver_playback.c
-+++ b/src/driver_playback.c
-@@ -222,7 +222,7 @@ static int parse_and_run_imu(const char *line, SurvivePlaybackData *driver, bo
- 		return 0;
-
- 	char dev[10];
--	int timecode = 0;
-+	survive_timecode timecode = 0;
- 	FLT accelgyro[9] = { 0 };
- 	int mask;
- 	int id;
-@@ -231,7 +231,7 @@ static int parse_and_run_imu(const char *line, SurvivePlaybackData *driver, bo
- 	char i_char = 0;
-
- 	int rr = sscanf(line,
--					"%s %c %d %d " FLT_sformat " " FLT_sformat " " FLT_sformat " " FLT_sformat " " FLT_sformat
-+					"%s %c %d %u " FLT_sformat " " FLT_sformat " " FLT_sformat " " FLT_sformat " " FLT_sformat
- 					" " FLT_sformat " " FLT_sformat " " FLT_sformat " " FLT_sformat "%d",
- 					dev, &i_char, &mask, &timecode, &accelgyro[0], &accelgyro[1], &accelgyro[2], &accelgyro[3],
- 					&accelgyro[4], &accelgyro[5], &accelgyro[6], &accelgyro[7], &accelgyro[8], &id);
-diff --git a/src/survive_sensor_activations.c b/src/survive_sensor_activations.c
---- a/src/survive_sensor_activations.c
-+++ b/src/survive_sensor_activations.c
-@@ -454,7 +454,7 @@ SURVIVE_EXPORT survive_long_timecode SurviveSensorActivations_long_timecode_li
- 	use that as a basis. It's worth noting that I've never seen a system develop this while running; it would
- 	likely cause some chaos if it did since it'd kick the kalman out of sorts.
- 	***/
--	if (self->last_imu != 0 && labs(time_sync_error) > 48000000) {
-+	if (self->last_imu != 0 && llabs(time_sync_error) > 48000000) {
- 		int64_t offset = 0x10000000;
- 		int scale = DIV_ROUND_CLOSEST(time_sync_error, offset);
- 		initial_time -= offset * scale;

diff --git a/libsurvive-system-zlib.patch b/libsurvive-system-zlib.patch
new file mode 100644
index 0000000..8e63613
--- /dev/null
+++ b/libsurvive-system-zlib.patch
@@ -0,0 +1,13 @@
+--- a/src/CMakeLists.txt
++++ b/src/CMakeLists.txt
+@@ -48,8 +48,8 @@
+     lfsr_lh2.c
+     survive_str.h survive_str.c test_cases/str.c
+     survive_async_optimizer.c
+-    ../redist/linmath.c ../redist/puff.c ../redist/symbol_enumerator.c
+-    ../redist/jsmn.c ../redist/json_helpers.c ../redist/crc32.c
++    ../redist/linmath.c ../redist/symbol_enumerator.c
++    ../redist/jsmn.c ../redist/json_helpers.c
+ )
+
+ if(USE_HIDAPI)

diff --git a/libsurvive.spec b/libsurvive.spec
index b894cb2..0fee2a7 100644
--- a/libsurvive.spec
+++ b/libsurvive.spec
@@ -1,5 +1,5 @@
-%global date 20260323
-%global commit 2f4303c76f53be1919d89d801172fddd7b09aa7a
+%global date 20261009
+%global commit 23f03665070549f0c13a6e768dfaf7764f75c417
 %global shortcommit %{sub %{commit} 1 7}
 
 # These are artifacts used by the unit tests
@@ -18,12 +18,9 @@ License:        %{shrink:
                 MIT AND
                 (MIT AND BSD-2-Clause) AND
                 Minpack AND
-                LicenseRef-Fedora-UltraPermissive AND
-                HIDAPI AND
                 ((MIT OR X11) OR BSD-3-Clause OR GPL-1.0-or-later) AND
                 (MIT AND (MIT OR X11) OR BSD-3-Clause) AND
-                (MIT AND (MIT OR X11)) AND
-                Zlib}
+                (MIT AND (MIT OR X11))}
 # License breakdown:
 # ./src/test_cases/libsurvive-extras-data/
 # ./libs/cnkalman/
@@ -33,18 +30,12 @@ License:        %{shrink:
 # License: MIT AND BSD-2-Clause
 # ./redist/mpfit/
 # License: Minpack
-# ./redist/crc32.{c,h}
-# License: LicenseRef-Fedora-UltraPermissive
-# ./redist/hid*.{c,h}
-# License: HIDAPI
 # ./redist/CNFG3D.{c,h}
 # License: (MIT OR X11) OR BSD 3-Clause OR GPL-1.0-or-later
 # ./redist/CNFG*.{c,h}
 # License: MIT AND (MIT OR X11) OR BSD 3-Clause
 # ./redist/lin*.{c,h}
 # License: MIT AND (MIT OR X11)
-# ./redist/puff.{c,h}
-# License: Zlib
 
 Source0:        %{url}/archive/%{commit}/%{name}-%{commit}.tar.gz#/%{name}-%{shortcommit}.tar.gz
 Source1:        %{extras_data_url}/archive/%{extras_data_commit}/%{name}-extras-data-%{extras_data_commit}.tar.gz#/%{name}-extras-data-%{extras_data_shortcommit}.tar.gz
@@ -53,15 +44,12 @@ Source1:        %{extras_data_url}/archive/%{extras_data_commit}/%{name}-extras-
 Patch:          %{name}-no-external-project.patch
 # Adapt eigen version detection for eigen3-5.0.0
 Patch:          %{name}-eigen3.patch
-# fopencookie's seek callback is int(void *, __off64_t *, int) on every arch;
-# using z_off_t breaks the i686 build
-# https://github.com/collabora/libsurvive/pull/368
-Patch:          %{name}-fopencookie-off64.patch
-# Replay's IMU timecode is parsed as a signed int with %%d; on i686 (32-bit
-# long) sscanf saturates at INT32_MAX for the back half of any recording,
-# freezing the lightcap/IMU desync correction and failing 6 ctest cases
-# https://github.com/collabora/libsurvive/pull/368
-Patch:          %{name}-i686-imu-timecode.patch
+# Do not build the bundled puff and crc32; zlib provides both
+Patch:          %{name}-system-zlib.patch
+# add_scenes() cleanup (f23d298) copies only the SurviveObject pointer when
+# compacting and resets the scene ring counter on every call, which feeds
+# mismatched scenes to the global solver and fails 2 ctest cases
+Patch:          %{name}-gss-scene-cleanup.patch
 
 ExclusiveArch:  aarch64 %{ix86} x86_64
 
@@ -70,6 +58,7 @@ BuildRequires:  blas-devel
 BuildRequires:  eigen3-devel
 BuildRequires:  gattlib-devel
 BuildRequires:  gcc-c++
+BuildRequires:  hidapi-devel
 BuildRequires:  lapack-devel
 BuildRequires:  libpcap-devel
 BuildRequires:  libusb1-devel
@@ -83,12 +72,11 @@ BuildRequires:  zlib-devel
 
 Provides:       bundled(CNFG3D)
 Provides:       bundled(CNFG)
-Provides:       bundled(crc32)
-Provides:       bundled(hidapi)
+Provides:       bundled(cnkalman)
+Provides:       bundled(cnmatrix)
 Provides:       bundled(jsmn)
 Provides:       bundled(linmath)
-Provides:       bundled(mpfit) = 1.24
-Provides:       bundled(zlib)
+Provides:       bundled(mpfit) = 1.3
 
 Requires:       systemd-udev
 
@@ -112,6 +100,9 @@ developing applications that use %{name}.
 # Drop bundled libraries for non-Linux platforms
 rm redist/*.m redist/dirent.windows.h
 
+# Drop bundled libraries that are provided by the system
+rm redist/hid-*.c redist/hidapi.h redist/puff.[ch] redist/crc32.[ch]
+
 # Extract test artifacts in the right places
 mkdir -p %{_vpath_builddir}/src/test_cases/libsurvive-extras-data/
 tar -xf %{SOURCE1} --strip-components 1 -C %{_vpath_builddir}/src/test_cases/%{name}-extras-data/

diff --git a/sources b/sources
index d1c0c2e..995f3a8 100644
--- a/sources
+++ b/sources
@@ -1,2 +1,2 @@
-SHA512 (libsurvive-2f4303c.tar.gz) = 2198c8b8979320ad049c21582abd95b73812d00644df1fbffb1e891fb5df3142111d35556953b77159ce9f881cd81deb4140fdf54d10c7a303d9645c4fa92d9c
+SHA512 (libsurvive-23f0366.tar.gz) = 313b0dc7dda01f8063f845167fddfd137c824bb7cfb8f38632e64fe860f7da640b497a5168876e57f7d92c93143f7e0951dfd961b88c293d270d2499c2e0c270
 SHA512 (libsurvive-extras-data-1d5bdc7.tar.gz) = 297dda3a3ff02e97656176e1423284ed472804e5abb9be536a173782335843f39657cb742d9452884ac65177b72ca0469012e986cc01630cab18f8ca5e53428e

^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2026-10-11 17:46 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-10-11 17:46 [rpms/libsurvive] rawhide: Update to latest and unbundle crc32, hidapi, mpfit, zlib Jonathan Steffan

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox