From bf4f123bc40426affccab3eb43eec8763bddac05 Mon Sep 17 00:00:00 2001 From: wenyuzifang Date: Mon, 29 Sep 2025 12:17:51 +0800 Subject: [PATCH] Update code from upstream --- setserial-2.17-readme.patch | 11 +++++++++++ setserial-c99.patch | 28 ++++++++++++++++++++++++++++ setserial-configure-c99.patch | 17 +++++++++++++++++ setserial-hayesesp.patch | 30 ++++++++++++++++++++++++++++++ setserial.spec | 15 ++++++++++++--- 5 files changed, 98 insertions(+), 3 deletions(-) create mode 100644 setserial-2.17-readme.patch create mode 100644 setserial-c99.patch create mode 100644 setserial-configure-c99.patch create mode 100644 setserial-hayesesp.patch diff --git a/setserial-2.17-readme.patch b/setserial-2.17-readme.patch new file mode 100644 index 0000000..28d4571 --- /dev/null +++ b/setserial-2.17-readme.patch @@ -0,0 +1,11 @@ +--- setserial-2.17/README.readme Tue Sep 11 17:59:52 2001 ++++ setserial-2.17/README Tue Sep 11 18:00:27 2001 +@@ -13,6 +13,6 @@ + + The simplest way to configure the serial ports is to copy the provided + rc.serial file to the appropriate /etc/rc.d directory. For example, +-to install rc.serial on a RedHat system, copy rc.serial to +-/etc/rc.d/init.d/serial, and then run the command "chkconfig -add serial". ++to install rc.serial on a Fedora system, copy rc.serial to ++/etc/rc.d/init.d/serial, and then run the command "chkconfig --add serial". + diff --git a/setserial-c99.patch b/setserial-c99.patch new file mode 100644 index 0000000..4dbb16b --- /dev/null +++ b/setserial-c99.patch @@ -0,0 +1,28 @@ +Avoid implicit int and implicit function declarations. + +A mostly equivalent patch has been posted upstream: + + + +diff --git a/setserial.c b/setserial.c +index f184e98db07ceb59..d181327fc568ede4 100644 +--- a/setserial.c ++++ b/setserial.c +@@ -15,6 +15,9 @@ + #include + #include + #include ++#include ++#include ++#include + + #ifdef HAVE_ASM_IOCTLS_H + #include +@@ -714,6 +717,7 @@ fprintf(stderr, "\t* port\t\tset the I/O port\n"); + exit(1); + } + ++int + main(int argc, char **argv) + { + int get_flag = 0, wild_intr_flag = 0; diff --git a/setserial-configure-c99.patch b/setserial-configure-c99.patch new file mode 100644 index 0000000..f9ed88d --- /dev/null +++ b/setserial-configure-c99.patch @@ -0,0 +1,17 @@ +This fixes a generic C99 compatibility issue in autoconf-generated +code. No need to upstream this because the issue goes away if +autoconf is re-run. + +diff --git a/configure b/configure +index 9d6084aa38e5d6e8..4d948816e1112d13 100755 +--- a/configure ++++ b/configure +@@ -689,7 +689,7 @@ cat > conftest.$ac_ext << EOF + #line 690 "configure" + #include "confdefs.h" + +-main(){return(0);} ++int main(){return(0);} + EOF + if { (eval echo configure:695: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then + ac_cv_prog_cc_works=yes diff --git a/setserial-hayesesp.patch b/setserial-hayesesp.patch new file mode 100644 index 0000000..c669d88 --- /dev/null +++ b/setserial-hayesesp.patch @@ -0,0 +1,30 @@ +diff -up setserial-2.17/setserial.c.hayesesp setserial-2.17/setserial.c +--- setserial-2.17/setserial.c.hayesesp 2010-02-15 12:20:59.104048442 +0000 ++++ setserial-2.17/setserial.c 2010-02-15 12:21:42.368924088 +0000 +@@ -356,7 +356,7 @@ void set_multiport(char *device, int fd, + } + #endif + +-#ifdef TIOCGHAYESESP ++#if defined(TIOCGHAYESESP) && defined(HAVE_LINUX_HAYESESP_H) + void print_hayesesp(int fd) + { + struct hayes_esp_config esp; +@@ -453,7 +453,7 @@ void get_serial(char *device) + print_flags(&serinfo, "\tFlags: ", ""); + printf("\n\n"); + +-#ifdef TIOCGHAYESESP ++#if defined(TIOCGHAYESESP) && defined(HAVE_LINUX_HAYESESP_H) + print_hayesesp(fd); + #endif + } else if (verbosity==0) { +@@ -593,7 +593,7 @@ void set_serial(char *device, char ** ar + } + set_multiport(device, fd, &arg); + break; +-#ifdef TIOCGHAYESESP ++#if defined(TIOCGHAYESESP) && defined(HAVE_LINUX_HAYESESP_H) + case CMD_RX_TRIG: + case CMD_TX_TRIG: + case CMD_FLOW_OFF: diff --git a/setserial.spec b/setserial.spec index e72f5c9..ea60118 100644 --- a/setserial.spec +++ b/setserial.spec @@ -1,15 +1,19 @@ -%define anolis_release 1 +%define anolis_release 2 Summary: A utility for configuring serial ports Name: setserial -Version: 2.17 +Version: 2.17 Release: %{anolis_release}%{?dist} -Source: https://sourceforge.net/projects/setserial/files/setserial/%{version}/%{name}-%{version}.tar.gz Patch0: setserial-2.17-fhs.patch Patch1: setserial-2.17-rc.patch Patch2: setserial-aarch64.patch +Patch3: setserial-configure-c99.patch +Patch4: setserial-hayesesp.patch +Patch5: setserial-c99.patch +Patch6: setserial-2.17-readme.patch License: GPL+ URL: http://setserial.sourceforge.net/ +Source0: https://sourceforge.net/projects/setserial/files/setserial/2.17/setserial-2.17.tar.gz BuildRequires: make BuildRequires: gcc @@ -62,5 +66,10 @@ make install DESTDIR=${RPM_BUILD_ROOT} %doc README rc.serial %changelog +* Mon Sep 29 2025 wenyuzifang - 2.17-2 +- Fix C99 compliance by explicitly declaring main's return type to prevent compilation errors. +- Ensure compilation succeeds by including Hayes ESP code only when required headers and macros are available. +- Ensure compliance with modern C standards, prevent undefined behavior, and enable successful compilation with strict flags. +- Fix documentation accuracy and correct command syntax to ensure proper setup of serial ports on modern systems. * Thu Mar 16 2023 Yuanhong Peng - 2.17-1 - Init from upstream -- Gitee