From owner-freebsd-bugs Tue May 29 18:50: 7 2001 Delivered-To: freebsd-bugs@hub.freebsd.org Received: from freefall.freebsd.org (freefall.freebsd.org [216.136.204.21]) by hub.freebsd.org (Postfix) with ESMTP id CD59337B424 for ; Tue, 29 May 2001 18:50:00 -0700 (PDT) (envelope-from gnats@FreeBSD.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.11.1/8.11.1) id f4U1o0I48914; Tue, 29 May 2001 18:50:00 -0700 (PDT) (envelope-from gnats) Received: from freefall.freebsd.org (freefall.freebsd.org [216.136.204.21]) by hub.freebsd.org (Postfix) with ESMTP id 99BB737B423 for ; Tue, 29 May 2001 18:49:43 -0700 (PDT) (envelope-from nobody@FreeBSD.org) Received: (from nobody@localhost) by freefall.freebsd.org (8.11.1/8.11.1) id f4U1nh048834; Tue, 29 May 2001 18:49:43 -0700 (PDT) (envelope-from nobody) Message-Id: <200105300149.f4U1nh048834@freefall.freebsd.org> Date: Tue, 29 May 2001 18:49:43 -0700 (PDT) From: seb@strollo.org To: freebsd-gnats-submit@FreeBSD.org X-Send-Pr-Version: www-1.0 Subject: bin/27760: pkg_add -r hangs when fetching via ftp Sender: owner-freebsd-bugs@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.org >Number: 27760 >Category: bin >Synopsis: pkg_add -r hangs when fetching via ftp >Confidential: no >Severity: critical >Priority: medium >Responsible: freebsd-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: sw-bug >Submitter-Id: current-users >Arrival-Date: Tue May 29 18:50:00 PDT 2001 >Closed-Date: >Last-Modified: >Originator: Sebastian Strollo >Release: 4.2-RELEASE >Organization: >Environment: FreeBSD locke 4.2-RELEASE FreeBSD 4.2-RELEASE #0: Fri May 4 10:42:24 PDT 2001 seb@locke:/usr/src/sys/compile/IBM_T20 i386 >Description: When using pkg_add -r to install a package pkg_add just hangs. >How-To-Repeat: Run for example this: % env FTP_PASSIVE_MODE=1 PACKAGESITE=ftp://ftp5.freebsd.org/pub/FreeBSD/ports/i386/packages-4-stable/All/ pkg_add -v -r xbatt-1.2.1 >Fix: After a bit of debugging it turns out the fork() that is done to set up the pipeline for tar doesn't close the file descriptor that is used for the ftp data channel (I guess there is a bit of a timing issue there, although for me it occurs every time). Here is a one line fix to version 1.40.2.5 of the file /usr/src/usr.sbin/pkg_install/lib/file.c that takes care of the problem. Feel free to beautify my fix. (The fix is relevant to both HEAD and RELENG_4). Thanks! *** file.c.ORIG Tue May 29 17:58:05 2001 --- file.c Tue May 29 17:58:56 2001 *************** *** 219,224 **** --- 219,225 ---- close(pfd[1]); dup2(pfd[0], 0); close(pfd[0]); + { int i; for(i=3; iRelease-Note: >Audit-Trail: >Unformatted: To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-bugs" in the body of the message