Re: PATCH: CygWin port enhancement - 2nd revision

From: Guido Serassio <serassio@dont-contact.us>
Date: Sat, 18 Aug 2001 10:10:24 +0200

Hi,

Il 03.43 18/08/2001 Robert Collins ha scritto:
>On 17 Aug 2001 21:24:02 +0200, Guido Serassio wrote:
> > Hi,
> >
> >
> > >This can only occur if a user has deliberately chosen to have that
> > >happen.
> >
> > Sorry, but at this point I'm confused:
> >
> > - Cygwin use Windows host file, but before now I thought that it use
> > /etc/hosts.
>
>All the cygwin internal calls use the windows host file. if you install
>(say) bind 8 & it's resolver library, then that will use /etc/hosts -
>and other programs that have their own resolver - say squid - will also
>use /etc/hosts. Which is why for correct operation it must be a symlink
>to the real windows hosts file.
>
> > - /etc/host is (must be ?) a symlink to the Windows hostfile.
> >
> > But, I have just installed Cygwin, and there is no /etc/host symlink or
> > file, so you say that I must make this symlink ? But if this true, how
> many
> > users make this symlink ?
> > Why this is not made from Cygwin setup ?
>
>How many users use programs that implement their own dns resolver? Not
>many. It's not in setup because no-one has made the time to patch
>setup.exe to do that.
>
> > > > So, as long this CygWin problem is unresolved, we must choice what
> > >default
> > > > host file to use, IMO, is better use the same of the OS, in Windows
> > >system
> > > > directory.
> > >
> > >Errm, if we do that I don't think we'll cause problems, but I suspect we
> > >will get at least 1 bug report on that that we wouldn't otherwise have
> > >gotten :].
> >
> > But also if the hostfile symlink it's not made automatically from Cygwin
> > setup ....
>
>Exactly - Henrik's suggestion was to alter squid to iterate through the
>list of paths and use the first existing file. A file list of
>"/etc/hosts <win9x hosts> <winnt hosts>" will work correctly in all
>cases, with no runtime detection needed.

Sorry, but according to Microsoft specification, hosts file on Windows
system is NEVER static:

correct path are:

%windir%\hosts on Windows 9x systems
%systemroot%\system32\drivers\etc\hosts on NT class systems

Windows 9x system disk different from C: are very unusual, but on Windows
NT this happens more often, for example my machine is a dual boot system,
and Windows 2000 is on D:.
On Windows NT Systems, the OS path resolution is totally dynamic, see
%systemroot%, %systemdrive%, etc.

For example, the correct procedure on NT system to read the hosts file must be:

1) Read from the registry value
HKLM\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters\DataBasePath the
Hosts file location (but this step can be safely skipped, because i never
seen this value changed from %SystemRoot%\System32\drivers\etc).
2) Resolve %SistemRoot%
3) Read Hosts file.

Another thing: using static paths, on dual boot systems can happen everything.

Guido

-
=======================================================
Serassio Guido
Via Albenga, 11/4 10134 - Torino - ITALY
Tel. : +39.011.610749
E-mail: serassio@interfree.it
         serassio@libero.it
WWW: http://www.serassio.it
Received on Sat Aug 18 2001 - 02:10:40 MDT

This archive was generated by hypermail pre-2.1.9 : Tue Dec 09 2003 - 16:14:12 MST