delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2002/09/13/09:20:13

Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sources.redhat.com/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sources.redhat.com/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com
X-Authentication-Warning: slinky.cs.nyu.edu: pechtcha owned process doing -bs
Date: Thu, 12 Sep 2002 14:16:05 -0400 (EDT)
From: Igor Pechtchanski <pechtcha AT cs DOT nyu DOT edu>
Reply-To: cygwin AT cygwin DOT com
To: Nicholas Wourms <nwourms AT yahoo DOT com>
cc: cygwin AT cygwin DOT com
Subject: Re: Release candidate 1: /etc/hosts
In-Reply-To: <20020912175310.82454.qmail@web21004.mail.yahoo.com>
Message-ID: <Pine.GSO.4.44.0209121410020.19696-100000@slinky.cs.nyu.edu>
MIME-Version: 1.0

On Thu, 12 Sep 2002, Nicholas Wourms wrote:

> --- Igor Pechtchanski <pechtcha AT cs DOT nyu DOT edu> wrote:
> > This works on Windows 98 (sort of):
> >
> > BASH-2.05b$ uname -a
> > CYGWIN_98-4.10 FAETON 1.3.12(0.54/3/2) 2002-07-06 02:16 i686
> > unknown
> > BASH-2.05b$ ./make-etc-links.sh
> > create symbolic link `/etc/hosts' to `/cygdrive/c/WINDOWS/hosts'
> > create symbolic link `/etc/protocols' to
> > `/cygdrive/c/WINDOWS/protocol'
> > create symbolic link `/etc/services' to
> > `/cygdrive/c/WINDOWS/services'
> > create symbolic link `/etc/networks' to
> > `/cygdrive/c/WINDOWS/networks'
> > BASH-2.05b$
> >
> > However, two problems:
> >
> > 1) When the script has run, but created a link to a non-existent
> > file, and
> > then run again:
> >
> > BASH-2.05b$ ./make-etc-links.sh
> > /bin/ln: `/etc/protocols': File exists
> > BASH-2.05b$ ls /etc/protocols
> > /etc/protocols
> > BASH-2.05b$ [ ! -e /etc/protocols ]; echo $?
> > 0
> > BASH-2.05b$ [ ! -L /etc/protocols ]; echo $?
> > 1
> > BASH-2.05b$
> >
> > The -e test apparently fails if the file is a symbolic link to a
> > non-existent file (is this a bug?).  I've attached the correction.
>
> Your fix is not correct, as it still doesn't provide uniform
> functionality across all patforms.  What should be done is to check
> for hosts.sam and then copy that to hosts.  Failing that, the file
> should be "touched" to provide a valid target.

The dangling symlink is the desired functionality.  Editing the file will
create the target.  You don't necessarily want the sample file as your
hosts.
My fix was to prevent trying to create a link if one already exists
(because its existence was not detected by 'test -e').  It had nothing to
do with the actual windows files.

> Another problem I just discovered is that on WinME, "protocols" is
> actually "protocol".  Dunno if this is the same for Win9x or not...

Yes, it's the same even on Win2k.  The 'expr substr $FILE 1 8' in the
script takes care of that.
	Igor
-- 
				http://cs.nyu.edu/~pechtcha/
      |\      _,,,---,,_		pechtcha AT cs DOT nyu DOT edu
ZZZzz /,`.-'`'    -.  ;-;;,_		igor AT watson DOT ibm DOT com
     |,4-  ) )-,_. ,\ (  `'-'		Igor Pechtchanski
    '---''(_/--'  `-'\_) fL	a.k.a JaguaR-R-R-r-r-r-.-.-.  Meow!

It took the computational power of three Commodore 64s to fly to the moon.
It takes a 486 to run Windows 95.  Something is wrong here. -- SC sig file


--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Bug reporting:         http://cygwin.com/bugs.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019