Download raw body.
Report success in ftp when file is fully retrieved
On Sat Feb 14, 2026 at 07:22:14AM -0800, Greg Steuck wrote:
> I ran into this strange case where ports fail to fetch a complete file.
> The line below fixes it.
>
> OK?
Since rval is the return value of the function and we have successfully
downloaded the file, that makes sense to me.
ok rsadowski
>
> diff --git a/usr.bin/ftp/fetch.c b/usr.bin/ftp/fetch.c
> index 1882436c5cb..37980b9e4c8 100644
> --- a/usr.bin/ftp/fetch.c
> +++ b/usr.bin/ftp/fetch.c
> @@ -854,6 +854,7 @@ noslash:
> goto cleanup_url_get;
> case 416: /* Requested Range Not Satisfiable */
> warnx("File is already fully retrieved.");
> + rval = 0;
> goto cleanup_url_get;
> #endif /* !SMALL */
> case 503:
>
> Failure demo:
>
> % ls -l /usr/ports/distfiles/hackage/ed25519-0.0.5.0.tar.gz.part
> -rw-r--r-- 1 _pfetch _pfetch 80034 Oct 11 2015 /usr/ports/distfiles/hackage/ed2551
> 9-0.0.5.0.tar.gz.part
> % grep SIZE distinfo | grep ed2
> SIZE (hackage/ed25519-0.0.5.0.tar.gz) = 80034
> % make fetch
> ...
> >> Fetch https://hackage.haskell.org/package/ed25519-0.0.5.0/ed25519-0.0.5.0.tar.gz
> ftp: File is already fully retrieved.
> >> Fetch https://ftp.openbsd.org/pub/OpenBSD/distfiles/hackage/ed25519-0.0.5.0.tar.gz
> ftp: File is already fully retrieved.
> >> Fetch https://ftp.usa.openbsd.org/pub/OpenBSD/distfiles/hackage/ed25519-0.0.5.0.tar
> .gz
> ftp: Error retrieving https://ftp.usa.openbsd.org/pub/OpenBSD/distfiles/hackage/ed2551
> 9-0.0.5.0.tar.gz: 404 Not Found
> >> Fetch https://ftp.fr.openbsd.org/pub/OpenBSD/distfiles/hackage/ed25519-0.0.5.0.tar.
> gz
> ftp: File is already fully retrieved.
> *** Error 1 in . (/usr/ports/infrastructure/mk/bsd.port.mk:3306 '/usr/ports/distfiles/
> hackage/ed25519-0.0.5.0.tar.gz': @lock=ed25519-0.0.5.0...)
>
Report success in ftp when file is fully retrieved