public inbox for cygwin@cygwin.com
 help / color / mirror / Atom feed
From: Igor Pechtchanski <pechtcha@cs.nyu.edu>
To: cygwin@cygwin.com
Cc: Paul Johnston <paj@pajhome.org.uk>
Subject: Re: Release candidate 1: /etc/hosts
Date: Thu, 12 Sep 2002 10:49:00 -0000	[thread overview]
Message-ID: <Pine.GSO.4.44.0209121221240.19696-300000@slinky.cs.nyu.edu> (raw)
In-Reply-To: <3D80A15A.D7D2CF13@pajhome.org.uk>

[-- Attachment #1: Type: TEXT/PLAIN, Size: 1896 bytes --]

On Thu, 12 Sep 2002, Paul Johnston wrote:

> Hi,
> Thanks to Corinna, Joe, Nicholas, Warren and especially Igor, this
> script should now be good enough. I've successfully tested it on XP
> only.

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.

2) CYGWIN="check_case:strict"
As I suspected earlier, this fails -- the links are created, but an
attempt to cat the files results in "no such file or directory", and an
attempt to save the file after editing results in a write error.  On my
Windows 98, cygwin interprets the filenames for c:\windows\hosts, etc, as
all caps.  I don't know how important this is to pursue.
	Igor
-- 
				http://cs.nyu.edu/~pechtcha/
      |\      _,,,---,,_		pechtcha@cs.nyu.edu
ZZZzz /,`.-'`'    -.  ;-;;,_		igor@watson.ibm.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

[-- Attachment #2: Type: TEXT/PLAIN, Size: 734 bytes --]

#!/bin/sh
#--
# Create symbolic links from some /etc files to the Windows equivalents
#--

FILES="hosts protocols services networks"

OSNAME=`/bin/uname -s`
WINHOME=`/bin/cygpath -W`

case "$OSNAME" in
  CYGWIN_NT*) WINETC="$WINHOME/system32/drivers/etc" ;;
  CYGWIN_9*|CYGWIN_ME*) WINETC="$WINHOME" ;;
  *) 
    echo "Unknown system type $OSNAME; exiting" >&2
    exit 0
  ;;
esac

if [ ! -d "$WINETC" ]
then
  echo "Directory $WINETC does not exist; exiting" >&2
  exit 0
fi

for FILE in $FILES
do
  if [ ! -e "/etc/$FILE" -a ! -L "/etc/$FILE" ]
  then
    # Windows only uses the first 8 characters
    WFILE=`expr substr "$FILE" 1 8`
    /bin/ln -s -v "$WINETC/$WFILE" "/etc/$FILE"
  fi
done



[-- Attachment #3: Type: TEXT/PLAIN, Size: 348 bytes --]

--- make-etc-links.sh-0.6	2002-09-12 10:08:17.000000000 -0400
+++ make-etc-links.sh	2002-09-12 13:05:02.000000000 -0400
@@ -25,7 +25,7 @@ fi
 
 for FILE in $FILES
 do
-  if [ ! -e "/etc/$FILE" ]
+  if [ ! -e "/etc/$FILE" -a ! -L "/etc/$FILE" ]
   then
     # Windows only uses the first 8 characters
     WFILE=`expr substr "$FILE" 1 8`

[-- Attachment #4: Type: text/plain, Size: 214 bytes --]

--
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/

  parent reply	other threads:[~2002-09-12 17:11 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-09-12  7:28 Paul Johnston
2002-09-12  8:13 ` Gerrit P. Haase
2002-09-12 10:49 ` Igor Pechtchanski [this message]
2002-09-12 10:53   ` Nicholas Wourms
2002-09-12 11:16     ` Igor Pechtchanski
2002-09-12 11:15   ` Nicholas Wourms
2002-09-12 11:33     ` Igor Pechtchanski
2002-09-12 11:29   ` Paul Johnston
2002-09-12 11:42     ` Igor Pechtchanski
2002-09-12 11:44       ` Paul Johnston
2002-09-12 15:01         ` Igor Pechtchanski
2002-09-12 17:16           ` Finding exact case of paths Paul Johnston
2002-09-12 17:52             ` Igor Pechtchanski
2002-09-12 20:14               ` Igor Pechtchanski
2002-09-13  1:12                 ` Igor Pechtchanski
2002-09-13  5:58                   ` Release candidate 2: /etc/hosts Paul Johnston
2002-09-13  7:38                     ` Igor Pechtchanski
2002-09-15  2:47                       ` Installing cygwin-mketc.sh Paul Johnston
2002-09-15  5:53                         ` John Morrison
2002-09-15  6:49                         ` John Morrison
2002-09-15  7:17                           ` John Morrison
2002-09-15  9:44                             ` Igor Pechtchanski
2002-09-15  9:28                         ` Igor Pechtchanski

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=Pine.GSO.4.44.0209121221240.19696-300000@slinky.cs.nyu.edu \
    --to=pechtcha@cs.nyu.edu \
    --cc=cygwin@cygwin.com \
    --cc=paj@pajhome.org.uk \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).