pkgsrc-Bugs archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
Re: pkg/47525: fetch from sourceforge fails if user sets ownFTPUSERAGENT
The following reply was made to PR pkg/47525; it has been noted by GNATS.
From: Izumi Tsutsui <tsutsui%ceres.dti.ne.jp@localhost>
To: gnats-bugs%NetBSD.org@localhost
Cc: obache%NetBSD.org@localhost, tsutsui%ceres.dti.ne.jp@localhost
Subject: Re: pkg/47525: fetch from sourceforge fails if user sets
ownFTPUSERAGENT
Date: Wed, 6 Feb 2013 23:01:50 +0900
> I don't know why you want to use such a bogus ("Mozilla/5.0") user agent,
> but it is the origin of the fault.
Why? It's valid usage and documented environment in ftp(1) man page.
ftp(1) is not only for pkgsrc.
> morr@'s change may rise new other faults, because it will work well with
> x11/rxvt-unicode/Makefile r1.41, adding FTPUSERAGENT="NetBSD/ftp".
> If other sites also has same problem (empty user-agent is not welcomed),
> package using such site as MASTER_SITES will also fail to fetch,
> because usually, FTPUSERAGENT environment variable is empty.
ftp(1) uses FTPUSERAGENT only if getenv(3) returns !NULL.
http://nxr.netbsd.org/xref/src/usr.bin/ftp/fetch.c?r=1.201#857
---
if ((useragent=getenv("FTPUSERAGENT")) != NULL) {
fetch_printf(fin, "User-Agent: %s\r\n", useragent);
} else {
fetch_printf(fin, "User-Agent: %s/%s\r\n",
FTP_PRODUCT, FTP_VERSION);
}
---
If FTPUSERAGENT is set but empty, ftp(1) uses empty USERAGENT.
If FTPUSERAGENT is unset, ftp(1) uses the default FTP_PRODUCT
and FTP_VERSION (which is "NetBSD-ftp/20100605") and it has worked
as you see with the default settings.
The following patch makes both rxvt-unicode and sourceforge sites happy,
but I wonder if we should rather fix mk/fetch/fetch script directly.
Index: mk/fetch/fetch.mk
===================================================================
RCS file: /cvsroot/pkgsrc/mk/fetch/fetch.mk,v
retrieving revision 1.58
diff -u -p -r1.58 fetch.mk
--- mk/fetch/fetch.mk 20 Jan 2013 13:22:59 -0000 1.58
+++ mk/fetch/fetch.mk 6 Feb 2013 13:54:03 -0000
@@ -239,10 +239,10 @@ _FETCH_AFTER_ARGS.custom= ${FETCH_AFTER_
_FETCH_RESUME_ARGS.custom= ${FETCH_RESUME_ARGS}
_FETCH_OUTPUT_ARGS.custom= ${FETCH_OUTPUT_ARGS}
-_FETCH_CMD= ${PKGSRC_SETENV} CHECKSUM=${_CHECKSUM_CMD:Q} \
+_FETCH_CMD= unset FTPUSERAGENT && \
+ ${PKGSRC_SETENV} CHECKSUM=${_CHECKSUM_CMD:Q} \
CP=${TOOLS_CP:Q} \
ECHO=${TOOLS_ECHO:Q} \
- FTPUSERAGENT=${FTPUSERAGENT:Q} \
FETCH_CMD=${_FETCH_CMD.${FETCH_USING}:Q} \
FETCH_BEFORE_ARGS=${_FETCH_BEFORE_ARGS.${FETCH_USING}:Q} \
FETCH_AFTER_ARGS=${_FETCH_AFTER_ARGS.${FETCH_USING}:Q} \
(btw FTP_VERSION has not been bumped after recent ssl addition)
---
Izumi Tsutsui
Home |
Main Index |
Thread Index |
Old Index