On Thu, Apr 05, 2007 at 05:32:59PM +0200, Grzegorz B?ach wrote:
> I can't install any packages from pkgsrc-box.org, but from
> pkgsrc.dragonflybsd.org it works OK.

Can you rebuild pkg_install with the attached patch and see if that
works?

Joerg
Index: ftpio.c
===================================================================
RCS file: /home/joerg/repo/netbsd/src/usr.sbin/pkg_install/lib/ftpio.c,v
retrieving revision 1.73
diff -u -r1.73 ftpio.c
--- ftpio.c     11 May 2006 23:50:15 -0000      1.73
+++ ftpio.c     10 Apr 2007 13:32:34 -0000
@@ -655,7 +655,10 @@
        char *s, buf[MaxPathSize];
        char tmpname[MaxPathSize];
        char best[MaxPathSize];
-       int rc, tfd;
+       int rc, tfd, retry_tbz;
+
+       retry_tbz = 0;
+       best[0]='\0';
 
        rc = ftp_start(base);
        if (rc == -1) {
@@ -684,8 +687,16 @@
                 * we can't use the pkg wildcards here as dewey compare
                 * and alternates won't be handled by ftp(1); sort
                 * out later, using pmatch() */
-               (void) snprintf(buf,  sizeof(buf), "nlist %.*s*.t[bg]z %s\n",
-                               (int)(s-pattern), pattern, tmpname);
+               if (retry_tbz) {
+retry_with_tbz:
+                       (void) snprintf(buf,  sizeof(buf), "nlist %.*s*.tbz 
%s\n",
+                                       (int)(s-pattern), pattern, tmpname);
+                       retry_tbz = 0;
+               } else {
+                       (void) snprintf(buf,  sizeof(buf), "nlist %.*s*.tgz 
%s\n",
+                                       (int)(s-pattern), pattern, tmpname);
+                       retry_tbz = 1;
+               }
        }
 
        rc = ftp_cmd(buf, "\n(550|450|226).*\n"); /* catch errors */
@@ -704,7 +715,6 @@
                return NULL;
        }
        
-       best[0]='\0';
        if (access(tmpname, R_OK)==0) {
                int matches;
                FILE *f;
@@ -747,6 +757,9 @@
                        warnx("nothing appropriate found");
        }
 
+       if (retry_tbz)
+               goto retry_with_tbz;
+
        unlink(tmpname);
 
        if (best[0] == '\0')

Reply via email to