Subject: Re: pkg/24744
To: None <hubertf@netbsd.org, gnats-admin@netbsd.org,>
From: Hubert Feyrer <hubert@feyrer.de>
List: pkgsrc-bugs
Date: 03/17/2005 23:59:01
The following reply was made to PR pkg/24744; it has been noted by GNATS.

From: Hubert Feyrer <hubert@feyrer.de>
To: jarmo.jaakkola@iki.fi
Cc: gnats-bugs@netbsd.org
Subject: Re: pkg/24744
Date: Fri, 18 Mar 2005 00:58:37 +0100 (CET)

 Hi,
 
 I'm looking at your PR pkg/24744 (pkg_add can't find packages with FTP 
 without full name):
 
 > >Description:
 > pkg_add cannot install packages from some FTP-sites, unless the precise
 > version number and file suffix is given.  Apparently, some server's don't
 > interpret following patterns correctly: package-*.t[bg]z
 
 Your observation is wrong.
 If you look closely at output of "pkg_add -v free", you'll see that it 
 first runs "nlist free somefile" (successfully!), and then hangs after "cd 
 .". It doesn't even get to any .t[gb]z part.
 
 The problem of the hang is that ftp.fi.netbsd.org seems to use a funky FTP 
 server that returns a code 257 where ~everyone else returns either 250 or 
 550. The fact that the text following the 257 is rather long doesn't help 
 to this.
 
 The patch below fixes the problem for me, and I'll commit it to 
 NetBSD-current soonish, then look into pullups for the various NetBSD 
 releases, and get some help to get it into pkg_install.
 
 I'd appreciate if you could try to recompile your NetBSD's 
 src/usr.sbin/pkg_install, and let me know if the problem is fixed for you.
 
 
   - Hubert
 
 Index: lib/ftpio.c
 ===================================================================
 RCS file: /cvsroot/src/usr.sbin/pkg_install/lib/ftpio.c,v
 retrieving revision 1.62
 diff -u -r1.62 ftpio.c
 --- lib/ftpio.c	20 Dec 2003 03:31:56 -0000	1.62
 +++ lib/ftpio.c	17 Mar 2005 23:52:16 -0000
 @@ -139,7 +139,7 @@
   expect(int fd, const char *str, int *ftprc)
   {
   	int rc;
 -	char buf[90]; 
 +	char buf[256];
   #if EXPECT_DEBUG
   	char *vstr;
   #endif /* EXPECT_DEBUG */
 @@ -654,7 +654,7 @@
   	}
 
   	/* Sync - don't remove */
 -	rc = ftp_cmd("cd .\n", "\n(550|250).*\n");
 +	rc = ftp_cmd("cd .\n", "\n(550|250|257).*\n");
   	if (rc != 250) {
   		warnx("chdir failed!");
   		unlink(tmpname);	/* remove clutter */
 
 -- 
 NetBSD - Free AND Open!      (And of course secure, portable, yadda yadda)