From owner-freebsd-bugs Sat Aug 31 14:30:05 1996 Return-Path: owner-bugs Received: (from root@localhost) by freefall.freebsd.org (8.7.5/8.7.3) id OAA14423 for bugs-outgoing; Sat, 31 Aug 1996 14:30:05 -0700 (PDT) Received: (from gnats@localhost) by freefall.freebsd.org (8.7.5/8.7.3) id OAA14413; Sat, 31 Aug 1996 14:30:03 -0700 (PDT) Date: Sat, 31 Aug 1996 14:30:03 -0700 (PDT) Message-Id: <199608312130.OAA14413@freefall.freebsd.org> To: freebsd-bugs Cc: From: "Jordan K. Hubbard" Subject: Re: bin/1557: pkg_add's auto dependency get .. doesn't work Reply-To: "Jordan K. Hubbard" Sender: owner-bugs@FreeBSD.ORG X-Loop: FreeBSD.org Precedence: bulk The following reply was made to PR bin/1557; it has been noted by GNATS. From: "Jordan K. Hubbard" To: leonard@dstc.edu.au Cc: FreeBSD-gnats-submit@freebsd.org Subject: Re: bin/1557: pkg_add's auto dependency get .. doesn't work Date: Sat, 31 Aug 1996 14:23:51 -0700 > So, i looked into why the .tgz extension isn't being added in, and > added that (see patches to pkg_install/lib/file.c below) then > retried Genuine bug, thanks. > anyway, i traced this to a thing inside libftpio where with > ftpGetURL, an static FILE* is being closed on each re-open. > > I suspect that the fclose done in ftpGetURL() is to avoid > exhausting file descriptors... anyway what i have now works, Erm, sort of. :-( That construct is very deliberately the way it is, due to the fact that when you open a connection to an FTP, that returns one FILE*. If you then ask for a file from that connection, it returns another FILE*. Now, and this is the important part, if you close the first file pointer before finishing with the second, you lose. The intended use of ftpGetURL() was that you'd process the file it returned all the way to completion and close it before asking for another URL. This is clearly not what pkg_add is doing, and pkg_add has a bug I'll have to look into. Leaving leaks in libftpio is not an acceptable solution by any conceivable stretch. However, you have suggested an important optimization to me, and that's to cache the old host connection when getting ftpGetURL() requests back-to-back for the same host. That just makes simple sense, and was easy to do. I'll commit the changes shortly to libftpio, as well as some fixes to pkg_add. Jordan