Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -38,3 +38,7 @@ test-driver
ylwrap
# A popular IDE
*.code-workspace
*/*.o
*/*.lo
*/*.a
*/*.la
41 changes: 35 additions & 6 deletions build-deb.sh
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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"
5 changes: 5 additions & 0 deletions build-debian.sh
Original file line number Diff line number Diff line change
@@ -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" "$@"
2 changes: 1 addition & 1 deletion configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
9 changes: 6 additions & 3 deletions debian/changelog
Original file line number Diff line number Diff line change
@@ -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 <pilot-link@packages.debian.org> Mon, 16 Feb 2025 12:00:00 +0000
-- Pilot Link Packagers <pilot-link@packages.debian.org> Sun, 31 May 2026 19:10:00 +0000
38 changes: 36 additions & 2 deletions debian/control
Original file line number Diff line number Diff line change
Expand Up @@ -6,21 +6,55 @@ 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
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.
9 changes: 9 additions & 0 deletions debian/libpisock-dev.install
Original file line number Diff line number Diff line change
@@ -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
1 change: 1 addition & 0 deletions debian/libpisock9.install
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
usr/lib/*/libpisock.so.9*
1 change: 1 addition & 0 deletions debian/libpisync1.install
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
usr/lib/*/libpisync.so.1*
4 changes: 4 additions & 0 deletions debian/pilot-link.install
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
usr/bin/*
usr/share/pilot-link/pix/*
usr/share/pilot-link/prc/*
usr/share/pilot-link/udev/*
2 changes: 1 addition & 1 deletion debian/rules
Original file line number Diff line number Diff line change
Expand Up @@ -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 --enable-xsltproc --disable-compile-werror
2 changes: 1 addition & 1 deletion include/pi-md5.h.in
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
#if HAVE_STDINT_H
#include <stdint.h>
#endif
#ifdef HAVE_INTTYPES_H || HAVE_STDINT_H
#if HAVE_INTTYPES_H || HAVE_STDINT_H
#define UINT8 uint8_t
#define UINT32 uint32_t
#else
Expand Down
6 changes: 3 additions & 3 deletions libpisock/pi-header.c
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
#include <stdio.h>

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
Expand All @@ -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);
Expand Down
8 changes: 5 additions & 3 deletions libpisock/serial.c
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand All @@ -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))) {
Expand Down
4 changes: 2 additions & 2 deletions src/pilot-clip.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
60 changes: 48 additions & 12 deletions src/pilot-foto.c
Original file line number Diff line number Diff line change
Expand Up @@ -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]); */
Expand All @@ -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) {
Expand All @@ -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)
Expand All @@ -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;
Expand All @@ -143,26 +164,41 @@ 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) {
/* fprintf(stderr, "Not a jpeg file\n"); */
rewind(in);
return -1;
}
fread(str, len - 2, 1, in);
if (fread(str, len - 2, 1, in) != 1) {
rewind(in);
return -1;
}
}

rewind(in);
Expand Down
8 changes: 4 additions & 4 deletions src/pilot-getrom.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)) {
Expand Down Expand Up @@ -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))
Expand Down
Loading