cvs commit: src/usr.sbin/portsnap/portsnap portsnap.sh

Pawel Jakub Dawidek pjd at FreeBSD.org
Thu May 4 05:52:53 UTC 2006


On Wed, May 03, 2006 at 09:29:01PM +0000, Colin Percival wrote:
+> cperciva    2006-05-03 21:29:01 UTC
+> 
+>   FreeBSD src repository
+> 
+>   Modified files:
+>     usr.sbin/portsnap/portsnap portsnap.sh 
+>   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.
+>   
+>   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).
+>   
+>   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=`sha256 -qs "${HTTP_PROXY}" |
+> +		    tr -d 'a-f' |
+> +		    cut -c 1-9`
+> +	else
+> +		RANDVALUE=`jot -r 1 0 999999999`
+> +	fi

-- 
Pawel Jakub Dawidek                       http://www.wheel.pl
pjd at FreeBSD.org                           http://www.FreeBSD.org
FreeBSD committer                         Am I Evil? Yes, I Am!
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 187 bytes
Desc: not available
Url : http://lists.freebsd.org/pipermail/cvs-src/attachments/20060504/f92242e1/attachment.pgp


More information about the cvs-src mailing list