Subject: Re: ftpio.c's expect hang
To: iMil <imil@home.imil.net>
From: Hubert Feyrer <hubert@feyrer.de>
List: tech-pkg
Date: 02/28/2005 12:35:05
On Mon, 28 Feb 2005, iMil wrote:
> i'm using libinstall's ftpio.c to perform ftp pkgsrc fetch in pkg_select, but 
> for it to work i have to comment out this code portion in ftp_start() :
>
> - ---[snip]---
>                if ((expect(ftpio.answer, "\n(221|250|221|550).*\n", &rc) != 
> 0)
>                    || rc != 250) {
>                        warnx("expect1 failed, rc=%d", rc);
>                        return -1;
>                }
> - ---[snip]---
>
> if i don't, expect hangs here (with verbose_expect=1) :
>
> - ---> PWD
> 257 "/" is the current directory.
> got remotepwd as `/'
> - ---> TYPE I
> 200 Type set to I.
>
> i suspected a classic passive / active issue, so i inserted a 
> setenv("FTP_PASSIVE_MODE", "yes", 1); in my code, without success.
> ftp(1) and pkg_add(1), even when called from pkg_select, both work perfectly, 
> so it's clearly a mistake of mine. Any libinstall guru around could give me a 
> hint ?

Um, more context please? How can I reproduce the problem?
It may be that not enough possible return codes are handled in the code.

Looking at your above example, what happens if you add 200 and 257 to the 
list of accepted return codes? Seems to be TRT to me (without knowing more 
details.


  - Hubert (author of the ftpio code)

-- 
NetBSD - Free AND Open!      (And of course secure, portable, yadda yadda)