Date: Sat, 31 Aug 1996 17:02:34 +1000 (EST) From: David Leonard <d@scry.dstc.edu.au> To: FreeBSD-gnats-submit@freebsd.org Subject: bin/1557: pkg_add's auto dependency get .. doesn't work Message-ID: <199608310702.RAA15403@scry.dstc.edu.au> Resent-Message-ID: <199608310710.AAA26511@freefall.freebsd.org>
next in thread | raw e-mail | index | archive | help
>Number: 1557 >Category: bin >Synopsis: pkg_add's auto dependency get .. doesn't work >Confidential: no >Severity: serious >Priority: low >Responsible: freebsd-bugs >State: open >Class: sw-bug >Submitter-Id: current-users >Arrival-Date: Sat Aug 31 00:10:01 PDT 1996 >Last-Modified: >Originator: David Leonard >Organization: DSTC, Brisbane, Australia +61 7 3365 4310 >Release: FreeBSD 2.2-CURRENT i386 >Environment: sup from sup.au.freebsd.org yesterday >Description: When you pkg_add something from a URL when the dependencies aren't all installed, pkg_add will attempt to auto-install the dependent packages for you. but it doesn't work. >How-To-Repeat: without having autoconf or m4 installed, i did # pkg_add -v "ftp://ftp/u9/freebsd/packages-2.1.5/All/autoconf-2.10.tgz" Trying to fetch ftp://ftp/u9/freebsd/packages-2.1.5/All/autoconf-2.10.tgz. Extracting from FTP connection into /var/tmp/instmp.014625 +CONTENTS [... and so on ...] share/autoconf/config.sub tar command returns 0 status Package `autoconf-2.10' depends on `m4-1.4'. Trying to fetch ftp://ftp/u9/freebsd/packages-2.1.5/All/m4-1.4. Error: FTP Unable to get ftp://ftp/u9/freebsd/packages-2.1.5/All/m4-1.4 Segmentation fault (core dumped) 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 after a similar output it died on a 'Broken Pipe' signal after trying to fetch the right file. (i can't cut and paste because vi trashed the scrollback buffer) 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, even though some FILE*'s are left unclosed. i could not see straight away where the sigpipe was coming from... should have kept the core :( >Fix: ------------------------------------------------------------ for src/lib/libftpio/ Index: ftpio.c =================================================================== RCS file: /home/leonard/cvsroot/freebsd/src/lib/libftpio/ftpio.c,v retrieving revision 1.1.1.3 diff -c -r1.1.1.3 ftpio.c *** ftpio.c 1996/08/30 17:35:30 1.1.1.3 --- ftpio.c 1996/08/31 06:49:51 *************** *** 292,304 **** { char host[255], name[255]; int port; ! static FILE *fp = NULL; FILE *fp2; if (fp) { /* Close previous managed connection */ fclose(fp); fp = NULL; } if (get_url_info(url, host, &port, name) == SUCCESS) { fp = ftpLogin(host, user, passwd, port, 0); if (fp) { --- 292,307 ---- { char host[255], name[255]; int port; ! /* static */ FILE *fp = NULL; FILE *fp2; + #if 0 if (fp) { /* Close previous managed connection */ fclose(fp); fp = NULL; } + #endif + if (get_url_info(url, host, &port, name) == SUCCESS) { fp = ftpLogin(host, user, passwd, port, 0); if (fp) { ------------------------------------------------------------ for src/usr.sbin/pkg_install/lib might also want to add the '.tar.gz' case too? Index: file.c =================================================================== RCS file: /home/leonard/cvsroot/freebsd/src/usr.sbin/pkg_install/lib/file.c,v retrieving revision 1.1.1.1 diff -c -r1.1.1.1 file.c *** file.c 1996/08/16 00:20:37 1.1.1.1 --- file.c 1996/08/31 06:50:07 *************** *** 244,251 **** snprintf(pword, HOSTNAME_MAX + 40, "%s@%s", pw->pw_name, me); } if (Verbose) ! printf("Trying to fetch %s.\n", fname); ftp = ftpGetURL(fname, uname, pword); if (ftp) { pen[0] = '\0'; if ((rp = make_playpen(pen, 0)) != NULL) { --- 244,261 ---- snprintf(pword, HOSTNAME_MAX + 40, "%s@%s", pw->pw_name, me); } if (Verbose) ! printf("Trying to fetch %s\n", fname); ftp = ftpGetURL(fname, uname, pword); + + /* try adding a .tgz extension if there isn't one already */ + if (!ftp && 0!=strcmp( fname+(strlen(fname)-4), ".tgz") ) + { + strcat( fname, ".tgz" ); + if (Verbose) + printf("That failed, so let's try %s\n", fname); + ftp = ftpGetURL( fname, uname, pword ); + } + if (ftp) { pen[0] = '\0'; if ((rp = make_playpen(pen, 0)) != NULL) { >Audit-Trail: >Unformatted:
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199608310702.RAA15403>