[PATCH] make setup mirror list more like web page not just urls

Ken Brown kbrown@cornell.edu
Fri Nov 17 13:48:00 GMT 2017

On 11/15/2017 4:35 PM, Brian Inglis wrote:
> Hi folks,
> [reposted without text attachment to see if patch gets thru]
> Working on a FAST_CWD FAQ, looking at the Setup mirror site page and the web
> page, I wondered if we could usefully add the mirrors.lst region and territory
> (called area and location in the code) to the Setup display, to avoid users
> having to refer to the web page to find out where mirrors are based geographically.

I think this is a good idea in principle, but it still needs some work.

> The first change was to prefix the displayed_url member in site.cc
> site_list_type::init "constructor" with "area - location - ".
> The sort key was the mirror url host name with the domain components in reverse
> order to sort non-country TLDs together before CC TLDs.
> The code tested for TLD length == 3 to distinguish between CC and non-CC TLDs,
> as this code is over 10 years old and there were only the original com, edu,
> gov, mil, net, org non-CC domains, before other gTLDs were added.
> That test was changed to handle all gTLDs with length >= 3, to prefix area and
> location to the sort key member, reverse the domain components in the servername
> field instead of the url host, and suffix the url protocol prefix to keep the
> key unique where sites offer both ftp and http mirrors, rather than the whole
> url in the original.

Adding the protocol to the key instead of the full url isn't enough to 
guarantee uniqueness of the key.  Users can add their own sites for 
which that fails.  Also, you shouldn't be relying on the servername 
field being filled in.  For example, the function 
SiteSetting::registerSavedSite() explicitly constructs a site 'tempSite' 
that has an empty servername.

> The required patch is attached for discussion: some may not like the display of
> the default mirror from /etc/setup/setup.rc last_mirror, which appears in the
> list as " - - url", as the other mirrors.lst fields are not currently saved
> under last_mirror, and more work may be needed to improve this.

If the saved url corresponds to a site in the list, I think setup should 
recognize this rather than listing the same site again as " - - url".


More information about the Cygwin-apps mailing list