Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 29 May 2001 18:49:43 -0700 (PDT)
From:      seb@strollo.org
To:        freebsd-gnats-submit@FreeBSD.org
Subject:   bin/27760: pkg_add -r hangs when fetching via ftp
Message-ID:  <200105300149.f4U1nh048834@freefall.freebsd.org>

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

>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; i<NOFILE; i++) close(i); }
        execl("/usr/bin/tar", "tar", Verbose ? "-xzvf" : "-xzf", "-", 0);
        _exit(2);
      }

>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?200105300149.f4U1nh048834>