Hello,

I am sure I have found a bug in wget 1.8.2 and earlier.

Symptom: exit status is 0 when recursive ftp fails due to
failed login.

An ftp server may refuse login for temporary reasons, such as
maximum logins, too busy, etc..  I don't mean that wget will
detect such reasons, only that the user might be aware of such
reasons.  If a wget user knows that he has a valid login, he
can expect that a login failure is temporary, and retry by
invoking wget in a shell loop -- but only if wget exits failure
when the login fails.

For example, this script will not work with wget:

<script>
#! /usr/local/bin/zsh

SLEEPS=180
NTRY=0
FTPDIR='ftp://logname:[EMAIL PROTECTED]:3333/pub/whatever/'
WGETPROG=/usr/local/bin/wget

until $WGETPROG -v -t 1 -nr -r -np -nc "$FTPDIR" ; do
        print
        print -- ======== Attempt $((++NTRY)) failed, sleeping $SLEEPS ========
        sleep ${SLEEPS}s
        print -- awake after $SLEEPS seconds, trying again
        print
done

print
print -- ======== Attempt $((++NTRY)) succeeded ========
</script>

That fails because wget `succeeds' even if login failed on the
first try.

I am appending a tiny patch post script.  I have not studied the
wget source enough to know if the patch is sufficient or correct,
but it has worked well for me many times over the last several
weeks.

Hope this helps,
Ed Hynan

p.s.
=== begin patch ===
*** wget-1.8.2-orig/src/ftp.c   Fri May 17 23:05:16 2002
--- wget-1.8.2-new/src/ftp.c    Tue Jun 18 15:25:51 2002
***************
*** 1701,1707 ****
          /* ftp_retrieve_glob is a catch-all function that gets called
             if we need globbing, time-stamping or recursion.  Its
             third argument is just what we really need.  */
!         ftp_retrieve_glob (u, &con,
                             (opt.ftp_glob && wild) ? GLOBALL : GETONE);
        }
        else
--- 1701,1707 ----
          /* ftp_retrieve_glob is a catch-all function that gets called
             if we need globbing, time-stamping or recursion.  Its
             third argument is just what we really need.  */
!         res = ftp_retrieve_glob (u, &con,
                             (opt.ftp_glob && wild) ? GLOBALL : GETONE);
        }
        else

Reply via email to