NetBSD Problem Report #29534

From gson@araneus.fi  Sat Feb 26 12:36:16 2005
Return-Path: <gson@araneus.fi>
Received: from gusto.araneus.fi (gusto.araneus.fi [204.152.189.154])
	by narn.netbsd.org (Postfix) with ESMTP id 42D0263B116
	for <gnats-bugs@gnats.NetBSD.org>; Sat, 26 Feb 2005 12:36:16 +0000 (UTC)
Message-Id: <200502261236.j1QCa9hG021858@guava.araneus.fi>
Date: Sat, 26 Feb 2005 14:36:09 +0200 (EET)
From: gson@gson.org (Andreas Gustafsson)
Reply-To: gson@gson.org (Andreas Gustafsson)
To: gnats-bugs@netbsd.org
Subject: pkg_add hangs during FTP from ftp.fi.netbsd.org
X-Send-Pr-Version: 3.95

>Number:         29534
>Category:       bin
>Synopsis:       pkg_add hangs during FTP from ftp.fi.netbsd.org
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    bin-bug-people
>State:          closed
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Sat Feb 26 12:37:00 +0000 2005
>Closed-Date:    Fri Apr 08 18:17:17 +0000 2005
>Last-Modified:  Fri Apr 08 18:17:17 +0000 2005
>Originator:     Andreas Gustafsson
>Release:        NetBSD 2.0
>Organization:
>Environment:
System: NetBSD gus.araneus.fi 2.0 NetBSD 2.0 (GENERIC) #0: Thu Dec 2 01:57:30 UTC 2004 builds@build:/big/builds/ab/netbsd-2-0-RELEASE/sparc/200411300000Z-obj/big/builds/ab/netbsd-2-0-RELEASE/src/sys/arch/sparc/compile/GENERIC sparc
Architecture: sparc
Machine: sparc
>Description:

pkg_add hangs when attempting to retrive binary packages from ftp.fi.netbsd.org.
This is because expect() in src/usr.bin/pkg_install/lib/ftpio.c only handles FTP
replies of 90 characters or less including the two surrounding newlines,
but the response ftp.fi.netbsd.org sends to the command "cd ." can be much
longer.  In my case, it was 129 characters:

  ftp> cd .
  250 OK. Current directory is /.m/mirrors11/ftp.netbsd.org/pub/NetBSD/packages/pkgsrc-2004Q4/NetBSD-2.0/sparc/All

>How-To-Repeat:

Run the command

  pkg_add -v ftp://ftp.fi.netbsd.org/pub/NetBSD/packages/2.0/sparc/All/apache-1.3.33nb1.tgz

Note how it hangs after sending the "cd ." command to FTP.

>Fix:

Index: ftpio.c
===================================================================
RCS file: /cvsroot/src/usr.sbin/pkg_install/lib/ftpio.c,v
retrieving revision 1.66
diff -u -r1.66 ftpio.c
--- ftpio.c	6 Jan 2005 11:56:39 -0000	1.66
+++ ftpio.c	26 Feb 2005 12:33:33 -0000
@@ -139,7 +139,7 @@
 expect(int fd, const char *str, int *ftprc)
 {
 	int rc;
-	char buf[90];  
+	char buf[150];  
 #if EXPECT_DEBUG
 	char *vstr;
 #endif /* EXPECT_DEBUG */

>Release-Note:

>Audit-Trail:
From: Martin Husemann <martin@duskware.de>
To: gnats-bugs@netbsd.org
Cc: 
Subject: Re: bin/29534: pkg_add hangs during FTP from ftp.fi.netbsd.org
Date: Sat, 26 Feb 2005 19:17:11 +0100

 On Sat, Feb 26, 2005 at 12:37:01PM +0000, Andreas Gustafsson wrote:
 > -	char buf[90];  
 > +	char buf[150];  

 150 sounds still tiny - I would use something > MAXPATHLEN at least
 and/or maybe fix the code to cope with arbitrary lengths.

 Martin

State-Changed-From-To: open->closed
State-Changed-By: gson@netbsd.org
State-Changed-When: Fri, 08 Apr 2005 18:17:17 +0000
State-Changed-Why:
Fixed by hubertf in ftpio.c 1.67 in response to pkg/24744.


>Unformatted:

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.39 2013/11/01 18:47:49 spz Exp $
$NetBSD: gnats_config.sh,v 1.8 2006/05/07 09:23:38 tsutsui Exp $
Copyright © 1994-2007 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.