[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#843552: marked as done (Replace signal by sigaction.)



Your message dated Sun, 26 Feb 2023 21:22:38 +0000
with message-id <CAD9L4rdwe49BO-myrfQz3aAg1KAMehhnq-=jQ2QkrEw7kVk9-g@mail.gmail.com>
and subject line Re: Replace signal by sigaction.
has caused the Debian Bug report #843552,
regarding Replace signal by sigaction.
to be marked as done.

This means that you claim that the problem has been dealt with.
If this is not the case it is now your responsibility to reopen the
Bug report if necessary, and/or fix the problem forthwith.

(NB: If you are a system administrator and have no idea what this
message is talking about, this may indicate a serious mail system
misconfiguration somewhere. Please contact owner@bugs.debian.org
immediately.)


-- 
843552: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=843552
Debian Bug Tracking System
Contact owner@bugs.debian.org with problems
--- Begin Message ---
Source: netkit-telnet
Version: 0.17-40
Tags: patch
User: helmutg@debian.org
Usertags: rebootstrap

netkit-telnet fails to cross build from source, the apparent failure is
using the build architecture compiler, which is easily fixed by passing
the right CC and CXX variables to configure. However, configure tries to
run host architecture executables, so those checks have to be updated as
well. The check for signal behaviour can be eliminated by relying on the
sigaction, which has well-defined behaviour. For the other checks,
executing simply is not necessary. Please consider applying my patch.

Helmut
diff --minimal -Nru netkit-telnet-0.17/debian/changelog netkit-telnet-0.17/debian/changelog
--- netkit-telnet-0.17/debian/changelog	2015-04-27 22:39:57.000000000 +0200
+++ netkit-telnet-0.17/debian/changelog	2016-08-29 19:04:12.000000000 +0200
@@ -1,3 +1,14 @@
+netkit-telnet (0.17-40.1) UNRELEASED; urgency=medium
+
+  * Non-maintainer upload.
+  * Fix FTCBFS: Closes: #-1
+    + Pass CC and CXX to configure.
+    + 150-signal.diff: Use sigaction instead of signal to avoid configure
+      check.
+    + 151-cross_configure.diff: Don't run host arch executables.
+
+ -- Helmut Grohne <helmut@subdivi.de>  Mon, 29 Aug 2016 12:13:10 +0200
+
 netkit-telnet (0.17-40) unstable; urgency=low
 
   * Bring in package changes from experimental to unstable.
diff --minimal -Nru netkit-telnet-0.17/debian/patches/150-signal.diff netkit-telnet-0.17/debian/patches/150-signal.diff
--- netkit-telnet-0.17/debian/patches/150-signal.diff	1970-01-01 01:00:00.000000000 +0100
+++ netkit-telnet-0.17/debian/patches/150-signal.diff	2016-08-29 18:58:04.000000000 +0200
@@ -0,0 +1,215 @@
+Description: use sigaction instead of signal
+Author: Helmut Grohne <helmut@subdivi.de>
+Last Update: 2016-08-29
+
+The semantics of signal are not well defined (System V vs. BSD). Rather than
+trying to figure out how it works (which doesn't work for cross compilation),
+use sigaction.
+
+Index: netkit-telnet-0.17/telnet/commands.cc
+===================================================================
+--- netkit-telnet-0.17.orig/telnet/commands.cc
++++ netkit-telnet-0.17/telnet/commands.cc
+@@ -2013,8 +2013,11 @@
+ 	putchar('\n');
+     } 
+     else {
+-	signal(SIGINT, SIG_DFL);
+-	signal(SIGQUIT, SIG_DFL);
++	struct sigaction sigact = {};
++	sigact.sa_handler = SIG_DFL;
++	sigact.sa_flags = SA_RESTART;
++	sigaction(SIGINT, &sigact, NULL);
++	sigaction(SIGQUIT, &sigact, NULL);
+     }
+     for (;;) {
+ 	if (rlogin == _POSIX_VDISABLE)
+Index: netkit-telnet-0.17/telnet/sys_bsd.cc
+===================================================================
+--- netkit-telnet-0.17.orig/telnet/sys_bsd.cc
++++ netkit-telnet-0.17/telnet/sys_bsd.cc
+@@ -205,7 +205,10 @@
+         setcommandmode();
+ 	siglongjmp(toplevel, -1);
+ #else
+-	signal(SIGINT, SIG_DFL);
++	struct sigaction sigact = {};
++	sigact.sa_handler = SIG_DFL;
++	sigact.sa_flags = SA_RESTART;
++	sigaction(SIGINT, &sigact, NULL);
+ 	raise(SIGINT);
+ #endif
+     }
+@@ -221,7 +224,10 @@
+ 	    sendabort();
+ 	return;
+     }
+-    signal(SIGQUIT, SIG_DFL);
++    struct sigaction sigact = {};
++    sigact.sa_handler = SIG_DFL;
++    sigact.sa_flags = SA_RESTART;
++    sigaction(SIGQUIT, &sigact, NULL);
+     raise(SIGQUIT);
+ }
+ 
+@@ -245,16 +251,23 @@
+ #endif
+ 
+ void sys_telnet_init(void) {
+-    signal(SIGINT, intr);
+-    signal(SIGQUIT, intr2);
++    struct sigaction sigact = {};
++    sigact.sa_flags = SA_RESTART;
++    sigact.sa_handler = intr;
++    sigaction(SIGINT, &sigact, NULL);
++    sigact.sa_handler = intr2;
++    sigaction(SIGQUIT, &sigact, NULL);
+ #if 0
+-    signal(SIGPIPE, deadpeer);
++    sigact.sa_handler = deadpeer;
++    sigaction(SIGPIPE, &sigact, NULL);
+ #endif
+ #ifdef	SIGWINCH
+-    signal(SIGWINCH, sendwin);
++    sigact.sa_handler = sendwin;
++    sigaction(SIGWINCH, &sigact, NULL);
+ #endif
+ #ifdef	SIGINFO
+-    signal(SIGINFO, ayt);
++    sigact.sa_handler = ayt;
++    sigaction(SIGINFO, &sigact, NULL);
+ #endif
+ 
+     setconnmode(0);
+Index: netkit-telnet-0.17/telnet/telnet.cc
+===================================================================
+--- netkit-telnet-0.17.orig/telnet/telnet.cc
++++ netkit-telnet-0.17/telnet/telnet.cc
+@@ -1799,7 +1799,10 @@
+ #ifdef TN3270
+   if (HaveInput) {
+     HaveInput = 0;
+-    (void) signal(SIGIO, inputAvailable);
++    struct sigaction sigact = {};
++    sigact.sa_handler = inputAvailable;
++    sigact.sa_flags = SA_RESTART;
++    (void) sigaction(SIGIO, &sigact, NULL);
+   }
+ #endif	/* TN3270 */
+   
+Index: netkit-telnet-0.17/telnet/terminal.cc
+===================================================================
+--- netkit-telnet-0.17.orig/telnet/terminal.cc
++++ netkit-telnet-0.17/telnet/terminal.cc
+@@ -269,7 +269,10 @@
+ 
+ void tlink_init(void) {
+ #ifdef	SIGTSTP
+-    signal(SIGTSTP, susp);
++    struct sigaction sigact = {};
++    sigact.sa_handler = susp;
++    sigact.sa_flags = SA_RESTART;
++    sigaction(SIGTSTP, &sigact, NULL);
+ #endif
+     tout = fileno(stdout);
+     tin = fileno(stdin);
+@@ -470,11 +473,21 @@
+ 
+     if (f != -1) {
+ #ifdef	SIGTSTP
+-	signal(SIGTSTP, susp);
++	{
++	    struct sigaction sigact = {};
++	    sigact.sa_handler = susp;
++	    sigact.sa_flags = SA_RESTART;
++	    sigaction(SIGTSTP, &sigact, NULL);
++	}
+ #endif	/* SIGTSTP */
+ 
+ #ifdef	SIGINFO
+-	signal(SIGINFO, ayt);
++	{
++	    struct sigaction sigact = {};
++	    sigact.sa_handler = ayt;
++	    sigact.sa_flags = SA_RESTART;
++	    sigaction(SIGINFO, &sigact, NULL);
++	}
+ #endif	/* SIGINFO */
+ 
+ #if defined(NOKERNINFO)
+@@ -510,11 +523,21 @@
+     else {
+ 
+ #ifdef	SIGINFO
+-	signal(SIGINFO, ayt_status);
++	{
++	    struct sigaction sigact = {};
++	    sigact.sa_handler = ayt_status;
++	    sigact.sa_flags = SA_RESTART;
++	    sigaction(SIGINFO, &sigact, NULL);
++	}
+ #endif	/* SIGINFO */
+ 
+ #ifdef	SIGTSTP
+-	signal(SIGTSTP, SIG_DFL);
++	{
++	    struct sigaction sigact = {};
++	    sigact.sa_handler = SIG_DFL;
++	    sigact.sa_flags = SA_RESTART;
++	    sigaction(SIGTSTP, &sigact, NULL);
++	}
+ /*	(void) sigsetmask(sigblock(0) & ~(1<<(SIGTSTP-1))); */
+ #endif	/* SIGTSTP */
+ 
+Index: netkit-telnet-0.17/configure
+===================================================================
+--- netkit-telnet-0.17.orig/configure
++++ netkit-telnet-0.17/configure
+@@ -259,47 +259,6 @@
+ 
+ ##################################################
+ 
+-echo -n 'Checking for BSD signal semantics... '
+-cat <<EOF >__conftest.cc
+-#include <unistd.h>
+-#include <signal.h>
+-int count=0;
+-void handle(int foo) { count++; }
+-int main() {
+-    int pid=getpid();
+-    signal(SIGINT, handle);
+-    kill(pid,SIGINT);
+-    kill(pid,SIGINT);
+-    kill(pid,SIGINT);
+-    if (count!=3) return 1;
+-    return 0;
+-}
+-
+-EOF
+-if (
+-      $CXX $CXXFLAGS  __conftest.cc  -o __conftest || exit 1
+-      ./__conftest || exit 1
+-   ) >/dev/null 2>&1; then
+-    echo 'yes'
+-else
+-    if (
+-          $CXX $CXXFLAGS -D__USE_BSD_SIGNAL __conftest.cc  -o __conftest || exit 1
+-          ./__conftest || exit 1
+-       ) >/dev/null 2>&1; then
+-        echo '-D__USE_BSD_SIGNAL'
+-        CFLAGS="$CFLAGS -D__USE_BSD_SIGNAL"
+-        CXXFLAGS="$CXXFLAGS -D__USE_BSD_SIGNAL"
+-    else
+-        echo 'no'
+-        echo 'This package needs BSD signal semantics to run.'
+-        rm -f __conftest*
+-        exit
+-    fi
+-fi
+-rm -f __conftest*
+-
+-##################################################
+-
+ echo -n 'Checking for ncurses... '
+ cat <<EOF >__conftest.cc
+ #include <stdio.h>
diff --minimal -Nru netkit-telnet-0.17/debian/patches/151-cross_configure.diff netkit-telnet-0.17/debian/patches/151-cross_configure.diff
--- netkit-telnet-0.17/debian/patches/151-cross_configure.diff	1970-01-01 01:00:00.000000000 +0100
+++ netkit-telnet-0.17/debian/patches/151-cross_configure.diff	2016-08-29 19:02:52.000000000 +0200
@@ -0,0 +1,53 @@
+Description: do not run host arch programs during configure
+Author: Helmut Grohne <helmut@subdivi.de>
+Last Update: 2016-08-29
+
+Index: netkit-telnet-0.17/configure
+===================================================================
+--- netkit-telnet-0.17.orig/configure
++++ netkit-telnet-0.17/configure
+@@ -94,7 +94,6 @@
+     echo -n 'Checking if C compiler works... '
+     if (
+           $CC __conftest.c -o __conftest || exit 1
+-          ./__conftest || exit 1
+        ) >/dev/null 2>&1; then
+          echo 'yes'
+      else
+@@ -141,7 +140,6 @@
+     echo -n 'Checking if C++ compiler works... '
+     if (
+           $CXX __conftest.cc -o __conftest || exit 1
+-          ./__conftest || exit 1
+        ) >/dev/null 2>&1; then
+          echo 'yes'
+      else
+@@ -427,7 +425,6 @@
+ else
+     if (
+           $CXX $CXXFLAGS -D_GNU_SOURCE __conftest.cc  -o __conftest || exit 1
+-          ./__conftest || exit 1
+        ) >/dev/null 2>&1; then
+         echo '-D_GNU_SOURCE'
+         CFLAGS="$CFLAGS -D_GNU_SOURCE"
+@@ -460,20 +457,17 @@
+ EOF
+ if (
+       $CXX $CXXFLAGS  __conftest.cc $LIBBSD -o __conftest || exit 1
+-      ./__conftest || exit 1
+    ) >/dev/null 2>&1; then
+     echo 'ok'
+ else
+     if (
+           $CXX $CXXFLAGS  __conftest.cc -lsnprintf $LIBBSD -o __conftest || exit 1
+-          ./__conftest || exit 1
+        ) >/dev/null 2>&1; then
+         echo '-lsnprintf'
+         LIBS="$LIBS -lsnprintf"
+     else
+         if (
+               $CXX $CXXFLAGS  __conftest.cc -ldb $LIBBSD -o __conftest || exit 1
+-              ./__conftest || exit 1
+            ) >/dev/null 2>&1; then
+             echo '-ldb'
+             LIBS="$LIBS -ldb"
diff --minimal -Nru netkit-telnet-0.17/debian/patches/series netkit-telnet-0.17/debian/patches/series
--- netkit-telnet-0.17/debian/patches/series	2015-03-24 00:15:12.000000000 +0100
+++ netkit-telnet-0.17/debian/patches/series	2016-08-29 19:02:21.000000000 +0200
@@ -13,3 +13,5 @@
 130-drain_input_from_child.diff
 140-telnetlogin_name_check.diff
 142-numeric_hosts.diff
+150-signal.diff
+151-cross_configure.diff
diff --minimal -Nru netkit-telnet-0.17/debian/rules netkit-telnet-0.17/debian/rules
--- netkit-telnet-0.17/debian/rules	2015-04-27 22:24:54.000000000 +0200
+++ netkit-telnet-0.17/debian/rules	2016-08-29 18:50:44.000000000 +0200
@@ -12,13 +12,15 @@
 CPPFLAGS += $(shell dpkg-buildflags --get CPPFLAGS)
 LDFLAGS += $(shell dpkg-buildflags --get LDFLAGS)
 
-DEB_BUILD_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_BUILD_GNU_TYPE)
 DEB_HOST_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_HOST_GNU_TYPE)
-ifeq ($(DEB_BUILD_GNU_TYPE),$(DEB_HOST_GNU_TYPE))
-	CROSS :=
-else
-	CROSS := CC=$(DEB_HOST_GNU_TYPE)-gcc
+ifeq ($(origin CC),default)
+	CC = $(DEB_HOST_GNU_TYPE)-gcc
 endif
+export CC
+ifeq ($(origin CXX),default)
+	CXX = $(DEB_HOST_GNU_TYPE)-g++
+endif
+export CXX
 
 build: build-arch build-indep
 build-arch: build-stamp
@@ -34,7 +36,7 @@
 		    MCONFIG > MCONFIG.new; \
 		mv MCONFIG.new MCONFIG; \
 	fi
-	$(MAKE) $(CROSS)
+	$(MAKE)
 
 	touch build-stamp
 

--- End Message ---
--- Begin Message ---
This was fixed on netkit-telnet (see #835977 ), and netkit-telnet-ssl
then inherited the fix (see changelog).

Best regards,
-- 
Marcos Marado

--- End Message ---

Reply to: