Package: cdebootstrap
Version: 0.5.4
Tags: patch
Hi,
If tar 1.22-1 is installed, cdebootstrap (0.5.4) fails regularly, but
not always, complaining about a broken pipe.
tar 1.22-1 introduced a new behaviour where a SIGPIPE can be sent
"early". This manifested itself in bug #522858 which impacted dpkg.
cdebootstrap suffers from the same problem as it can receive a
SIGPIPE from tar and stop on it.
Below are two alternative patches which stop the SIGPIPE from
triggering the cdebootstrap signal handler. The first just suppresses
SIGPIPE globally, the second suppresses it only while writing to the
pipe to tar until it is closed. Both appear to let cdebootstrap work
successfully and consistently in normal use.
Hopefully this makes the problem clear.
Thanks for cdeboostrap!
Niall
__________________
__________________
--- a/src/main.c
+++ b/src/main.c
@@ -44,12 +44,17 @@ static void cleanup_signal (int signum)
_exit (EXIT_FAILURE);
}
+static void ignore_signal (int signum)
+{
+ log_text (DI_LOG_LEVEL_INFO, "Got signal: %s, ignoring!", strsignal
(signum));
+}
+
int main (int argc, char **argv, char **envp)
{
atexit (cleanup_atexit);
signal (SIGHUP, cleanup_signal);
signal (SIGINT, cleanup_signal);
- signal (SIGPIPE, cleanup_signal);
+ signal (SIGPIPE, ignore_signal);
signal (SIGTERM, cleanup_signal);
if (frontend_main (argc, argv, envp))
__________________
__________________
diff -ur cdebootstrap-0.5.4/include/handle.h
cdebootstrap-0.5.4-test/include/handle.h
--- cdebootstrap-0.5.4/include/handle.h 2009-04-17 16:49:04.000000000 +0100
+++ cdebootstrap-0.5.4-test/include/handle.h 2009-04-17
16:00:37.000000000 +0100
@@ -0,0 +1,2 @@
+void cleanup_signal (int signum);
+void cleanup_atexit (void);
diff -ur cdebootstrap-0.5.4/src/handle.c cdebootstrap-0.5.4-test/src/handle.c
--- cdebootstrap-0.5.4/src/handle.c 2009-04-17 16:47:43.000000000 +0100
+++ cdebootstrap-0.5.4-test/src/handle.c 2009-04-17 16:12:34.000000000
+0100
@@ -0,0 +1,19 @@
+#define _GNU_SOURCE
+
+#include <signal.h>
+#include <string.h>
+#include "install.h"
+#include "log.h"
+#include "handle.h"
+
+void cleanup_atexit (void)
+{
+ install_umount_all ();
+}
+
+void cleanup_signal (int signum)
+{
+ log_text (DI_LOG_LEVEL_CRITICAL, "Got signal: %s, cleaning up",
strsignal (signum));
+ install_umount_all ();
+ _exit (EXIT_FAILURE);
+}
diff -ur cdebootstrap-0.5.4/src/main.c cdebootstrap-0.5.4-test/src/main.c
--- cdebootstrap-0.5.4/src/main.c 2008-02-24 23:57:23.000000000 +0000
+++ cdebootstrap-0.5.4-test/src/main.c 2009-04-17 16:12:08.000000000 +0100
@@ -26,23 +26,11 @@
#include <config.h>
-#include <signal.h>
#include <stdlib.h>
#include "frontend.h"
-#include "install.h"
-
-static void cleanup_atexit (void)
-{
- install_umount_all ();
-}
-
-static void cleanup_signal (int signum)
-{
- log_text (DI_LOG_LEVEL_CRITICAL, "Got signal: %s, cleaning up",
strsignal (signum));
- install_umount_all ();
- _exit (EXIT_FAILURE);
-}
+#include "log.h"
+#include "handle.h"
int main (int argc, char **argv, char **envp)
{
diff -ur cdebootstrap-0.5.4/src/Makefile.am
cdebootstrap-0.5.4-test/src/Makefile.am
--- cdebootstrap-0.5.4/src/Makefile.am 2008-02-27 14:32:02.000000000 +0000
+++ cdebootstrap-0.5.4-test/src/Makefile.am 2009-04-17
15:42:09.000000000 +0100
@@ -10,6 +10,7 @@
download.c \
execute.c \
gpg.c \
+ handle.c \
install.c \
main.c \
log.c \
diff -ur cdebootstrap-0.5.4/src/Makefile.in
cdebootstrap-0.5.4-test/src/Makefile.in
--- cdebootstrap-0.5.4/src/Makefile.in 2009-01-30 12:15:23.000000000 +0000
+++ cdebootstrap-0.5.4-test/src/Makefile.in 2009-04-17
16:09:20.000000000 +0100
@@ -47,10 +47,10 @@
binPROGRAMS_INSTALL = $(INSTALL_PROGRAM)
PROGRAMS = $(bin_PROGRAMS)
am_cdebootstrap_OBJECTS = check.$(OBJEXT) download.$(OBJEXT) \
- execute.$(OBJEXT) gpg.$(OBJEXT) install.$(OBJEXT) \
- main.$(OBJEXT) log.$(OBJEXT) packages.$(OBJEXT) \
- suite.$(OBJEXT) suite_action.$(OBJEXT) suite_config.$(OBJEXT) \
- target.$(OBJEXT)
+ execute.$(OBJEXT) gpg.$(OBJEXT) handle.$(OBJEXT) \
+ install.$(OBJEXT) main.$(OBJEXT) log.$(OBJEXT) \
+ packages.$(OBJEXT) suite.$(OBJEXT) suite_action.$(OBJEXT) \
+ suite_config.$(OBJEXT) target.$(OBJEXT)
cdebootstrap_OBJECTS = $(am_cdebootstrap_OBJECTS)
DEFAULT_INCLUDES = -...@am__isrc@ -I$(top_builddir)
depcomp = $(SHELL) $(top_srcdir)/depcomp
@@ -183,6 +183,7 @@
download.c \
execute.c \
gpg.c \
+ handle.c \
install.c \
main.c \
log.c \
@@ -269,6 +270,7 @@
@AMDEP_TRUE@@am__include@ @am__qu...@./$(DEPDIR)/download...@am__quote@
@AMDEP_TRUE@@am__include@ @am__qu...@./$(DEPDIR)/execute...@am__quote@
@AMDEP_TRUE@@am__include@ @am__qu...@./$(DEPDIR)/gpg...@am__quote@
+...@amdep_true@@am__include@ @am__qu...@./$(DEPDIR)/handle...@am__quote@
@AMDEP_TRUE@@am__include@ @am__qu...@./$(DEPDIR)/install...@am__quote@
@AMDEP_TRUE@@am__include@ @am__qu...@./$(DEPDIR)/log...@am__quote@
@AMDEP_TRUE@@am__include@ @am__qu...@./$(DEPDIR)/main...@am__quote@
diff -ur cdebootstrap-0.5.4/src/packages.c
cdebootstrap-0.5.4-test/src/packages.c
--- cdebootstrap-0.5.4/src/packages.c 2008-02-23 21:46:32.000000000 +0000
+++ cdebootstrap-0.5.4-test/src/packages.c 2009-04-17 16:16:17.000000000
+0100
@@ -36,6 +36,7 @@
#include "log.h"
#include "packages.h"
#include "target.h"
+#include "handle.h"
const char *package_get_local_filename (di_package *package)
{
@@ -129,6 +130,7 @@
if (!pi)
goto error;
+ signal(SIGPIPE, SIG_IGN);
while (copied < memberlen)
{
size_t r, s;
@@ -143,6 +145,7 @@
goto error;
copied += s;
}
+ signal(SIGPIPE, cleanup_signal);
ret = fclose (pi);
pi = NULL;
----------------------------------------------------------------
This message was sent using IMP, the Internet Messaging Program.
--
To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org