Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 22 Sep 1999 21:08:47 +0200 (CEST)
From:      un1i@rz.uni-karlsruhe.de
To:        FreeBSD-gnats-submit@freebsd.org
Subject:   conf/13900: [PATCH] sysinstall can get SIGPIPE if a distr. file is broken
Message-ID:  <199909221908.VAA29442@i609.hadiko.de>

next in thread | raw e-mail | index | archive | help

>Number:         13900
>Category:       conf
>Synopsis:       [PATCH] sysinstall can get SIGPIPE if a distr. file is broken
>Confidential:   no
>Severity:       serious
>Priority:       low
>Responsible:    freebsd-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Wed Sep 22 12:10:00 PDT 1999
>Closed-Date:
>Last-Modified:
>Originator:     Philipp Mergenthaler
>Release:        FreeBSD 4.0-CURRENT i386
>Organization:
University of Karlsruhe
>Environment:

	$FreeBSD: src/release/sysinstall/main.c,v 1.54 1999/08/28 01:34:16 peter  Exp $

>Description:

	Under certain circumstances (e.g., when fetching files in FTP ASCII mode
	from a server that does LF->CRLF substitution), distribution files can
	be damaged in such a way that gunzip or cpio stops. Sysinstall tries to
    write more data to it and therefore gets a SIGPIPE.

>How-To-Repeat:

/tmp%mkdir compat20 ; cd compat20
/tmp/compat20%fetch ftp://ftp2.de.freebsd.org/pub/FreeBSD/releases/i386/3.3-RELEASE/compat20/compat20.aa
/tmp/compat20%fetch ftp://ftp2.de.freebsd.org/pub/FreeBSD/releases/i386/3.3-RELEASE/compat20/compat20.ab
/tmp/compat20%fetch ftp://ftp2.de.freebsd.org/pub/FreeBSD/releases/i386/3.3-RELEASE/compat20/compat20.inf
/tmp/compat20%fetch ftp://ftp2.de.freebsd.org/pub/FreeBSD/releases/i386/3.3-RELEASE/compat20/compat20.mtree
/tmp/compat20%mv compat20.aa x
/tmp/compat20%sed -e 's/.*/&^M/' < x > compat20.aa   # simulate damage

Now use sysinstall to install this distribution from filesystem.


>Fix:

	I don't think it's necessary to handle this case differently from others
	that are already handled, so ignoring the signal is enough.
	But a hint for the user might be helpful (in dist.c and media.c).

/usr/src/release#diff -ru sysinstall sysinstall.new 
diff -ru sysinstall/dist.c sysinstall.new/dist.c
--- sysinstall/dist.c   Mon Sep 20 10:55:35 1999
+++ sysinstall.new/dist.c       Wed Sep 22 20:47:26 1999
@@ -717,7 +717,7 @@
                if (retval != n) {
                    fclose(fp);
                    dialog_clear_norefresh();
-                   msgConfirm("Write failure on transfer! (wrote %d bytes of %d bytes)", retval, n);
+                   msgConfirm("Write failure on transfer! (wrote %d bytes of %d bytes)\nMaybe one of the distribution files got damaged during transfer.", retval, n);
                    goto punt;
                }
            }
diff -ru sysinstall/main.c sysinstall.new/main.c
--- sysinstall/main.c   Wed Sep  1 20:16:39 1999
+++ sysinstall.new/main.c       Wed Sep 22 20:34:01 1999
@@ -56,6 +56,7 @@
        signal(SIGBUS, screech);
        signal(SIGSEGV, screech);
     }
+    signal(SIGPIPE, SIG_IGN);
 
     /* We don't work too well when running as non-root anymore */
     if (geteuid() != 0) {
Only in sysinstall.new: main.c.orig
diff -ru sysinstall/media.c sysinstall.new/media.c
--- sysinstall/media.c  Thu Sep  2 14:13:06 1999
+++ sysinstall.new/media.c      Wed Sep 22 20:47:09 1999
@@ -686,7 +686,7 @@
            break;
        }
        if (write(qfd[1], buf, i) != i) {
-           msgConfirm("Write error on transfer to cpio process, try of %d bytes.", i);
+           msgConfirm("Write error on transfer to cpio process, try of %d bytes.\nMaybe one of the distribution files got damaged during transfer.", i);
            break;
        }
        else {

>Release-Note:
>Audit-Trail:
>Unformatted:


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-bugs" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199909221908.VAA29442>