From e4687f8efdefa40ee1daa03d9f3427b1a41662b9 Mon Sep 17 00:00:00 2001 From: Judd Montgomery Date: Thu, 28 May 2026 22:30:36 -0400 Subject: [PATCH 1/3] update for ubuntu 26.04 --- .gitignore | 4 ++ build-deb.sh | 41 ++++++++++++++--- build-debian.sh | 5 +++ include/pi-md5.h.in | 2 +- libpisock/pi-header.c | 6 +-- libpisock/serial.c | 8 ++-- tests/packers.c | 102 +++++++++++++++++++++--------------------- 7 files changed, 104 insertions(+), 64 deletions(-) create mode 100755 build-debian.sh diff --git a/.gitignore b/.gitignore index 42e84c96..efbaa374 100644 --- a/.gitignore +++ b/.gitignore @@ -38,3 +38,7 @@ test-driver ylwrap # A popular IDE *.code-workspace +*/*.o +*/*.lo +*/*.a +*/*.la diff --git a/build-deb.sh b/build-deb.sh index 134cd5a2..f0a05425 100755 --- a/build-deb.sh +++ b/build-deb.sh @@ -1,14 +1,31 @@ #!/usr/bin/env bash # -# Build a Debian package (.deb) from the pilot-link source tree. +# Build Debian packages from the pilot-link source tree. # Run from the project root. Requires build dependencies (see debian/control). # -set -e +set -euo pipefail SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" ROOT_DIR="$(cd "$SCRIPT_DIR" && pwd)" cd "$ROOT_DIR" +sanitize_warning_error_flags() { + local token + local sanitized=() + + for token in $1; do + case "$token" in + -Werror|-Werror=*) + ;; + *) + sanitized+=("$token") + ;; + esac + done + + printf '%s ' "${sanitized[@]}" +} + # Optional: regenerate configure and Makefiles (use when building from git without committed configure) RECONFIGURE=false if [[ "${1:-}" == "--reconfigure" ]]; then @@ -37,9 +54,21 @@ fi echo "Building Debian package..." # -us: do not sign source package; -uc: do not sign .changes; -b: binary-only -# dpkg-buildflags can inject CFLAGS with "-Wformat =format-security" (space breaks the linker). -# Until this is fixed, use DEB_BUILD_MAINT_OPTIONS="hardening=-format" -# dpkg-buildpackage -us -uc -b "$@" -DEB_BUILD_MAINT_OPTIONS="hardening=-format" dpkg-buildpackage -us -uc -b "$@" +# Clear stale debhelper state so package splits/installs are recalculated cleanly. +rm -rf debian/.debhelper + +# configure.ac strips "-Werror" naively, which corrupts Debian flags like +# "-Werror=format-security" into "=format-security". Preserve the normal Debian +# flags but remove the -Werror entries before running the package build. +BUILD_CFLAGS="$(sanitize_warning_error_flags "$(dpkg-buildflags --get CFLAGS)")" +BUILD_CXXFLAGS="$(sanitize_warning_error_flags "$(dpkg-buildflags --get CXXFLAGS)")" +BUILD_CPPFLAGS="$(dpkg-buildflags --get CPPFLAGS)" +BUILD_LDFLAGS="$(dpkg-buildflags --get LDFLAGS)" + +CFLAGS="$BUILD_CFLAGS" \ +CXXFLAGS="$BUILD_CXXFLAGS" \ +CPPFLAGS="$BUILD_CPPFLAGS" \ +LDFLAGS="$BUILD_LDFLAGS" \ +dpkg-buildpackage -us -uc -b "$@" echo "Done. .deb and related files are in: $PARENT_DIR" diff --git a/build-debian.sh b/build-debian.sh new file mode 100755 index 00000000..16c7088c --- /dev/null +++ b/build-debian.sh @@ -0,0 +1,5 @@ +#!/usr/bin/env bash +set -euo pipefail + +SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" +exec "$SCRIPT_DIR/build-deb.sh" "$@" diff --git a/include/pi-md5.h.in b/include/pi-md5.h.in index 1cf3cbea..8f6fafb6 100644 --- a/include/pi-md5.h.in +++ b/include/pi-md5.h.in @@ -22,7 +22,7 @@ #if HAVE_STDINT_H #include #endif -#ifdef HAVE_INTTYPES_H || HAVE_STDINT_H +#if HAVE_INTTYPES_H || HAVE_STDINT_H #define UINT8 uint8_t #define UINT32 uint32_t #else diff --git a/libpisock/pi-header.c b/libpisock/pi-header.c index 9c9ae139..892ce034 100644 --- a/libpisock/pi-header.c +++ b/libpisock/pi-header.c @@ -29,7 +29,7 @@ #include void print_splash(const char *progname) { - char *patchlevel = ""; + const char *patchlevel = ""; fprintf(stderr, " DEPRECATED: The application is calling print_splash()\n"); #ifdef PILOT_LINK_PATCH @@ -41,9 +41,9 @@ void print_splash(const char *progname) { " `--------------------------------------------'\n" " This is %s, from pilot-link version %d.%d.%d%s\n\n" " Build target..: %s\n" - " Build date....: %s %s\n\n", + " Build date....: unavailable\n\n", progname, PILOT_LINK_VERSION, PILOT_LINK_MAJOR, PILOT_LINK_MINOR, - patchlevel, HOST_OS, __DATE__, __TIME__); + patchlevel, HOST_OS); printf(" pilot-link %d.%d.%d%s is covered under the GPL/LGPL\n", PILOT_LINK_VERSION, PILOT_LINK_MAJOR, PILOT_LINK_MINOR, patchlevel); diff --git a/libpisock/serial.c b/libpisock/serial.c index 0219937b..85bce10e 100644 --- a/libpisock/serial.c +++ b/libpisock/serial.c @@ -373,8 +373,10 @@ pi_serial_bind(pi_socket_t *ps, struct sockaddr *addr, size_t addrlen) char realport[4096]; # endif /* PATH_MAX */ #endif /* MAXPATHLEN */ + const char *port_for_messages = pa->pi_device; - realpath(pa->pi_device, realport); + if (realpath(pa->pi_device, realport) != NULL) + port_for_messages = realport; errno = save_errno; if (errno == ENOENT) { @@ -387,10 +389,10 @@ pi_serial_bind(pi_socket_t *ps, struct sockaddr *addr, size_t addrlen) } else if (errno == EACCES) { LOG((PI_DBG_DEV, PI_DBG_LVL_ERR, " Please check the " - "permissions on %s..\n", realport)); + "permissions on %s..\n", port_for_messages)); LOG((PI_DBG_DEV, PI_DBG_LVL_ERR, " Possible solution:\n\n\tchmod 0666 " - "%s\n\n", realport)); + "%s\n\n", port_for_messages)); } else if (errno == ENODEV) { while (count <= 5) { if (isatty(fileno(stdout))) { diff --git a/tests/packers.c b/tests/packers.c index 523f2d52..4b6c9f02 100644 --- a/tests/packers.c +++ b/tests/packers.c @@ -104,7 +104,7 @@ int test_memo() if (l != sizeof(MemoAppBlock)) { errors++; printf - ("1: unpack_MemoAppInfo returned incorrect length (got %d, expected %d)\n", + ("1: unpack_MemoAppInfo returned incorrect length (got %d, expected %zu)\n", l, sizeof(MemoAppBlock)); } @@ -113,7 +113,7 @@ int test_memo() if (l != sizeof(MemoAppBlock)) { errors++; printf - ("2: unpack_MemoAppInfo returned incorrect length (got %d, expected %d)\n", + ("2: unpack_MemoAppInfo returned incorrect length (got %d, expected %zu)\n", l, sizeof(MemoAppBlock)); } @@ -142,7 +142,7 @@ int test_memo() if (l != sizeof(MemoAppBlock)) { errors++; printf - ("5: unpack_MemoAppInfo returned incorrect length (got %d, expected %d)\n", + ("5: unpack_MemoAppInfo returned incorrect length (got %d, expected %zu)\n", l, sizeof(MemoAppBlock)); } @@ -206,7 +206,7 @@ int test_memo() if (l != sizeof(MemoAppBlock)) { errors++; printf - ("7: pack_MemoAppInfo returned incorrect allocation length (got %d, expected %d)\n", + ("7: pack_MemoAppInfo returned incorrect allocation length (got %d, expected %zu)\n", l, sizeof(MemoAppBlock)); } @@ -231,7 +231,7 @@ int test_memo() if (l != sizeof(MemoAppBlock)) { errors++; printf - ("10: pack_MemoAppInfo returned incorrect length (got %d, expected %d)\n", + ("10: pack_MemoAppInfo returned incorrect length (got %d, expected %zu)\n", l, sizeof(MemoAppBlock)); } @@ -272,7 +272,7 @@ int test_memo() if (RecordBuffer->used != sizeof(MemoRecord)) { errors++; printf - ("15: pack_MemoRecord returned incorrect allocation length (got %d, expected %d)\n", + ("15: pack_MemoRecord returned incorrect allocation length (got %zu, expected %zu)\n", RecordBuffer->used, sizeof(MemoRecord)); } @@ -353,7 +353,7 @@ int test_address() if (l != sizeof(AddressAppBlock)) { errors++; printf - ("1: unpack_AddressAppInfo returned incorrect length (got %d, expected %d)\n", + ("1: unpack_AddressAppInfo returned incorrect length (got %d, expected %zu)\n", l, sizeof(AddressAppBlock)); } @@ -364,7 +364,7 @@ int test_address() if (l != sizeof(AddressAppBlock)) { errors++; printf - ("2: unpack_AddressAppInfo returned incorrect length (got %d, expected %d)\n", + ("2: unpack_AddressAppInfo returned incorrect length (got %d, expected %zu)\n", l, sizeof(AddressAppBlock)); } @@ -397,7 +397,7 @@ int test_address() if (l != sizeof(AddressAppBlock)) { errors++; printf - ("5: unpack_AddressAppInfo returned incorrect length (got %d, expected %d)\n", + ("5: unpack_AddressAppInfo returned incorrect length (got %d, expected %zu)\n", l, sizeof(AddressAppBlock)); } @@ -459,7 +459,7 @@ int test_address() if (l != sizeof(AddressAppBlock)) { errors++; printf - ("7: pack_AddressAppInfo returned incorrect allocation length (got %d, expected %d)\n", + ("7: pack_AddressAppInfo returned incorrect allocation length (got %d, expected %zu)\n", l, sizeof(AddressAppBlock)); } @@ -485,7 +485,7 @@ int test_address() if (l != sizeof(AddressAppBlock)) { errors++; printf - ("10: pack_AddressAppInfo returned incorrect length (got %d, expected %d)\n", + ("10: pack_AddressAppInfo returned incorrect length (got %d, expected %zu)\n", l, sizeof(AddressAppBlock)); } @@ -535,7 +535,7 @@ int test_address() if (RecordBuffer->used != sizeof(AddressRecord)) { errors++; printf - ("15: pack_Address returned incorrect length (got %d, expected %d)\n", + ("15: pack_Address returned incorrect length (got %zu, expected %zu)\n", RecordBuffer->used, sizeof(AddressRecord)); } @@ -599,7 +599,7 @@ int test_appointment() if (l != sizeof(AppointmentAppBlock)) { errors++; printf - ("1: unpack_AppointmentAppInfo returned incorrect length (got %d, expected %d)\n", + ("1: unpack_AppointmentAppInfo returned incorrect length (got %d, expected %zu)\n", l, sizeof(AppointmentAppBlock)); } @@ -610,7 +610,7 @@ int test_appointment() if (l != sizeof(AppointmentAppBlock)) { errors++; printf - ("2: unpack_AppointmentAppInfo returned incorrect length (got %d, expected %d)\n", + ("2: unpack_AppointmentAppInfo returned incorrect length (got %d, expected %zu)\n", l, sizeof(AppointmentAppBlock)); } @@ -643,7 +643,7 @@ int test_appointment() if (l != sizeof(AppointmentAppBlock)) { errors++; printf - ("5: unpack_AppointmentAppInfo returned incorrect length (got %d, expected %d)\n", + ("5: unpack_AppointmentAppInfo returned incorrect length (got %d, expected %zu)\n", l, sizeof(AppointmentAppBlock)); } @@ -708,7 +708,7 @@ int test_appointment() if (l != sizeof(AppointmentAppBlock)) { errors++; printf - ("7: pack_AppointmentAppInfo returned incorrect allocation length (got %d, expected %d)\n", + ("7: pack_AppointmentAppInfo returned incorrect allocation length (got %d, expected %zu)\n", l, sizeof(AppointmentAppBlock)); } @@ -734,7 +734,7 @@ int test_appointment() if (l != sizeof(AppointmentAppBlock)) { errors++; printf - ("10: pack_AppointmentAppInfo returned incorrect length (got %d, expected %d)\n", + ("10: pack_AppointmentAppInfo returned incorrect length (got %d, expected %zu)\n", l, sizeof(AppointmentAppBlock)); } @@ -786,7 +786,7 @@ int test_appointment() if (RecordBuffer->used != sizeof(AppointmentRecord)) { errors++; printf - ("15: pack_Appointment returned incorrect length (got %d, expected %d)\n", + ("15: pack_Appointment returned incorrect length (got %zu, expected %zu)\n", RecordBuffer->used, sizeof(AppointmentRecord)); } @@ -842,7 +842,7 @@ int test_todo() if (l != sizeof(ToDoAppBlock)) { errors++; printf - ("1: unpack_ToDoAppInfo returned incorrect length (got %d, expected %d)\n", + ("1: unpack_ToDoAppInfo returned incorrect length (got %d, expected %zu)\n", l, sizeof(ToDoAppBlock)); } @@ -851,7 +851,7 @@ int test_todo() if (l != sizeof(ToDoAppBlock)) { errors++; printf - ("2: unpack_ToDoAppInfo returned incorrect length (got %d, expected %d)\n", + ("2: unpack_ToDoAppInfo returned incorrect length (got %d, expected %zu)\n", l, sizeof(ToDoAppBlock)); } @@ -878,7 +878,7 @@ int test_todo() if (l != sizeof(ToDoAppBlock)) { errors++; printf - ("5: unpack_ToDoAppInfo returned incorrect length (got %d, expected %d)\n", + ("5: unpack_ToDoAppInfo returned incorrect length (got %d, expected %zu)\n", l, sizeof(ToDoAppBlock)); } @@ -942,7 +942,7 @@ int test_todo() if (l != sizeof(ToDoAppBlock)) { errors++; printf - ("7: pack_ToDoAppInfo returned incorrect allocation length (got %d, expected %d)\n", + ("7: pack_ToDoAppInfo returned incorrect allocation length (got %d, expected %zu)\n", l, sizeof(ToDoAppBlock)); } @@ -967,7 +967,7 @@ int test_todo() if (l != sizeof(ToDoAppBlock)) { errors++; printf - ("10: pack_ToDoAppInfo returned incorrect length (got %d, expected %d)\n", + ("10: pack_ToDoAppInfo returned incorrect length (got %d, expected %zu)\n", l, sizeof(ToDoAppBlock)); } @@ -1021,8 +1021,8 @@ int test_todo() if (RecordBuffer->used != sizeof(ToDoRecord)) { errors++; printf - ("15: pack_ToDo returned incorrect length (got %d, expected %d)\n", - l, sizeof(ToDoRecord)); + ("15: pack_ToDo returned incorrect length (got %zu, expected %zu)\n", + RecordBuffer->used, sizeof(ToDoRecord)); } if (memcmp(RecordBuffer->data, ToDoRecord, sizeof(ToDoRecord))) { @@ -1087,7 +1087,7 @@ int test_expense() if (l != sizeof(ExpenseAppBlock)) { errors++; printf - ("1: unpack_ExpenseAppInfo returned incorrect length (got %d, expected %d)\n", + ("1: unpack_ExpenseAppInfo returned incorrect length (got %d, expected %zu)\n", l, sizeof(ExpenseAppBlock)); } @@ -1098,7 +1098,7 @@ int test_expense() if (l != sizeof(ExpenseAppBlock)) { errors++; printf - ("2: unpack_ExpenseAppInfo returned incorrect length (got %d, expected %d)\n", + ("2: unpack_ExpenseAppInfo returned incorrect length (got %d, expected %zu)\n", l, sizeof(ExpenseAppBlock)); } @@ -1116,7 +1116,7 @@ int test_expense() if (l != sizeof(ExpenseAppBlock)) { errors++; printf - ("3: unpack_ExpenseAppInfo returned incorrect length (got %d, expected %d)\n", + ("3: unpack_ExpenseAppInfo returned incorrect length (got %d, expected %zu)\n", l, sizeof(ExpenseAppBlock)); } @@ -1181,7 +1181,7 @@ int test_expense() if (l != sizeof(ExpenseAppBlock)) { errors++; printf - ("5: pack_ExpenseAppInfo returned incorrect allocation length (got %d, expected %d)\n", + ("5: pack_ExpenseAppInfo returned incorrect allocation length (got %d, expected %zu)\n", l, sizeof(ExpenseAppBlock)); } @@ -1207,7 +1207,7 @@ int test_expense() if (l != sizeof(ExpenseAppBlock)) { errors++; printf - ("8: pack_ExpenseAppInfo returned incorrect length (got %d, expected %d)\n", + ("8: pack_ExpenseAppInfo returned incorrect length (got %d, expected %zu)\n", l, sizeof(ExpenseAppBlock)); } @@ -1230,7 +1230,7 @@ int test_expense() if (l != sizeof(ExpenseRecord)) { errors++; printf - ("11: unpack_Expense returned incorrect length (got %d, expected %d)\n", + ("11: unpack_Expense returned incorrect length (got %d, expected %zu)\n", l, sizeof(ExpenseRecord)); } @@ -1257,7 +1257,7 @@ int test_expense() if (l != sizeof(ExpenseRecord)) { errors++; printf - ("13: pack_Expense returned incorrect allocation length (got %d, expected %d)\n", + ("13: pack_Expense returned incorrect allocation length (got %d, expected %zu)\n", l, sizeof(ExpenseRecord)); } @@ -1282,7 +1282,7 @@ int test_expense() if (l != sizeof(ExpenseRecord)) { errors++; printf - ("16: pack_Expense returned incorrect length (got %d, expected %d)\n", + ("16: pack_Expense returned incorrect length (got %d, expected %zu)\n", l, sizeof(ExpenseRecord)); } @@ -1348,7 +1348,7 @@ int test_mail() if (l != sizeof(MailAppBlock)) { errors++; printf - ("1: unpack_MailAppInfo returned incorrect length (got %d, expected %d)\n", + ("1: unpack_MailAppInfo returned incorrect length (got %d, expected %zu)\n", l, sizeof(MailAppBlock)); } @@ -1357,7 +1357,7 @@ int test_mail() if (l != sizeof(MailAppBlock)) { errors++; printf - ("2: unpack_MailAppInfo returned incorrect length (got %d, expected %d)\n", + ("2: unpack_MailAppInfo returned incorrect length (got %d, expected %zu)\n", l, sizeof(MailAppBlock)); } @@ -1373,7 +1373,7 @@ int test_mail() if (l != sizeof(MailAppBlock)) { errors++; printf - ("3: unpack_MailAppInfo returned incorrect length (got %d, expected %d)\n", + ("3: unpack_MailAppInfo returned incorrect length (got %d, expected %zu)\n", l, sizeof(MailAppBlock)); } @@ -1438,7 +1438,7 @@ int test_mail() if (l != sizeof(MailAppBlock)) { errors++; printf - ("5: pack_MailAppInfo returned incorrect allocation length (got %d, expected %d)\n", + ("5: pack_MailAppInfo returned incorrect allocation length (got %d, expected %zu)\n", l, sizeof(MailAppBlock)); } @@ -1463,7 +1463,7 @@ int test_mail() if (l != sizeof(MailAppBlock)) { errors++; printf - ("8: pack_MailAppInfo returned incorrect length (got %d, expected %d)\n", + ("8: pack_MailAppInfo returned incorrect length (got %d, expected %zu)\n", l, sizeof(MailAppBlock)); } @@ -1486,7 +1486,7 @@ int test_mail() if (l != sizeof(MailRecord)) { errors++; printf - ("11: unpack_Mail returned incorrect length (got %d, expected %d)\n", + ("11: unpack_Mail returned incorrect length (got %d, expected %zu)\n", l, sizeof(MailRecord)); } @@ -1513,7 +1513,7 @@ int test_mail() if (l != sizeof(MailRecord)) { errors++; printf - ("13: pack_Mail returned incorrect allocation length (got %d, expected %d)\n", + ("13: pack_Mail returned incorrect allocation length (got %d, expected %zu)\n", l, sizeof(MailRecord)); } @@ -1537,7 +1537,7 @@ int test_mail() if (l != sizeof(MailRecord)) { errors++; printf - ("16: pack_Mail returned incorrect length (got %d, expected %d)\n", + ("16: pack_Mail returned incorrect length (got %d, expected %zu)\n", l, sizeof(MailRecord)); } @@ -1561,7 +1561,7 @@ int test_mail() if (l != sizeof(MailSyncPreference)) { errors++; printf - ("19: unpack_MailSyncPref returned incorrect length (got %d, expected %d)\n", + ("19: unpack_MailSyncPref returned incorrect length (got %d, expected %zu)\n", l, sizeof(MailSyncPreference)); } @@ -1572,7 +1572,7 @@ int test_mail() if (l != sizeof(MailSyncPreference)) { errors++; printf - ("20: unpack_MailSyncPref returned incorrect length (got %d, expected %d)\n", + ("20: unpack_MailSyncPref returned incorrect length (got %d, expected %zu)\n", l, sizeof(MailSyncPreference)); } @@ -1583,7 +1583,7 @@ int test_mail() if (l != sizeof(MailSyncPreference)) { errors++; printf - ("21: unpack_MailSyncPref returned incorrect length (got %d, expected %d)\n", + ("21: unpack_MailSyncPref returned incorrect length (got %d, expected %zu)\n", l, sizeof(MailSyncPreference)); } @@ -1610,7 +1610,7 @@ int test_mail() if (l != sizeof(MailSyncPreference)) { errors++; printf - ("23: pack_MailSyncPref returned incorrect allocation length (got %d, expected %d)\n", + ("23: pack_MailSyncPref returned incorrect allocation length (got %d, expected %zu)\n", l, sizeof(MailSyncPreference)); } @@ -1636,7 +1636,7 @@ int test_mail() if (l != sizeof(MailSyncPreference)) { errors++; printf - ("26: pack_MailSyncPref returned incorrect length (got %d, expected %d)\n", + ("26: pack_MailSyncPref returned incorrect length (got %d, expected %zu)\n", l, sizeof(MailSyncPreference)); } @@ -1662,7 +1662,7 @@ int test_mail() if (l != sizeof(MailSigPreference)) { errors++; printf - ("29: unpack_MailSigPref returned incorrect length (got %d, expected %d)\n", + ("29: unpack_MailSigPref returned incorrect length (got %d, expected %zu)\n", l, sizeof(MailSyncPreference)); } @@ -1673,7 +1673,7 @@ int test_mail() if (l != sizeof(MailSigPreference)) { errors++; printf - ("30: unpack_MailSigPref returned incorrect length (got %d, expected %d)\n", + ("30: unpack_MailSigPref returned incorrect length (got %d, expected %zu)\n", l, sizeof(MailSyncPreference)); } @@ -1684,7 +1684,7 @@ int test_mail() if (l != sizeof(MailSigPreference)) { errors++; printf - ("31: unpack_MailSigPref returned incorrect length (got %d, expected %d)\n", + ("31: unpack_MailSigPref returned incorrect length (got %d, expected %zu)\n", l, sizeof(MailSyncPreference)); } @@ -1711,7 +1711,7 @@ int test_mail() if (l != sizeof(MailSigPreference)) { errors++; printf - ("33: pack_MailSignaturePref returned incorrect allocation length (got %d, expected %d)\n", + ("33: pack_MailSignaturePref returned incorrect allocation length (got %d, expected %zu)\n", l, sizeof(MailSigPreference)); } @@ -1737,7 +1737,7 @@ int test_mail() if (l != sizeof(MailSigPreference)) { errors++; printf - ("36: pack_MailSignaturePref returned incorrect length (got %d, expected %d)\n", + ("36: pack_MailSignaturePref returned incorrect length (got %d, expected %zu)\n", l, sizeof(MailSigPreference)); } From 50f0c01b0578a3d6c6ae084b871ba8b25ef5420b Mon Sep 17 00:00:00 2001 From: Judd Montgomery Date: Sun, 31 May 2026 16:20:45 -0400 Subject: [PATCH 2/3] Restore split Debian packages and conduit tool builds Reinstate the libpisock/libpisync development and runtime packages, and fix the Debian build configuration so the split packages build cleanly again. --- configure.ac | 2 +- debian/changelog | 9 ++++-- debian/control | 36 ++++++++++++++++++++-- debian/libpisock-dev.install | 9 ++++++ debian/libpisock9.install | 1 + debian/libpisync1.install | 1 + debian/pilot-link.install | 4 +++ debian/rules | 2 +- src/pilot-clip.c | 4 +-- src/pilot-foto.c | 60 ++++++++++++++++++++++++++++-------- src/pilot-getrom.c | 8 ++--- 11 files changed, 111 insertions(+), 25 deletions(-) create mode 100644 debian/libpisock-dev.install create mode 100644 debian/libpisock9.install create mode 100644 debian/libpisync1.install create mode 100644 debian/pilot-link.install diff --git a/configure.ac b/configure.ac index 61135c85..87d85335 100644 --- a/configure.ac +++ b/configure.ac @@ -796,7 +796,7 @@ dnl (already done) enable_werror=no AC_ARG_ENABLE(compile-werror, [ --enable-compile-werror Causes warnings to be treated as errors in GCC], - enable_werror=yes) + [enable_werror="$enableval"]) if test "x$GCC" = "xyes" -a "x$enable_werror" = "xyes"; then CFLAGS="$CFLAGS -Werror" fi diff --git a/debian/changelog b/debian/changelog index 6ad270ae..2abe2b2e 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,5 +1,8 @@ -pilot-link (0.13.1-1) unstable; urgency=medium +pilot-link (0.13.1-2) unstable; urgency=medium - * Initial Debian package. + * Split the Debian packaging into runtime, development, and tool + packages. + * Enable conduit builds so the pilot-link command-line tools are + installed in the binary package. - -- Pilot Link Packagers Mon, 16 Feb 2025 12:00:00 +0000 + -- Pilot Link Packagers Sun, 31 May 2026 19:10:00 +0000 diff --git a/debian/control b/debian/control index 8a8bcced..31e9ccd6 100644 --- a/debian/control +++ b/debian/control @@ -16,11 +16,43 @@ Vcs-Browser: https://github.com/desrod/pilot-link Vcs-Git: https://github.com/desrod/pilot-link.git Rules-Requires-Root: no +Package: libpisock9 +Architecture: any +Depends: ${shlibs:Depends}, ${misc:Depends} +Breaks: pilot-link (<< 0.13.1-2) +Replaces: pilot-link (<< 0.13.1-2) +Description: Palm OS communication library + libpisock provides the core library used by pilot-link to communicate + with Palm handhelds over serial, USB, and network transports. + +Package: libpisync1 +Architecture: any +Depends: ${shlibs:Depends}, ${misc:Depends} +Breaks: pilot-link (<< 0.13.1-2) +Replaces: pilot-link (<< 0.13.1-2) +Description: Palm OS synchronization helper library + libpisync provides synchronization helpers built on top of libpisock + for Palm handheld data exchange. + +Package: libpisock-dev +Section: libdevel +Architecture: any +Depends: + libpisock9 (= ${binary:Version}), + libpisync1 (= ${binary:Version}), + ${misc:Depends} +Breaks: pilot-link (<< 0.13.1-2) +Replaces: pilot-link (<< 0.13.1-2) +Description: Development files for the pilot-link libraries + This package contains the headers, linker symlinks, pkg-config metadata, + and static libraries needed to build software against libpisock and + libpisync. + Package: pilot-link Architecture: any Depends: ${shlibs:Depends}, ${misc:Depends} -Description: Tools and library for Palm PDA communication +Description: Tools for Palm PDA communication pilot-link is a suite of tools for communicating with Palm handheld devices over serial, USB, and network connections. It includes command-line utilities for installing applications, syncing data, - and managing the device, plus the libpisock and libpisync libraries. + and managing the device. diff --git a/debian/libpisock-dev.install b/debian/libpisock-dev.install new file mode 100644 index 00000000..e25fdf63 --- /dev/null +++ b/debian/libpisock-dev.install @@ -0,0 +1,9 @@ +usr/include/* +usr/lib/*/libpisock.a +usr/lib/*/libpisock.la +usr/lib/*/libpisock.so +usr/lib/*/libpisync.a +usr/lib/*/libpisync.la +usr/lib/*/libpisync.so +usr/lib/*/pkgconfig/pilot-link.pc +usr/share/aclocal/pilot-link.m4 diff --git a/debian/libpisock9.install b/debian/libpisock9.install new file mode 100644 index 00000000..ecf15422 --- /dev/null +++ b/debian/libpisock9.install @@ -0,0 +1 @@ +usr/lib/*/libpisock.so.9* diff --git a/debian/libpisync1.install b/debian/libpisync1.install new file mode 100644 index 00000000..07dff854 --- /dev/null +++ b/debian/libpisync1.install @@ -0,0 +1 @@ +usr/lib/*/libpisync.so.1* diff --git a/debian/pilot-link.install b/debian/pilot-link.install new file mode 100644 index 00000000..bdc7533b --- /dev/null +++ b/debian/pilot-link.install @@ -0,0 +1,4 @@ +usr/bin/* +usr/share/pilot-link/pix/* +usr/share/pilot-link/prc/* +usr/share/pilot-link/udev/* diff --git a/debian/rules b/debian/rules index bcaef18b..ee8eb9a4 100755 --- a/debian/rules +++ b/debian/rules @@ -6,4 +6,4 @@ export DH_VERBOSE = 1 dh $@ override_dh_auto_configure: - dh_auto_configure -- --prefix=/usr + dh_auto_configure -- --prefix=/usr --enable-conduits --disable-compile-werror diff --git a/src/pilot-clip.c b/src/pilot-clip.c index 5e5b4965..64f81cd4 100644 --- a/src/pilot-clip.c +++ b/src/pilot-clip.c @@ -188,8 +188,8 @@ int main(int argc, const char *argv[]) b = GetClip(sd, 0, &ret); if (b == NULL) goto error_close; - if (ret > 0) - write(fileno(stdout), b, ret); + if (ret > 0 && write(fileno(stdout), b, ret) != ret) + goto error_close; } if (pi_close(sd) < 0) diff --git a/src/pilot-foto.c b/src/pilot-foto.c index 412ce452..3756f2cd 100644 --- a/src/pilot-foto.c +++ b/src/pilot-foto.c @@ -85,9 +85,15 @@ int get_jpg_info(FILE * in, char *type, unsigned short *version, rewind(in); /* marker identifier, application use marker */ - fread(&word, 2, 1, in); + if (fread(&word, 2, 1, in) != 1) { + rewind(in); + return -1; + } word1 = htons(word); - fread(&word, 2, 1, in); + if (fread(&word, 2, 1, in) != 1) { + rewind(in); + return -1; + } word2 = htons(word); /* printf("start of image 0x%02x 0x%02x\n", str[0], str[1]); */ /* printf("application use marker 0x%02x 0x%02x\n", str[2], str[3]); */ @@ -101,7 +107,10 @@ int get_jpg_info(FILE * in, char *type, unsigned short *version, *height = *width = -1; /* length of application block */ - fread(&word, 2, 1, in); + if (fread(&word, 2, 1, in) != 1) { + rewind(in); + return -1; + } len = htons(word); /* printf("len %d\n", len); */ if (len > 65535) { @@ -110,7 +119,10 @@ int get_jpg_info(FILE * in, char *type, unsigned short *version, return -1; } - fread(str, 5, 1, in); + if (fread(str, 5, 1, in) != 1) { + rewind(in); + return -1; + } str[6] = '\0'; /* printf("%s\n", str); */ if (strncmp(str, "JFIF", 4) && strncmp(str, "Exif", 4) @@ -123,18 +135,27 @@ int get_jpg_info(FILE * in, char *type, unsigned short *version, type[4] = '\0'; /* Version */ - fread(&word, 2, 1, in); + if (fread(&word, 2, 1, in) != 1) { + rewind(in); + return -1; + } *version = htons(word); /* printf("version %d.%02d\n", ((*version)&0xFF00)>>8, (*version)&0xFF); */ - fread(str, len - 9, 1, in); + if (fread(str, len - 9, 1, in) != 1) { + rewind(in); + return -1; + } /* Units 1 byte * X and Y density, 1 byte each * X and Y thumbnail size, 2 bytes each */ while (!feof(in)) { /* marker identifier */ - fread(&word, 2, 1, in); + if (fread(&word, 2, 1, in) != 1) { + rewind(in); + return -1; + } word1 = htons(word); m1 = (word1 & 0xFF00) >> 8; m2 = word1 & 0xFF; @@ -143,18 +164,30 @@ int get_jpg_info(FILE * in, char *type, unsigned short *version, if ((m1 == 0xFF) && (m2 == 0xC0)) { /* The SOF0 marker (Start of Frame 0) */ /* length(2 bytes) and data precision(1 byte) */ - fread(str, 3, 1, in); + if (fread(str, 3, 1, in) != 1) { + rewind(in); + return -1; + } /* Height */ - fread(&word, 2, 1, in); + if (fread(&word, 2, 1, in) != 1) { + rewind(in); + return -1; + } *height = htons(word); /* printf("height %d\n", *height); */ /* Width */ - fread(&word, 2, 1, in); + if (fread(&word, 2, 1, in) != 1) { + rewind(in); + return -1; + } *width = htons(word); /* printf("width %d\n", *width); */ break; } - fread(&word, 2, 1, in); + if (fread(&word, 2, 1, in) != 1) { + rewind(in); + return -1; + } len = htons(word); /* printf("len %d\n", len); */ if (len > 65535) { @@ -162,7 +195,10 @@ int get_jpg_info(FILE * in, char *type, unsigned short *version, rewind(in); return -1; } - fread(str, len - 2, 1, in); + if (fread(str, len - 2, 1, in) != 1) { + rewind(in); + return -1; + } } rewind(in); diff --git a/src/pilot-getrom.c b/src/pilot-getrom.c index 90386dbb..a263d8e7 100644 --- a/src/pilot-getrom.c +++ b/src/pilot-getrom.c @@ -175,8 +175,8 @@ int do_get_rom(int sd,const char *filename) break; if (j == len) lseek(file, len, SEEK_CUR); - else - write(file, buffer, len); + else if (write(file, buffer, len) != len) + goto cancel; offset += len; if (cancel || !(i++ % 8)) if (cancel || (dlp_OpenConduit(sd) < 0)) { @@ -303,8 +303,8 @@ int do_get_ram(int sd, const char *filename) break; if (j == len) lseek(file, len, SEEK_CUR); - else - write(file, buffer, len); + else if (write(file, buffer, len) != len) + goto cancel; offset += len; if (cancel || !(i++ % 4)) From 8cb4581e3216992ae90eb88b1814e55b20cb0896 Mon Sep 17 00:00:00 2001 From: Judd Montgomery Date: Sun, 31 May 2026 21:52:25 -0400 Subject: [PATCH 3/3] enable docbook-xsl for build-deb.sh --- debian/control | 2 ++ debian/rules | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/debian/control b/debian/control index 31e9ccd6..1d776401 100644 --- a/debian/control +++ b/debian/control @@ -6,10 +6,12 @@ Build-Depends: debhelper-compat (= 13), dh-autoreconf, autotools-dev, + docbook-xsl, libpng-dev, libpopt-dev, libreadline-dev, libusb-dev, + xsltproc, Standards-Version: 4.6.2 Homepage: https://github.com/desrod/pilot-link Vcs-Browser: https://github.com/desrod/pilot-link diff --git a/debian/rules b/debian/rules index ee8eb9a4..905b3e99 100755 --- a/debian/rules +++ b/debian/rules @@ -6,4 +6,4 @@ export DH_VERBOSE = 1 dh $@ override_dh_auto_configure: - dh_auto_configure -- --prefix=/usr --enable-conduits --disable-compile-werror + dh_auto_configure -- --prefix=/usr --enable-conduits --enable-xsltproc --disable-compile-werror