Index | Thread | Search

From:
Greg Steuck <gnezdo@openbsd.org>
Subject:
Report success in ftp when file is fully retrieved
To:
tech@openbsd.org
Date:
Sat, 14 Feb 2026 07:22:14 -0800

Download raw body.

Thread
  • Greg Steuck:

    Report success in ftp when file is fully retrieved

I ran into this strange case where ports fail to fetch a complete file.
The line below fixes it.

OK?

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...)