Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 4 May 2006 07:51:03 +0200
From:      Pawel Jakub Dawidek <pjd@FreeBSD.org>
To:        Colin Percival <cperciva@FreeBSD.org>
Cc:        cvs-src@FreeBSD.org, src-committers@FreeBSD.org, cvs-all@FreeBSD.org
Subject:   Re: cvs commit: src/usr.sbin/portsnap/portsnap portsnap.sh
Message-ID:  <20060504055103.GC8357@garage.freebsd.pl>
In-Reply-To: <200605032129.k43LT11c062338@repoman.freebsd.org>
References:  <200605032129.k43LT11c062338@repoman.freebsd.org>

next in thread | previous in thread | raw e-mail | index | archive | help

--wTWi5aaYRw9ix9vO
Content-Type: text/plain; charset=iso-8859-2
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

On Wed, May 03, 2006 at 09:29:01PM +0000, Colin Percival wrote:
+> cperciva    2006-05-03 21:29:01 UTC
+>=20
+>   FreeBSD src repository
+>=20
+>   Modified files:
+>     usr.sbin/portsnap/portsnap portsnap.sh=20
+>   Log:
+>   The approach portsnap uses of "pick a random HTTP mirror" doesn't
+>   interact very nicely with HTTP proxies: Since proxies do not know
+>   that all the files on portsnap1.freebsd.org are identical to the
+>   files with the same names on portsnap2.freebsd.org, said proxies end
+>   up downloading and storing files in duplicate.
+>  =20
+>   This commit uses the HTTP_PROXY environment variable, if set, to
+>   generate a random number seed for use in selecting a mirror.  This
+>   means that if several systems all have the same HTTP_PROXY value set,
+>   they will ask the proxy to fetch files from the same mirror (unless
+>   that mirror fails, in which case all the systems will use the same
+>   second choice, et cetera).
+>  =20
+>   Portsnap still doesn't interact very well with "transparent" HTTP
+>   proxies, but there's nothing I can do about those.
[...]
+> +# Generate a random seed for use in picking mirrors.  If HTTP_PROXY
+> +# is set, this will be used to generate the seed; otherwise, the seed
+> +# will be random.
+> +	if [ -z "${HTTP_PROXY}" ]; then

I think you wanted -n instead of -z here.

+> +		RANDVALUE=3D`sha256 -qs "${HTTP_PROXY}" |
+> +		    tr -d 'a-f' |
+> +		    cut -c 1-9`
+> +	else
+> +		RANDVALUE=3D`jot -r 1 0 999999999`
+> +	fi

--=20
Pawel Jakub Dawidek                       http://www.wheel.pl
pjd@FreeBSD.org                           http://www.FreeBSD.org
FreeBSD committer                         Am I Evil? Yes, I Am!

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

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.2 (FreeBSD)

iD8DBQFEWZZHForvXbEpPzQRAinGAJwLP57wnre8x+CGrcIj32iYVPo2ugCgo5pB
8T7B/HbVpIYxPXUb+Yrfvvs=
=sUmZ
-----END PGP SIGNATURE-----

--wTWi5aaYRw9ix9vO--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20060504055103.GC8357>