NetBSD Problem Report #30246

From reed@rainier.reedmedia.net  Mon May 16 17:56:37 2005
Return-Path: <reed@rainier.reedmedia.net>
Received: from pilchuck.reedmedia.net (pilchuck.reedmedia.net [209.166.74.74])
	by narn.netbsd.org (Postfix) with ESMTP id 3A88E63B104
	for <gnats-bugs@gnats.netbsd.org>; Mon, 16 May 2005 17:56:37 +0000 (UTC)
Message-Id: <25036-1116266192@rainier.reedmedia.net>
Date: Mon, 16 May 2005 10:56:32 -0700
From: reed@reedmedia.net
Reply-To: reed@reedmedia.net
To: gnats-bugs@netbsd.org
Subject: download-vulnerability-list doesn't use FETCH_CMD
X-Send-Pr-Version: 3.95

>Number:         30246
>Category:       pkg
>Synopsis:       download-vulnerability-list doesn't use FETCH_CMD
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    pkg-manager
>State:          closed
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Mon May 16 17:57:00 +0000 2005
>Closed-Date:    Sat Feb 13 23:08:36 +0000 2010
>Last-Modified:  Sat Feb 13 23:08:36 +0000 2010
>Originator:     reed@reedmedia.net
>Release:        NetBSD 1.6.2_STABLE
>Organization:
http://bsd.reedmedia.net/
>Environment:


System: NetBSD rainier.reedmedia.net 1.6.2_STABLE NetBSD 1.6.2_STABLE (MYKERNEL) #1: Tue Jun 1 12:16:43 PDT 2004 reed@rainier.reedmedia.net:/usr/src/sys/arch/i386/compile/MYKERNEL i386
Architecture: i386
Machine: i386
>Description:
I noticed that the code for figuring out the fetch command and that
complaint of unknown fetch command probably should be done at pkgsrc
build time of the package and not needed in the end result script.

I was then told that the FETCH_CMD can be used to allow people
to use their own utility.

But it doesn't work that way.

Have a look at template:

utility=`echo "@FETCH_CMD@" | @AWK@ '{ print $1 }'`
case "$utility" in
*curl)  @FETCH_CMD@ ${FETCH_ARGS} -o ${NEW_VUL_LIST} ${VUL_SOURCE} ;;
*ftp)   @FETCH_CMD@ ${FETCH_ARGS} -o ${NEW_VUL_LIST} ${VUL_SOURCE} ;;
*wget)  @FETCH_CMD@ ${FETCH_ARGS} -O ${NEW_VUL_LIST} ${VUL_SOURCE} ;;
*fetch) @FETCH_CMD@ ${FETCH_ARGS} -o ${NEW_VUL_LIST} ${VUL_SOURCE} ;;

And the end resulting script:

utility=`echo "/usr/bin/ftp" | /usr/bin/awk '{ print $1 }'`
case "$utility" in
*curl)  /usr/bin/ftp ${FETCH_ARGS} -o ${NEW_VUL_LIST} ${VUL_SOURCE} ;;
*ftp)   /usr/bin/ftp ${FETCH_ARGS} -o ${NEW_VUL_LIST} ${VUL_SOURCE} ;;
*wget)  /usr/bin/ftp ${FETCH_ARGS} -O ${NEW_VUL_LIST} ${VUL_SOURCE} ;;
*fetch) /usr/bin/ftp ${FETCH_ARGS} -o ${NEW_VUL_LIST} ${VUL_SOURCE} ;;

The utility is hard-coded once you install as shown above.

Notice that curl, wget, fetch would never match in examples (using default
ftp) as this was implemented.

>How-To-Repeat:
Install audit-packages and look at the code for the installed
download-vulnerability-list.

Notice how it has tests for the fetch command that are
never used.
>Fix:

I haven't tested by change
s/@FETCH_CMD@/${FETCH_COMMAND}/

And then earlier set:

: ${FETCH_CMD=@FETCH_CMD@}

>Release-Note:

>Audit-Trail:
From: Quentin Garnier <cube@cubidou.net>
To: gnats-bugs@netbsd.org
Cc: reed@netbsd.org
Subject: Re: pkg/30246: download-vulnerability-list doesn't use FETCH_CMD
Date: Mon, 16 May 2005 20:20:32 +0200

 --asNXdz5DenlsLVVk
 Content-Type: text/plain; charset=us-ascii
 Content-Disposition: inline
 Content-Transfer-Encoding: quoted-printable

 On Mon, May 16, 2005 at 05:57:00PM +0000, reed@reedmedia.net wrote:
 [...]
 > >Description:
 > I noticed that the code for figuring out the fetch command and that
 > complaint of unknown fetch command probably should be done at pkgsrc
 > build time of the package and not needed in the end result script.
 >=20
 > I was then told that the FETCH_CMD can be used to allow people
 > to use their own utility.

 Yes, in mk.conf.

 > But it doesn't work that way.

 It does, at build time.

 > Have a look at template:
 >=20
 > utility=3D`echo "@FETCH_CMD@" | @AWK@ '{ print $1 }'`
 > case "$utility" in
 > *curl)  @FETCH_CMD@ ${FETCH_ARGS} -o ${NEW_VUL_LIST} ${VUL_SOURCE} ;;
 > *ftp)   @FETCH_CMD@ ${FETCH_ARGS} -o ${NEW_VUL_LIST} ${VUL_SOURCE} ;;
 > *wget)  @FETCH_CMD@ ${FETCH_ARGS} -O ${NEW_VUL_LIST} ${VUL_SOURCE} ;;
 > *fetch) @FETCH_CMD@ ${FETCH_ARGS} -o ${NEW_VUL_LIST} ${VUL_SOURCE} ;;
 >=20
 > And the end resulting script:
 >=20
 > utility=3D`echo "/usr/bin/ftp" | /usr/bin/awk '{ print $1 }'`
 > case "$utility" in
 > *curl)  /usr/bin/ftp ${FETCH_ARGS} -o ${NEW_VUL_LIST} ${VUL_SOURCE} ;;
 > *ftp)   /usr/bin/ftp ${FETCH_ARGS} -o ${NEW_VUL_LIST} ${VUL_SOURCE} ;;
 > *wget)  /usr/bin/ftp ${FETCH_ARGS} -O ${NEW_VUL_LIST} ${VUL_SOURCE} ;;
 > *fetch) /usr/bin/ftp ${FETCH_ARGS} -o ${NEW_VUL_LIST} ${VUL_SOURCE} ;;
 >=20
 > The utility is hard-coded once you install as shown above.
 >=20
 > Notice that curl, wget, fetch would never match in examples (using default
 > ftp) as this was implemented.

 The way I look at it, I believe this is the intended behaviour.  That
 way it supports about any FETCH_CMD you set for pkgsrc without having
 to do complicated patching in order to make sure the correct options
 are passed to the final command.

 Also, note that FETCH_ARGS is documented as settable in
 audit-packages(8), while FETCH_CMD is not.

 --=20
 Quentin Garnier - cube@cubidou.net - cube@NetBSD.org
 "When I find the controls, I'll go where I like, I'll know where I want
 to be, but maybe for now I'll stay right here on a silent sea."
 KT Tunstall, Silent Sea, Eye to the Telescope, 2004.

 --asNXdz5DenlsLVVk
 Content-Type: application/pgp-signature
 Content-Disposition: inline

 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v1.2.6 (NetBSD)

 iQEVAwUBQojkcNgoQloHrPnoAQI6+gf9HA+M6uhhfgQReFMCag45JmTi57m6q4mc
 enb+0WQUZLLPfSJAjFkbtOVDxMD8/m7yTO6mzRTw0v4SQqV7nLXPzBcZLOxgVbAj
 t9Y3C0ZtIfa/90ORIGRTb4l97EaFHNB+eiJ4F1YNI0OKnAOY87SPuNlaGxgdXz2u
 1NyFuThRj1SG5QtwGxouDUlhwzxrMc/UbB65wlIVUD7U4hZdBq72rUF4dt42PiMU
 Ya645EkAIo6GveO+yliEdK51+OanvLRpypUnf+kUGKoGqAZSM0acH9cZ1J0O5hwL
 A6d38gJiAQ/FFNi6/B1HqgFJybUKxQIvVfMRYTJVuU9db9wIpJO6eg==
 =0Jif
 -----END PGP SIGNATURE-----

 --asNXdz5DenlsLVVk--

From: "Jeremy C. Reed" <reed@NetBSD.org>
To: Quentin Garnier <cube@cubidou.net>
Cc: gnats-bugs@netbsd.org
Subject: Re: pkg/30246: download-vulnerability-list doesn't use FETCH_CMD
Date: Mon, 16 May 2005 11:24:47 -0700 (PDT)

 On Mon, 16 May 2005, Quentin Garnier wrote:

 > > And the end resulting script:
 > >
 > > utility=`echo "/usr/bin/ftp" | /usr/bin/awk '{ print $1 }'`
 > > case "$utility" in
 > > *curl)  /usr/bin/ftp ${FETCH_ARGS} -o ${NEW_VUL_LIST} ${VUL_SOURCE} ;;
 > > *ftp)   /usr/bin/ftp ${FETCH_ARGS} -o ${NEW_VUL_LIST} ${VUL_SOURCE} ;;
 > > *wget)  /usr/bin/ftp ${FETCH_ARGS} -O ${NEW_VUL_LIST} ${VUL_SOURCE} ;;
 > > *fetch) /usr/bin/ftp ${FETCH_ARGS} -o ${NEW_VUL_LIST} ${VUL_SOURCE} ;;
 > >
 > > The utility is hard-coded once you install as shown above.
 > >
 > > Notice that curl, wget, fetch would never match in examples (using default
 > > ftp) as this was implemented.
 >
 > The way I look at it, I believe this is the intended behaviour.  That
 > way it supports about any FETCH_CMD you set for pkgsrc without having
 > to do complicated patching in order to make sure the correct options
 > are passed to the final command.

 If that is the intended behaviour then the resulting script could just
 have one line instead of several lines shown above.

 That was my initial comment that I posted to tech-pkg. But the maintainer
 said "the way it is now allows people to use different FETCH_CMDs." I
 assumed that meant that people can define it at run-time and not package
 build time.

 > Also, note that FETCH_ARGS is documented as settable in
 > audit-packages(8), while FETCH_CMD is not.

 FETCH_CMD could easily be documented.

     Jeremy C. Reed
                         ``Of course it runs NetBSD.''
                             http://www.NetBSD.org/


From: Quentin Garnier <cube@cubidou.net>
To: "Jeremy C. Reed" <reed@NetBSD.org>
Cc: gnats-bugs@netbsd.org
Subject: Re: pkg/30246: download-vulnerability-list doesn't use FETCH_CMD
Date: Mon, 16 May 2005 20:37:42 +0200

 --SqfawxHnX56H7Ukl
 Content-Type: text/plain; charset=us-ascii
 Content-Disposition: inline
 Content-Transfer-Encoding: quoted-printable

 On Mon, May 16, 2005 at 11:24:47AM -0700, Jeremy C. Reed wrote:
 > On Mon, 16 May 2005, Quentin Garnier wrote:
 >=20
 > > > And the end resulting script:
 > > >
 > > > utility=3D`echo "/usr/bin/ftp" | /usr/bin/awk '{ print $1 }'`
 > > > case "$utility" in
 > > > *curl)  /usr/bin/ftp ${FETCH_ARGS} -o ${NEW_VUL_LIST} ${VUL_SOURCE} ;;
 > > > *ftp)   /usr/bin/ftp ${FETCH_ARGS} -o ${NEW_VUL_LIST} ${VUL_SOURCE} ;;
 > > > *wget)  /usr/bin/ftp ${FETCH_ARGS} -O ${NEW_VUL_LIST} ${VUL_SOURCE} ;;
 > > > *fetch) /usr/bin/ftp ${FETCH_ARGS} -o ${NEW_VUL_LIST} ${VUL_SOURCE} ;;
 > > >
 > > > The utility is hard-coded once you install as shown above.
 > > >
 > > > Notice that curl, wget, fetch would never match in examples (using de=
 fault
 > > > ftp) as this was implemented.
 > >
 > > The way I look at it, I believe this is the intended behaviour.  That
 > > way it supports about any FETCH_CMD you set for pkgsrc without having
 > > to do complicated patching in order to make sure the correct options
 > > are passed to the final command.
 >=20
 > If that is the intended behaviour then the resulting script could just
 > have one line instead of several lines shown above.

 The logic would be in the package Makefile in that case, it's much easier
 to have it there.

 [...]
 > > Also, note that FETCH_ARGS is documented as settable in
 > > audit-packages(8), while FETCH_CMD is not.
 >=20
 > FETCH_CMD could easily be documented.

 Sure.  My point was: "it was the intended behaviour".  I.e., feature,
 not bug.  Now, maybe someone clever can say why it is better not to have
 FETCH_CMD settable at run-time.

 Not using tnftp for pkgsrc is dangerous, anyway.  Last time I checked,
 pkg_install used FETCH_CMD, and yet assumed it is tnftp (most notably
 for the automatic-download-using-interactive-ftp "feature").

 --=20
 Quentin Garnier - cube@cubidou.net - cube@NetBSD.org
 "When I find the controls, I'll go where I like, I'll know where I want
 to be, but maybe for now I'll stay right here on a silent sea."
 KT Tunstall, Silent Sea, Eye to the Telescope, 2004.

 --SqfawxHnX56H7Ukl
 Content-Type: application/pgp-signature
 Content-Disposition: inline

 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v1.2.6 (NetBSD)

 iQEVAwUBQojodtgoQloHrPnoAQJFXwf/YMrActQQoWSQjs1uUZnIv5WFz4AlXVXq
 mf0Q50bTH4UVkgzGgPe8n7hs+yIcDAqyB3siKxvf+4WCKJM8nelHTi4i5yoiUSIl
 Jzrojb5/9jd7EWwtjcjdcp1SdFp2Oa9dqAVePiCYSAYiLzxPMONg5luwbKokGCIu
 I+mTsKp9p8eszXk3GzHKk1S87bda+2iY4YAcisAwHTUrGpp3JeZooR7TFhCEB9bF
 znalHeUpPtEhNL0gFaOzRD/fCDcZ6JH0o8MSE2w4omf2K+mgw1E6nqSsL63B6SfO
 pyb2KKYA3KWFoJE1x3uKY1nr8han+rukexjuwRNgC4OZXeNfv8+1lQ==
 =VgWz
 -----END PGP SIGNATURE-----

 --SqfawxHnX56H7Ukl--

From: "Jeremy C. Reed" <reed@reedmedia.net>
To: gnats-bugs@netbsd.org
Cc: 
Subject: Re: pkg/30246
Date: Tue, 19 Dec 2006 06:38:57 -0600 (CST)

 This is a duplicate of PR #23899.

State-Changed-From-To: open->feedback
State-Changed-By: dholland@NetBSD.org
State-Changed-When: Sun, 06 Apr 2008 08:01:59 +0000
State-Changed-Why:
23899 is fixed, and the code in download-vulnerabilities-list looks ok now;
do you have any further complaints?


From: "Jeremy C. Reed" <reed@reedmedia.net>
To: gnats-bugs@gnats.netbsd.org
Cc: 
Subject: Re: pkg/30246
Date: Wed, 5 Nov 2008 08:13:25 -0600 (CST)

 Documentation still doesn't have FETCH_CMD.

State-Changed-From-To: feedback->analyzed
State-Changed-By: dholland@NetBSD.org
State-Changed-When: Fri, 07 Nov 2008 05:59:38 +0000
State-Changed-Why:
Feedback received; one thing left to go.


State-Changed-From-To: analyzed->feedback
State-Changed-By: dholland@NetBSD.org
State-Changed-When: Sat, 01 Aug 2009 17:47:28 +0000
State-Changed-Why:
Am I correct in thinking this is no longer relevant with the current
package tools, which use libfetch?


State-Changed-From-To: feedback->closed
State-Changed-By: reed@NetBSD.org
State-Changed-When: Sat, 13 Feb 2010 23:08:36 +0000
State-Changed-Why:
Uses pkg_admin and libfetch now.


>Unformatted:

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.51 2026/08/10 02:28:17 riastradh Exp $
$NetBSD: gnats_config.sh,v 1.10 2026/05/13 22:00:09 riastradh Exp $
Copyright © 1994-2026 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.