public inbox for cygwin@cygwin.com
 help / color / mirror / Atom feed
* Release candidate 1: /etc/hosts
@ 2002-09-12  7:28 Paul Johnston
  2002-09-12  8:13 ` Gerrit P. Haase
  2002-09-12 10:49 ` Igor Pechtchanski
  0 siblings, 2 replies; 23+ messages in thread
From: Paul Johnston @ 2002-09-12  7:28 UTC (permalink / raw)
  To: cygwin

[-- Attachment #1: Type: text/plain, Size: 350 bytes --]

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.

BTW, this version uses uname to get the OS - the most reliable way.
Also, if for some reason a user wanted to lie to the script, uname would
be the obvious choice without having to read to source.

Paul

[-- Attachment #2: make-etc-links.sh --]
[-- Type: application/x-sh, Size: 677 bytes --]

[-- Attachment #3: 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/

^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: Release candidate 1: /etc/hosts
  2002-09-12  7:28 Release candidate 1: /etc/hosts Paul Johnston
@ 2002-09-12  8:13 ` Gerrit P. Haase
  2002-09-12 10:49 ` Igor Pechtchanski
  1 sibling, 0 replies; 23+ messages in thread
From: Gerrit P. Haase @ 2002-09-12  8:13 UTC (permalink / raw)
  To: cygwin

Paul schrieb:

> I've successfully tested it on XP only.

$ mketc.sh
create symbolic link `/etc/hosts' to `/c/WINNT/system32/drivers/etc/hosts'
create symbolic link `/etc/protocols' to `/c/WINNT/system32/drivers/etc/protocol'
create symbolic link `/etc/services' to `/c/WINNT/system32/drivers/etc/services'
create symbolic link `/etc/networks' to `/c/WINNT/system32/drivers/etc/networks'

It works fine on W2K & NT4.


Gerrit
-- 
=^..^=


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

^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: Release candidate 1: /etc/hosts
  2002-09-12  7:28 Release candidate 1: /etc/hosts Paul Johnston
  2002-09-12  8:13 ` Gerrit P. Haase
@ 2002-09-12 10:49 ` Igor Pechtchanski
  2002-09-12 10:53   ` Nicholas Wourms
                     ` (2 more replies)
  1 sibling, 3 replies; 23+ messages in thread
From: Igor Pechtchanski @ 2002-09-12 10:49 UTC (permalink / raw)
  To: cygwin; +Cc: Paul Johnston

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

^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: Release candidate 1: /etc/hosts
  2002-09-12 10:49 ` Igor Pechtchanski
@ 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:29   ` Paul Johnston
  2 siblings, 1 reply; 23+ messages in thread
From: Nicholas Wourms @ 2002-09-12 10:53 UTC (permalink / raw)
  To: cygwin; +Cc: Paul Johnston


--- Igor Pechtchanski <pechtcha@cs.nyu.edu> wrote:
> 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.

Why not just check for all the possible combinations [HOSTS, Hosts,
hosts]?  I use check_case:strict on a daily basis.  If you don't use
it, then you cannot compile gcj java programs at times.  Also, you
cannot bootstrap gcc with java enabled.  I think this is important
and heads of questions in the long run.

Cheers,
Nicholas

__________________________________________________
Yahoo! - We Remember
9-11: A tribute to the more than 3,000 lives lost
http://dir.remember.yahoo.com/tribute

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

^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: Release candidate 1: /etc/hosts
  2002-09-12 10:49 ` Igor Pechtchanski
  2002-09-12 10:53   ` Nicholas Wourms
@ 2002-09-12 11:15   ` Nicholas Wourms
  2002-09-12 11:33     ` Igor Pechtchanski
  2002-09-12 11:29   ` Paul Johnston
  2 siblings, 1 reply; 23+ messages in thread
From: Nicholas Wourms @ 2002-09-12 11:15 UTC (permalink / raw)
  To: cygwin


--- Igor Pechtchanski <pechtcha@cs.nyu.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.

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

Cheers,
Nicholas

__________________________________________________
Do you Yahoo!?
Yahoo! News - Today's headlines
http://news.yahoo.com

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

^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: Release candidate 1: /etc/hosts
  2002-09-12 10:53   ` Nicholas Wourms
@ 2002-09-12 11:16     ` Igor Pechtchanski
  0 siblings, 0 replies; 23+ messages in thread
From: Igor Pechtchanski @ 2002-09-12 11:16 UTC (permalink / raw)
  To: Nicholas Wourms; +Cc: cygwin, Paul Johnston

On Thu, 12 Sep 2002, Nicholas Wourms wrote:

> --- Igor Pechtchanski <pechtcha@cs.nyu.edu> wrote:
> > 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.
>
> Why not just check for all the possible combinations [HOSTS, Hosts,
> hosts]?  I use check_case:strict on a daily basis.  If you don't use
> it, then you cannot compile gcj java programs at times.  Also, you
> cannot bootstrap gcc with java enabled.  I think this is important
> and heads of questions in the long run.

Ahem, there are 32 possible combinations for hosts, and 256 for networks,
services and protocols (windows only uses the first 8 letters).  I realize
that most of them are improbable, but for the script to be robust, it
should be able to handle any of them.

I also constantly use check_case:strict, which is why I raised the concern
in the first place.  On my 2k system, the following will return the
exact case: 'cmd /c "dir /b "`cygpath -w $file`'...  Can someone verify
that this (with the appropriate correction of "cmd" to "command.com", of
course) also works on 9x/ME systems?
	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


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

^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: Release candidate 1: /etc/hosts
  2002-09-12 10:49 ` Igor Pechtchanski
  2002-09-12 10:53   ` Nicholas Wourms
  2002-09-12 11:15   ` Nicholas Wourms
@ 2002-09-12 11:29   ` Paul Johnston
  2002-09-12 11:42     ` Igor Pechtchanski
  2 siblings, 1 reply; 23+ messages in thread
From: Paul Johnston @ 2002-09-12 11:29 UTC (permalink / raw)
  To: cygwin

Hi

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

Ah, I bet NT based ones would do also - if you were using the FAT file system.

I think this problem needs to be dealt with... and I'm starting to think that
modifying cygpath would be the cleanest way to achieve this.

Paul


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

^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: Release candidate 1: /etc/hosts
  2002-09-12 11:15   ` Nicholas Wourms
@ 2002-09-12 11:33     ` Igor Pechtchanski
  0 siblings, 0 replies; 23+ messages in thread
From: Igor Pechtchanski @ 2002-09-12 11:33 UTC (permalink / raw)
  To: Nicholas Wourms; +Cc: cygwin

On Thu, 12 Sep 2002, Nicholas Wourms wrote:

> --- Igor Pechtchanski <pechtcha@cs.nyu.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@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


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

^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: Release candidate 1: /etc/hosts
  2002-09-12 11:29   ` Paul Johnston
@ 2002-09-12 11:42     ` Igor Pechtchanski
  2002-09-12 11:44       ` Paul Johnston
  0 siblings, 1 reply; 23+ messages in thread
From: Igor Pechtchanski @ 2002-09-12 11:42 UTC (permalink / raw)
  To: Paul Johnston; +Cc: cygwin

On Thu, 12 Sep 2002, Paul Johnston wrote:

> > 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.
>
> Ah, I bet NT based ones would do also - if you were using the FAT file
> system.
>
> I think this problem needs to be dealt with... and I'm starting to think
> that modifying cygpath would be the cleanest way to achieve this.

How exactly are you proposing to modify cygpath?  cygpath translates
windows paths to unix-style, and back.  There is nothing in the cygpath
spec that says that the path should already exist...  "cygpath -W" already
returns the correct case for the path to windows, I'm actually more
concerned about the filenames and the "/system32/drivers/etc" bit.  I
suppose the directory case could be determined by using a "(cd && pwd)"
pair...
	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


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

^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: Release candidate 1: /etc/hosts
  2002-09-12 11:42     ` Igor Pechtchanski
@ 2002-09-12 11:44       ` Paul Johnston
  2002-09-12 15:01         ` Igor Pechtchanski
  0 siblings, 1 reply; 23+ messages in thread
From: Paul Johnston @ 2002-09-12 11:44 UTC (permalink / raw)
  To: cygwin

Igor,

> How exactly are you proposing to modify cygpath?  cygpath translates
> windows paths to unix-style, and back.  There is nothing in the cygpath

Sorry, should have been clearer about this: modifying cygpath to add a feature to
get the correct case for a path. Perhaps we could figure a way to use "dir /b" -
but I'm sure other people will hit this same issue in the future and would
appreciate such a feature in cygpath. If you agree this is a good idea, I'm
prepared to do the groundwork.

Failing that, I think it would be ok to assume that the path will either be all
caps or all non-caps - corresponding to FAT or NTFS. Anyone tweaking the case of
such paths/files on NTFS quite deserves their fate!

BTW, I'm subbed to cygwin so you don't need to keep copying me on mails.

Paul


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

^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: Release candidate 1: /etc/hosts
  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
  0 siblings, 1 reply; 23+ messages in thread
From: Igor Pechtchanski @ 2002-09-12 15:01 UTC (permalink / raw)
  To: cygwin

On Thu, 12 Sep 2002, Paul Johnston wrote:

> Igor,
>
> > How exactly are you proposing to modify cygpath?  cygpath translates
> > windows paths to unix-style, and back.  There is nothing in the cygpath
>
> Sorry, should have been clearer about this: modifying cygpath to add a
> feature to get the correct case for a path. Perhaps we could figure a
> way to use "dir /b" - but I'm sure other people will hit this same issue
> in the future and would appreciate such a feature in cygpath. If you
> agree this is a good idea, I'm prepared to do the groundwork.

Oh, I see, add a modifier similar to '-s', so that it verifies the case of
each element in the path...  Yeah, that could work, something like:
  -e, --exact-case      print exact case of NAME

I'm not sure how to implement this, though...  If you have ideas, I'd be
interested in hearing them.

> Failing that, I think it would be ok to assume that the path will either
> be all caps or all non-caps - corresponding to FAT or NTFS. Anyone
> tweaking the case of such paths/files on NTFS quite deserves their fate!

Well, on my Win2k machine, the exact case is as follows:
C:\WINNT\system32\drivers\etc\hosts.  Notice that "WINNT" is all caps.  I
use NTFS, and this is apparently the default setup.

> BTW, I'm subbed to cygwin so you don't need to keep copying me on mails.

Oops, sorry, this is the default in my mailer.  I'll be more careful.
	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


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

^ permalink raw reply	[flat|nested] 23+ messages in thread

* Finding exact case of paths
  2002-09-12 15:01         ` Igor Pechtchanski
@ 2002-09-12 17:16           ` Paul Johnston
  2002-09-12 17:52             ` Igor Pechtchanski
  0 siblings, 1 reply; 23+ messages in thread
From: Paul Johnston @ 2002-09-12 17:16 UTC (permalink / raw)
  To: cygwin

[-- Attachment #1: Type: text/plain, Size: 731 bytes --]

Hi,

> Oh, I see, add a modifier similar to '-s', so that it verifies the case of
> each element in the path...  Yeah, that could work, something like:
>   -e, --exact-case      print exact case of NAME

Yep, exactly. Now, cygpath seems to generally not hit the filesystem - cygpath
c:/complete/crap gives me /c/complete/crap so using that switch will
necessarily involve a performance hit. Given that, I think I'm happy with my
solution based on dirent/strcasecmp. I've attached a stand-alone utility that
seems to work (just on cygwin paths), although it has the side effect of
squishing down multiple slashes ///like////this//path down to /like/this/path.

I think it would be ok to restrict --exact-case to cygwin paths.

Paul

[-- Attachment #2: exactcase.c --]
[-- Type: text/plain, Size: 1802 bytes --]

#include <sys/types.h>
#include <dirent.h>
#include <errno.h>
#include <limits.h>
#include <string.h>

#include <stdio.h> /* Only needed for test code */

/***
 * Main subroutine is just for testing
 **/
int main(int argc, char *argv[])
{
  char path[PATH_MAX];
  if(argc == 2)
  {
    strcpy(path, argv[1]);
    if(exact_case(path)) printf("OUTPUT: %s\n", path);
    else printf("ERROR: %s\n", strerror(errno));
  }
  return 0;
}

/***
 * Vague attempt to make code independent of path type
 **/
#define DLM_STR "/"
#define DLM_CHR '/'
#define CWD_STR "."
#define IS_ABSOLUTE(X) (X[0] == DLM_CHR)

/***
 * Determine the correct case for a cygwin path, fill-in in place
 * Returns TRUE/FALSE - success/failure
 **/
int exact_case(char *path)
{
  char work[PATH_MAX], *part, path_strtok[PATH_MAX];

  if(strlen(path) > (PATH_MAX - 1)) /* PATH_MAX allows for the NUL */
  {
    errno = ENAMETOOLONG;
    return 0;
  }

  strcpy(path_strtok, path);
  part = strtok(path_strtok, DLM_STR);

  if(IS_ABSOLUTE(path))
  {
    if(!exact_case_part(DLM_STR, part)) return 0;
    strcpy(work, DLM_STR);
    strcat(work, part);
  }
  else
  {
    if(!exact_case_part(CWD_STR, part)) return 0;
    strcpy(work, part);
  }

  while(part = strtok(NULL, DLM_STR))
  {
    if(!exact_case_part(work, part)) return 0;
    strcat(work, DLM_STR);
    strcat(work, part);
  }

  strcpy(path, work);
  return 1;
}

/***
 * Search a directory for an entry; fill-in it's correct case
 * Returns TRUE/FALSE - success/failure
 **/
int exact_case_part(const char *base, char *part)
{
  struct dirent *de;
  DIR *dh = opendir(base);
  if(!dh) return 0;
  while(de = readdir(dh))
  {
    if(strcasecmp(part, de->d_name) == 0) break;
  }
  closedir(dh);
  if(de) strcpy(part, de->d_name);
  else errno = ENOENT;
  return (int) de;
}


[-- Attachment #3: 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/

^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: Finding exact case of paths
  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
  0 siblings, 1 reply; 23+ messages in thread
From: Igor Pechtchanski @ 2002-09-12 17:52 UTC (permalink / raw)
  To: cygwin

On Fri, 13 Sep 2002, Paul Johnston wrote:

> > Oh, I see, add a modifier similar to '-s', so that it verifies the case of
> > each element in the path...  Yeah, that could work, something like:
> >   -e, --exact-case      print exact case of NAME
>
> Yep, exactly. Now, cygpath seems to generally not hit the filesystem -
> cygpath c:/complete/crap gives me /c/complete/crap so using that switch
> will necessarily involve a performance hit. Given that, I think I'm
> happy with my solution based on dirent/strcasecmp. I've attached a
> stand-alone utility that seems to work (just on cygwin paths), although
> it has the side effect of squishing down multiple slashes
> ///like////this//path down to /like/this/path.
>
> I think it would be ok to restrict --exact-case to cygwin paths.

I don't think there's a need to search the directory yourself.  Upon
browsing the cygpath code some more, I realized that it is doing exactly
what we need (i.e. convert to the exact path) when returning the system
directory (the '-S' flag).  Quoting the code (cygpath.cc:396):

    case 'S':
      GetSystemDirectory (buf, MAX_PATH);
      FindFirstFile (buf, &w32_fd);
      strcpy (strrchr (buf, '\\') + 1, w32_fd.cFileName);
      break;

So we can do the same trick with each filename when our option ('-e') is
in effect.  I'm looking at a fix to cygpath now, and will submit a patch
as soon as I have it ready.

On a separate note, I found that "cygpath -l -w <path>" does not work on
my Win2k SP2 system, returning the same garbage (hex 20 FB 22 0a)
regardless of the path.  Anyone else have that problem?
	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


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

^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: Finding exact case of paths
  2002-09-12 17:52             ` Igor Pechtchanski
@ 2002-09-12 20:14               ` Igor Pechtchanski
  2002-09-13  1:12                 ` Igor Pechtchanski
  0 siblings, 1 reply; 23+ messages in thread
From: Igor Pechtchanski @ 2002-09-12 20:14 UTC (permalink / raw)
  To: cygwin

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

On Thu, 12 Sep 2002, Igor Pechtchanski wrote:

> On Fri, 13 Sep 2002, Paul Johnston wrote:
>
> > > Oh, I see, add a modifier similar to '-s', so that it verifies the case of
> > > each element in the path...  Yeah, that could work, something like:
> > >   -e, --exact-case      print exact case of NAME
> >
> > Yep, exactly. Now, cygpath seems to generally not hit the filesystem -
> > cygpath c:/complete/crap gives me /c/complete/crap so using that switch
> > will necessarily involve a performance hit. Given that, I think I'm
> > happy with my solution based on dirent/strcasecmp. I've attached a
> > stand-alone utility that seems to work (just on cygwin paths), although
> > it has the side effect of squishing down multiple slashes
> > ///like////this//path down to /like/this/path.
> >
> > I think it would be ok to restrict --exact-case to cygwin paths.
>
> I don't think there's a need to search the directory yourself.  Upon
> browsing the cygpath code some more, I realized that it is doing exactly
> what we need (i.e. convert to the exact path) when returning the system
> directory (the '-S' flag).  Quoting the code (cygpath.cc:396):
>
>     case 'S':
>       GetSystemDirectory (buf, MAX_PATH);
>       FindFirstFile (buf, &w32_fd);
>       strcpy (strrchr (buf, '\\') + 1, w32_fd.cFileName);
>       break;
>
> So we can do the same trick with each filename when our option ('-e') is
> in effect.  I'm looking at a fix to cygpath now, and will submit a patch
> as soon as I have it ready.
>
> On a separate note, I found that "cygpath -l -w <path>" does not work on
> my Win2k SP2 system, returning the same garbage (hex 20 FB 22 0a)
> regardless of the path.  Anyone else have that problem?

Well, after further reading of the code and experimenting I've determined
two things:
1) the '-l' option of cygpath works in the cvs HEAD, and
2) it does exactly what we need (thanks, Corinna).

So we can use $(cygpath -u $(cygpath -l -w "$WINETC/$WFILE")) in the
script.  This would require people to upgrade to the new cygpath (which
they would have to anyway, if they were to use the option we proposed),
which means that this script can not be released before the next cygwin,
but that is probably fine.  New version and diff attached.
	Igor
P.S. I'm racking my brain trying to figure out why -l didn't work for me
in version 1.21 of cygpath, but did in version 1.22.  As far as I could
see, the only changes to cygpath were some added newlines...
-- 
				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: 789 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="$WINETC/"`expr substr "$FILE" 1 8`
    WFILE=$(cygpath -u "$(cygpath -w -l "$WFILE")")
    /bin/ln -s -v "$WFILE" "/etc/$FILE"
  fi
done



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

--- make-etc-links.sh-0.7	2002-09-12 13:05:02.000000000 -0400
+++ make-etc-links.sh	2002-09-12 22:37:16.000000000 -0400
@@ -28,8 +28,9 @@ 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"
+    WFILE="$WINETC/"`expr substr "$FILE" 1 8`
+    WFILE=$(cygpath -u "$(cygpath -w -l "$WFILE")")
+    /bin/ln -s -v "$WFILE" "/etc/$FILE"
   fi
 done
 

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

^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: Finding exact case of paths
  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
  0 siblings, 1 reply; 23+ messages in thread
From: Igor Pechtchanski @ 2002-09-13  1:12 UTC (permalink / raw)
  To: cygwin

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

On Thu, 12 Sep 2002, Igor Pechtchanski wrote:

> On Thu, 12 Sep 2002, Igor Pechtchanski wrote:
> > On a separate note, I found that "cygpath -l -w <path>" does not work on
> > my Win2k SP2 system, returning the same garbage (hex 20 FB 22 0a)
> > regardless of the path.  Anyone else have that problem?
>
> Well, after further reading of the code and experimenting I've determined
> two things:
> 1) the '-l' option of cygpath works in the cvs HEAD, and
> 2) it does exactly what we need (thanks, Corinna).
>
> So we can use $(cygpath -u $(cygpath -l -w "$WINETC/$WFILE")) in the
> script.  This would require people to upgrade to the new cygpath (which
> they would have to anyway, if they were to use the option we proposed),
> which means that this script can not be released before the next cygwin,
> but that is probably fine.  New version and diff attached.
>         Igor
> P.S. I'm racking my brain trying to figure out why -l didn't work for me
> in version 1.21 of cygpath, but did in version 1.22.  As far as I could
> see, the only changes to cygpath were some added newlines...

Whoops, forgot to quote the strings.  Better correct it.  New version
attached.
As for the '-l' in 1.21 issue, there were changes to newlib which have
probably fixed some string bug that caused this.
	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: 795 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="$WINETC/`expr substr "$FILE" 1 8`"
    WFILE="$(cygpath -u "$(cygpath -w -l "$WFILE")")"
    /bin/ln -s -v "$WFILE" "/etc/$FILE"
  fi
done



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

--- make-etc-links.sh-0.8	2002-09-12 22:37:16.000000000 -0400
+++ make-etc-links.sh	2002-09-12 23:05:43.000000000 -0400
@@ -5,8 +5,8 @@
 
 FILES="hosts protocols services networks"
 
-OSNAME=`/bin/uname -s`
-WINHOME=`/bin/cygpath -W`
+OSNAME="`/bin/uname -s`"
+WINHOME="`/bin/cygpath -W`"
 
 case "$OSNAME" in
   CYGWIN_NT*) WINETC="$WINHOME/system32/drivers/etc" ;;
@@ -28,8 +28,8 @@ do
   if [ ! -e "/etc/$FILE" -a ! -L "/etc/$FILE" ]
   then
     # Windows only uses the first 8 characters
-    WFILE="$WINETC/"`expr substr "$FILE" 1 8`
-    WFILE=$(cygpath -u "$(cygpath -w -l "$WFILE")")
+    WFILE="$WINETC/`expr substr "$FILE" 1 8`"
+    WFILE="$(cygpath -u "$(cygpath -w -l "$WFILE")")"
     /bin/ln -s -v "$WFILE" "/etc/$FILE"
   fi
 done

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

^ permalink raw reply	[flat|nested] 23+ messages in thread

* Release candidate 2: /etc/hosts
  2002-09-13  1:12                 ` Igor Pechtchanski
@ 2002-09-13  5:58                   ` Paul Johnston
  2002-09-13  7:38                     ` Igor Pechtchanski
  0 siblings, 1 reply; 23+ messages in thread
From: Paul Johnston @ 2002-09-13  5:58 UTC (permalink / raw)
  To: cygwin

[-- Attachment #1: Type: text/plain, Size: 633 bytes --]

Hi,

> > 1) the '-l' option of cygpath works in the cvs HEAD, and
> > 2) it does exactly what we need (thanks, Corinna).

Cool... I've just modified your code to correct case on $WINETC before we do the
directory check. This has the side-effect of catching the cygpath bug without
creating any links.

As for the script name, given the scope of /etc/postinstall I think it should
contain the package name. Someone suggested mketc.sh and that's fairly
consistent with the old-skool MKDEV script. So I think it should be called
cygwin-mketc.sh.

How come your script works when cygpath is called inside $(...) but not
backticks?

Paul

[-- Attachment #2: cygwin-mketc.sh --]
[-- Type: application/x-sh, Size: 905 bytes --]

[-- Attachment #3: cygwin-mketc.sh-0.9.diff --]
[-- Type: text/plain, Size: 286 bytes --]

19a20
> WINETC="$(/bin/cygpath -u "$(/bin/cygpath -w -l "$WINETC")")"
22a24
>   echo "If directory name is garbage, update cygpath to 1.22 or later" >&2
32c34
<     WFILE="$(cygpath -u "$(cygpath -w -l "$WFILE")")"
---
>     WFILE="$(/bin/cygpath -u "$(/bin/cygpath -w -l "$WFILE")")"


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

^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: Release candidate 2: /etc/hosts
  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
  0 siblings, 1 reply; 23+ messages in thread
From: Igor Pechtchanski @ 2002-09-13  7:38 UTC (permalink / raw)
  To: cygwin

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

On Fri, 13 Sep 2002, Paul Johnston wrote:

> Hi,
>
> > > 1) the '-l' option of cygpath works in the cvs HEAD, and
> > > 2) it does exactly what we need (thanks, Corinna).
>
> Cool... I've just modified your code to correct case on $WINETC before
> we do the directory check.  This has the side-effect of catching the
> cygpath bug without creating any links.

Paul, the bug was not in cygpath, but somewhere in newlib (apparently).
The only fault of the current cygpath is that it was compiled on June 6,
against faulty libraries.  This should not be a problem in the new release
of cygwin.  So, the check is redundant (or, in any event, the message is
wrong -- you can't upgrade cygpath; it should be "upgrade to new cygwin").
It does not speed up the script, either, since the $WINETC directory will
still be processed and corrected every time cygpath is called.

> As for the script name, given the scope of /etc/postinstall I think it
> should contain the package name.  Someone suggested mketc.sh and that's
> fairly consistent with the old-skool MKDEV script.  So I think it should
> be called cygwin-mketc.sh.

Fair enough.  If I read the name correctly, this script would become part
of the cygwin package.  In this case the cygpath message is really
redundant and needs to be taken out altogether.  That message only makes
sense if the script is in a package other than cygwin (so people can
install it without updating cygwin).

> How come your script works when cygpath is called inside $(...) but not
> backticks?

The backtick syntax does not allow recursive invocations.  If we want to
use the backtick syntax, we should use something like

    WFILE="`cygpath -w -l "$WFILE"`"
    WFILE="`cygpath -u "$WFILE"`"

I've attached the message correction.  If this is really part of cygwin,
please take it out altogether, along with the translation of $WINETC.
	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: 933 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

WINETC="$(/bin/cygpath -u "$(/bin/cygpath -w -l "$WINETC")")"
if [ ! -d "$WINETC" ]
then
  echo "Directory $WINETC does not exist; exiting" >&2
  echo "If directory name is garbage, please update cygwin" >&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="$WINETC/`expr substr "$FILE" 1 8`"
    WFILE="$(/bin/cygpath -u "$(/bin/cygpath -w -l "$WFILE")")"
    /bin/ln -s -v "$WFILE" "/etc/$FILE"
  fi
done



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

--- cygwin-mketc.sh-0.9	2002-09-13 07:02:41.000000000 -0400
+++ cygwin-mketc.sh	2002-09-13 10:13:13.000000000 -0400
@@ -21,7 +21,7 @@ WINETC="$(/bin/cygpath -u "$(/bin/cygpat
 if [ ! -d "$WINETC" ]
 then
   echo "Directory $WINETC does not exist; exiting" >&2
-  echo "If directory name is garbage, update cygpath to 1.22 or later" >&2
+  echo "If directory name is garbage, please update cygwin" >&2
   exit 0
 fi
 

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

^ permalink raw reply	[flat|nested] 23+ messages in thread

* Installing cygwin-mketc.sh
  2002-09-13  7:38                     ` Igor Pechtchanski
@ 2002-09-15  2:47                       ` Paul Johnston
  2002-09-15  5:53                         ` John Morrison
                                           ` (2 more replies)
  0 siblings, 3 replies; 23+ messages in thread
From: Paul Johnston @ 2002-09-15  2:47 UTC (permalink / raw)
  To: cygwin

[-- Attachment #1: Type: text/plain, Size: 656 bytes --]

Hi,

How does cygwin install decide where to put files? I was expecting some kind
of map file mapping object files to installed files, but I couldn't find one.
I can see we want cygwin-mketc.sh to end up in configure's $sysconfdir but
beyond that I'm just getting lost

> I've attached the message correction.  If this is really part of cygwin,
> please take it out altogether, along with the translation of $WINETC.

Ok, I've taken out the message, but NOT the case translation of $WINETC. The
case translation must be done before the directory existence check, or the
check might fail. I think this has got to be the final version of the code
now.

Paul

[-- Attachment #2: cygwin-mketc.sh --]
[-- Type: application/x-sh, Size: 831 bytes --]

[-- Attachment #3: 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/

^ permalink raw reply	[flat|nested] 23+ messages in thread

* RE: Installing cygwin-mketc.sh
  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  9:28                         ` Igor Pechtchanski
  2 siblings, 0 replies; 23+ messages in thread
From: John Morrison @ 2002-09-15  5:53 UTC (permalink / raw)
  To: cygwin

> From: Paul Johnston
> Hi,
>
> How does cygwin install decide where to put files?

It un-tar's them from /.

> I was expecting some kind
> of map file mapping object files to installed files, but I
> couldn't find one.

map file mapping object?

> I can see we want cygwin-mketc.sh to end up in configure's $sysconfdir but
> beyond that I'm just getting lost

I'd have thought /etc/postinstall would be where it needs to be.

If folks agree, I can add your script as part of one of the base-
packages I'm putting together...

base-files (a replacement /etc/profile)
base-passwd (a replacement 'create password/group' script)

but I'm unsure as to which would be best.  Rob?  Christopher?

J.

> > I've attached the message correction.  If this is really part of cygwin,
> > please take it out altogether, along with the translation of $WINETC.
>
> Ok, I've taken out the message, but NOT the case translation of
> $WINETC. The
> case translation must be done before the directory existence check, or the
> check might fail. I think this has got to be the final version of the code
> now.
>
> Paul
>


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

^ permalink raw reply	[flat|nested] 23+ messages in thread

* RE: Installing cygwin-mketc.sh
  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:28                         ` Igor Pechtchanski
  2 siblings, 1 reply; 23+ messages in thread
From: John Morrison @ 2002-09-15  6:49 UTC (permalink / raw)
  To: cygwin

[-- Attachment #1: Type: text/plain, Size: 604 bytes --]

> From: Paul Johnston
>
> > I've attached the message correction.  If this is really part of cygwin,
> > please take it out altogether, along with the translation of $WINETC.
>
> Ok, I've taken out the message, but NOT the case translation of
> $WINETC. The
> case translation must be done before the directory existence check, or the
> check might fail. I think this has got to be the final version of the code
> now.

BTW,

$ cygpath -w -l "/cygdrive/c/WINNT/system32/drivers/etc"
 u"

This doesn't work (on my system at least :).  It was fine upto
attempting the -w -l...

(cygcheck -s attached).

J.

[-- Attachment #2: cygcheck.txt --]
[-- Type: text/plain, Size: 15502 bytes --]


Cygwin Win95/NT Configuration Diagnostics
Current System Time: Sun Sep 15 13:48:06 2002

Windows 2000 Professional Ver 5.0 Build 2195 Service Pack 2

Path:	C:\cygwin\usr\sbin
	C:\cygwin\usr\X11R6\bin
	C:\cygwin\home\john\projects\exe
	C:\cygwin\home\john\projects\exe\sh
	C:\cygwin\usr\local\bin
	C:\cygwin\bin
	C:\cygwin\bin
	C:\cygwin\bin
	c:\wrkfile2\java\1\3\1_03\bin
	c:\WINNT\system32
	c:\WINNT
	c:\WINNT\System32\Wbem
	c:\Program Files\Microsoft Visual Studio\Common\Tools\WinNT
	c:\Program Files\Microsoft Visual Studio\Common\MSDev98\Bin
	c:\Program Files\Microsoft Visual Studio\Common\Tools
	c:\Program Files\Microsoft Visual Studio\VC98\bin
	C:\cygwin\usr\X11R6\bin
	c:\wrkfile2\java\1\3\1_03
	C:\cygwin\home\john\Applications\ant\latest\bin
	C:\cygwin\usr\local\lib
	C:\cygwin\usr\local\lib\qt2\bin

SysDir: C:\WINNT\System32
WinDir: C:\WINNT

CYGWIN = `binmode ntsec tty'
HOME = `C:\cygwin\home\john'
LD_LIBRARY_PATH = `\usr\local\lib\qt2\lib:\usr\local\lib:'
MAKE_MODE = `unix'
PWD = `/home/john'
USER = `john'

Use `-r' to scan registry

a:  fd           N/A    N/A                    
c:  hd  NTFS   20002Mb  88% CP CS UN PA FC     
d:  cd  CDFS     696Mb 100%    CS UN           Schizm_1

C:\cygwin                          /                         system  binmode
C:\cygwin/bin                      /usr/bin                  system  binmode
C:\cygwin/lib                      /usr/lib                  system  binmode
C:\cygwin\usr\X11R6\lib\X11\fonts  /usr/X11R6/lib/X11/fonts  system  binmode
.                                  /cygdrive                 user    binmode,cygdrive

Found: C:\cygwin\bin\bash.exe
Found: C:\cygwin\bin\cat.exe
Found: C:\cygwin\bin\cpp.exe
Found: C:\cygwin\bin\find.exe
Found: C:\cygwin\bin\gcc.exe
Found: C:\cygwin\bin\gdb.exe
Found: C:\cygwin\bin\ld.exe
Found: C:\cygwin\bin\ls.exe
Found: C:\cygwin\bin\make.exe
Found: C:\cygwin\bin\sh.exe

   41k 2002/05/14 C:\cygwin\usr\X11R6\bin\cygPropList-0.dll
  125k 2001/12/18 C:\cygwin\usr\local\bin\cygaudiofile-0.dll
   58k 2002/05/07 C:\cygwin\bin\cygbz2-1.dll
   54k 2002/05/24 C:\cygwin\bin\cygbz21.0.dll
    6k 2002/06/24 C:\cygwin\bin\cygcharset-1.dll
  625k 2002/08/09 C:\cygwin\bin\cygcrypto.dll
  452k 2002/07/17 C:\cygwin\bin\cygcurl-2.dll
  380k 2002/07/24 C:\cygwin\bin\cygdb-3.1.dll
  326k 2002/06/26 C:\cygwin\bin\cygdb2.dll
  487k 2002/07/24 C:\cygwin\bin\cygdb_cxx-3.1.dll
  132k 2002/07/14 C:\cygwin\bin\cygexpat-0.dll
   50k 2002/03/17 C:\cygwin\bin\cygexslt-0.dll
   45k 2001/04/25 C:\cygwin\bin\cygform5.dll
   35k 2002/01/09 C:\cygwin\bin\cygform6.dll
   19k 2002/02/20 C:\cygwin\bin\cyggdbm.dll
  488k 2002/07/18 C:\cygwin\bin\cygguile-14.dll
   63k 2002/07/18 C:\cygwin\bin\cygguile-srfi-srfi-13-14-1.dll
   24k 2002/07/18 C:\cygwin\bin\cygguile-srfi-srfi-4-1.dll
   14k 2002/07/18 C:\cygwin\bin\cygguilereadline-14.dll
   17k 2001/06/28 C:\cygwin\bin\cyghistory4.dll
   20k 2002/07/17 C:\cygwin\bin\cyghistory5.dll
  306k 2002/04/27 C:\cygwin\bin\cyghttpd.dll
  929k 2002/06/24 C:\cygwin\bin\cygiconv-2.dll
   22k 2002/05/24 C:\cygwin\bin\cygintl-1.dll
   23k 2002/06/24 C:\cygwin\bin\cygintl-2.dll
   21k 2001/06/20 C:\cygwin\bin\cygintl.dll
   45k 2002/02/08 C:\cygwin\bin\cygjbig1.dll
  119k 2002/02/09 C:\cygwin\bin\cygjpeg6b.dll
   59k 2002/08/09 C:\cygwin\bin\cygkpathsea-3-3-7.dll
   25k 2002/07/16 C:\cygwin\bin\cygltdl-3.dll
   26k 2001/04/25 C:\cygwin\bin\cygmenu5.dll
   20k 2002/01/09 C:\cygwin\bin\cygmenu6.dll
  156k 2001/04/25 C:\cygwin\bin\cygncurses++5.dll
  175k 2002/01/09 C:\cygwin\bin\cygncurses++6.dll
  226k 2001/04/25 C:\cygwin\bin\cygncurses5.dll
  202k 2002/01/09 C:\cygwin\bin\cygncurses6.dll
   15k 2001/04/25 C:\cygwin\bin\cygpanel5.dll
   12k 2002/01/09 C:\cygwin\bin\cygpanel6.dll
   40k 2001/11/21 C:\cygwin\bin\cygpcre.dll
   39k 2001/11/21 C:\cygwin\bin\cygpcreposix.dll
 1006k 2002/07/24 C:\cygwin\bin\cygperl5_8_0.dll
  175k 2002/07/22 C:\cygwin\bin\cygpng10.dll
  179k 2002/07/22 C:\cygwin\bin\cygpng12.dll
  170k 2002/01/21 C:\cygwin\bin\cygpng2.dll
   22k 2002/06/09 C:\cygwin\bin\cygpopt-0.dll
  108k 2001/06/28 C:\cygwin\bin\cygreadline4.dll
  127k 2002/07/17 C:\cygwin\bin\cygreadline5.dll
   66k 2001/11/20 C:\cygwin\bin\cygregex.dll
  159k 2002/08/09 C:\cygwin\bin\cygssl.dll
  549k 2002/07/19 C:\cygwin\bin\cygtcl83.dll
   11k 2002/07/19 C:\cygwin\bin\cygtclpip83.dll
  253k 2002/02/10 C:\cygwin\bin\cygtiff3.dll
  221k 2002/07/19 C:\cygwin\bin\cygtix4183.dll
  830k 2002/07/19 C:\cygwin\bin\cygtk83.dll
   25k 2002/07/14 C:\cygwin\bin\cygungif-4.dll
  633k 2002/07/22 C:\cygwin\bin\cygxml2-2.dll
   41k 2002/01/20 C:\cygwin\bin\cygXpm-noX4.dll
   46k 2002/01/20 C:\cygwin\bin\cygXpm-X4.dll
  152k 2002/03/17 C:\cygwin\bin\cygxslt-1.dll
   15k 2002/03/17 C:\cygwin\bin\cygxsltbreakpoint-1.dll
   50k 2002/05/24 C:\cygwin\bin\cygz.dll
  883k 2002/07/06 C:\cygwin\bin\cygwin1.dll
    Cygwin DLL version info:
        DLL version: 1.3.12
        DLL epoch: 19
        DLL bad signal mask: 19005
        DLL old termios: 5
        DLL malloc env: 28
        API major: 0
        API minor: 54
        Shared data: 3
        DLL identifier: cygwin1
        Mount registry: 2
        Cygnus registry name: Cygnus Solutions
        Cygwin registry name: Cygwin
        Program options name: Program Options
        Cygwin mount registry name: mounts v2
        Cygdrive flags: cygdrive flags
        Cygdrive prefix: cygdrive prefix
        Cygdrive default prefix: 
        Build date: Sat Jul 6 02:16:58 EDT 2002
        CVS tag: cygwin-1-3-12-1
        Shared id: cygwin1S3


Cygwin Package Information
Package             Version             
ELFIO               1.0.0-1             
WindowMaker         0.80.0-2            
XFree86-base        4.2.0-1             
XFree86-bin         4.2.0-2             
XFree86-doc         4.2.0-1             
XFree86-etc         4.2.0-1             
XFree86-f100        4.2.0-2             
XFree86-fcyr        4.2.0-2             
XFree86-fenc        4.2.0-2             
XFree86-fnts        4.2.0-2             
XFree86-fscl        4.2.0-2             
XFree86-fsrv        4.2.0-1             
XFree86-html        4.2.0-1             
XFree86-jdoc        4.2.0-1             
XFree86-lib         4.2.0-3             
XFree86-man         4.2.0-1             
XFree86-nest        4.2.0-1             
XFree86-prog        4.2.0-1             
XFree86-prt         4.2.0-1             
XFree86-ps          4.2.0-1             
XFree86-startup-scripts4.2.0-3             
XFree86-vfb         4.2.0-1             
XFree86-xserv       4.2.0-12            
Xaw3d               1.5-1               
_update-info-dir    00063-1             
apache              1.3.24-5            
ash                 20020731-1          
audiofile           0.2.1-20011218      
autoconf            2.53b-1             
autoconf-devel      2.53a-1             
autoconf-stable     2.13-4              
automake            1.6.2-1             
automake-devel      1.6.2-1             
automake-stable     1.4p5-5             
bash                2.05b-5             
bc                  1.06-1              
binutils            20020706-2          
bison               1.35-1              
byacc               1.9-1               
bzip2               1.0.2-2             
ccache              1.9-1               
cgoban              1.9.12-1            
clear               1.0-1               
compface            1.4-5               
cpio                2.4.2               
cron                3.0.1-7             
crypt               1.0-1               
ctags               5.2-1               
curl                7.9.8-2             
cvs                 1.11.0-1            
cygipc              1.11-1              
cygrunsrv           0.95-1              
cygutils            1.1.2-1             
cygwin              1.3.12-4            
cygwin-doc          1.1-2               
db2                 2.7.7-4             
db3.1               3.1.17-2            
dejagnu             20010117-1          
diff                1.0-1               
diffutils           2.8.1-1             
dpkg                1.10.4-2            
ed                  0.2-1               
emacs               21.2-8              
emacs-X11           21.2-8              
emacs-el            21.2-8              
enscript            1.6.3-3             
exim                4.10-1              
expat               1.95.4-1            
expect              20010117-1          
fetchmail           5.9.13-2            
figlet              2.2-1               
file                3.37-1              
fileutils           4.1-1               
findutils           4.1.7-4             
flex                2.5.4-2             
fortune             1.8-2               
fvwm                2.4.7-2             
gawk                3.1.1-3             
gcc                 3.2-1               
gcc-mingw           3.2-20020817-1      
gcc2                2.95.3-10           
gdb                 20020718-1          
gdbm                1.8.0-4             
gettext             0.11.2-2            
gettext-devel       0.11.2-2            
ghostscript         7.05-1              
ghostscript-base    7.05-1              
ghostscript-x11     7.05-1              
gnugo               3.2-1               
gnupg               1.1.90-1            
gperf               0.0                 
grep                2.5-1               
groff               1.17.2-1            
gsl                 1.1.1-1             
guile               1.5.6-5             
guile-devel         1.5.6-5             
guile-doc           1.5.6-5             
gzip                1.3.3-4             
indent              2.2.8-1             
inetutils           1.3.2-19            
irc                 20010101-1          
jbigkit             1.2-6               
jpeg                6b-7                
keychain            1.9-1               
less                374-1               
lesstif             0.93.18-3           
libPropList         0.10.1-3            
libbz2_0            1.0.2-1             
libbz2_1            1.0.2-2             
libcharset1         1.8-2               
libdb2              2.7.7-4             
libdb2-devel        2.7.7-4             
libdb3.1            3.1.17-2            
libdb3.1-devel      3.1.17-2            
libguile14          1.5.6-5             
libiconv            1.8-2               
libiconv2           1.8-2               
libintl             0.10.38-3           
libintl1            0.10.40-1           
libintl2            0.11.2-2            
libkpathsea3        20020530-3          
libltdl3            20020705-2          
libncurses5         5.2-1               
libncurses6         5.2-8               
libpng              1.2.4-2             
libpng10            1.0.14-2            
libpng10-devel      1.0.14-2            
libpng12            1.2.4-2             
libpng12-devel      1.2.4-2             
libpng2             1.0.12-1            
libpopt0            1.6.4-4             
libreadline4        4.1-2               
libreadline5        4.3-1               
libtool             20020705-1          
libtool-devel       20020705-2          
libtool-stable      1.4.2-2             
libungif            4.1.0-2             
libxml2             2.4.23-1            
libxslt             1.0.13-1            
lilypond            1.6.0-1             
lilypond-doc        1.6.0-1             
links               0.96-1              
login               1.4-4               
lynx                2.8.4-1             
m4                  0.0                 
make                3.79.1-7            
man                 1.5g-2              
mc                  4.5.55-1            
mingw-runtime       2.2-1               
mktemp              1.4-1               
mod_auth_mysql      1.11-1              
mod_auth_ntsec      1.7-1               
mod_dav             1.0.3-1.3.6-1       
mod_php4            4.2.0-1             
mod_ssl             2.8.8-1.3.24-1      
more                2.11o-1             
mt                  2.0.1-1             
mutt                1.4-1               
nano                1.1.10-1            
ncftp               3.1.4-1             
ncurses             5.2-8               
newlib-man          20020801            
openbox             0.99.1-3            
opengl              1.1.0-6             
openssh             3.4p1-5             
openssl             0.9.6g-1            
openssl-devel       0.9.6g-1            
patch               2.5-3               
pcre                3.7-1               
perl                5.8.0-1             
perl_manpages       5.8.0-1             
pine                4.44-2              
pinfo               0.6.6p1-1           
pkgconfig           0.12.0-1            
popt                1.6.4-4             
postgresql          7.2.2-1             
procmail            3.22-7              
python              2.2.1-1             
rcs                 5.7-3               
readline            4.3-1               
regex               4.4-2               
robots              2.0-1               
rsync               2.5.5-1             
rxvt                2.7.2-11            
sed                 3.02-1              
sh-utils            2.0-2               
sharutils           4.2.1-2             
shutdown            1.2-2               
squid               2.4.STABLE7-1       
ssmtp               2.38.7-3            
swig                1.3.13-1            
tar                 1.13.25-1           
tcltk               20001125-1          
tcp_wrappers        7.6-1               
tcsh                6.11.00-4           
termcap             20020403-1          
terminfo            5.2-3               
tetex               20020530-3          
tetex-base          20020530-3          
tetex-beta          20020530-3          
tetex-bin           20020530-3          
tetex-devel         20020530-3          
tetex-doc           20020530-3          
tetex-extra         20020530-3          
tetex-tiny          20020530-3          
tetex-x11           20020530-3          
texinfo             4.2-3               
texmf               20020530-3          
texmf-base          20020530-3          
texmf-doc           20020530-3          
texmf-extra         20020530-3          
texmf-tiny          20020530-3          
textutils           2.0.21-1            
tidy                020822-1            
tiff                3.5.7-1             
time                1.7-1               
ttcp                19980512-1          
ucl                 1.01-1              
units               1.77-1              
unzip               5.50-1              
upx                 1.21-1              
vim                 6.1-2               
w32api              2.0-1               
wget                1.8.2-1             
which               1.5-1               
whois               4.5.17-1            
x2x                 1.27-1              
xpm-nox             4.2.0-1             
zip                 2.3-2               
zlib                1.1.4-1             
zsh                 4.0.4-1             

Use -h to see help about each section


[-- Attachment #3: 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/

^ permalink raw reply	[flat|nested] 23+ messages in thread

* RE: Installing cygwin-mketc.sh
  2002-09-15  6:49                         ` John Morrison
@ 2002-09-15  7:17                           ` John Morrison
  2002-09-15  9:44                             ` Igor Pechtchanski
  0 siblings, 1 reply; 23+ messages in thread
From: John Morrison @ 2002-09-15  7:17 UTC (permalink / raw)
  To: cygwin

> From: John Morrison
> > From: Paul Johnston
> >
> > > I've attached the message correction.  If this is really part 
> of cygwin,
> > > please take it out altogether, along with the translation of $WINETC.
> >
> > Ok, I've taken out the message, but NOT the case translation of
> > $WINETC. The
> > case translation must be done before the directory existence 
> check, or the
> > check might fail. I think this has got to be the final version 
> of the code
> > now.
> 
> BTW,
> 
> $ cygpath -w -l "/cygdrive/c/WINNT/system32/drivers/etc"
>  u"
> 
> This doesn't work (on my system at least :).  It was fine upto
> attempting the -w -l...
> 

The same thing happens with WFILE.

J.

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

^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: Installing cygwin-mketc.sh
  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  9:28                         ` Igor Pechtchanski
  2 siblings, 0 replies; 23+ messages in thread
From: Igor Pechtchanski @ 2002-09-15  9:28 UTC (permalink / raw)
  To: cygwin

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

On Sun, 15 Sep 2002, Paul Johnston wrote:

> Hi,
>
> How does cygwin install decide where to put files? I was expecting some kind
> of map file mapping object files to installed files, but I couldn't find one.
> I can see we want cygwin-mketc.sh to end up in configure's $sysconfdir but
> beyond that I'm just getting lost
>
> > I've attached the message correction.  If this is really part of cygwin,
> > please take it out altogether, along with the translation of $WINETC.
>
> Ok, I've taken out the message, but NOT the case translation of $WINETC. The
> case translation must be done before the directory existence check, or the
> check might fail. I think this has got to be the final version of the code
> now.
>
> Paul

Paul,
The real reason we need the case translation is for the links is that if
the user doesn't have "check_case:strict" when installing, but later sets
it, the links will still work.

If "check_case:strict" is in effect, the case translation will fail
anyway.  And if it's not in effect, then the directory existence check
will succeed as well.  So the translation is redundant.  But it doesn't
hurt (maybe slows the script down a bit), and in a post-install script
performance is not an issue, so let's leave it in.

However, this reminds me - we had to turn off "check_case:strict" for the
duration of the script for it to work at all with non-standard file and
directory cases!  Something like

  CYGWIN="$CYGWIN check_case:relaxed"; export CYGWIN

I meant to do this one, but completely forgot.  New version attached.
	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!

"Water molecules expand as they grow warmer" (C) Popular Science, Oct'02, p.51


[-- Attachment #2: Type: TEXT/PLAIN, Size: 924 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`"

CYGWIN="$CYGWIN check_case:relaxed"
export CYGWIN

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

WINETC="$(/bin/cygpath -u "$(/bin/cygpath -w -l "$WINETC")")"
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="$WINETC/`expr substr "$FILE" 1 8`"
    WFILE="$(/bin/cygpath -u "$(/bin/cygpath -w -l "$WFILE")")"
    /bin/ln -s -v "$WFILE" "/etc/$FILE"
  fi
done




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

--- cygwin-mketc.sh-0.10.1	2002-09-15 05:21:30.000000000 -0400
+++ cygwin-mketc.sh	2002-09-15 12:07:05.000000000 -0400
@@ -8,6 +8,9 @@ FILES="hosts protocols services networks
 OSNAME="`/bin/uname -s`"
 WINHOME="`/bin/cygpath -W`"
 
+CYGWIN="$CYGWIN check_case:relaxed"
+export CYGWIN
+
 case "$OSNAME" in
   CYGWIN_NT*) WINETC="$WINHOME/system32/drivers/etc" ;;
   CYGWIN_9*|CYGWIN_ME*) WINETC="$WINHOME" ;;

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

^ permalink raw reply	[flat|nested] 23+ messages in thread

* RE: Installing cygwin-mketc.sh
  2002-09-15  7:17                           ` John Morrison
@ 2002-09-15  9:44                             ` Igor Pechtchanski
  0 siblings, 0 replies; 23+ messages in thread
From: Igor Pechtchanski @ 2002-09-15  9:44 UTC (permalink / raw)
  To: cygwin

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

On Sun, 15 Sep 2002, John Morrison wrote:

> > From: John Morrison
> > > From: Paul Johnston
> > >
> > > > I've attached the message correction.  If this is really part of cygwin,
> > > > please take it out altogether, along with the translation of $WINETC.
> > >
> > > Ok, I've taken out the message, but NOT the case translation of $WINETC. The
> > > case translation must be done before the directory existence check, or the
> > > check might fail. I think this has got to be the final version of the code
> > > now.
> >
> > BTW,
> >
> > $ cygpath -w -l "/cygdrive/c/WINNT/system32/drivers/etc"
> >  u"
> >
> > This doesn't work (on my system at least :).  It was fine upto
> > attempting the -w -l...
> >
>
> The same thing happens with WFILE.

John,

If you trace this thread back a bit, you'll see that the cygpath that was
distributed with the current release of cygwin (compiled on July 6) is
broken.  Why it's broken is a mystery to me, as I've just recompiled it
from the 1.3.12-2 source package (using the w32api-1.5-1 sources), and it
works.  Can anyone shed some light on this?

I'm attaching a newly recompiled executable for the trusting souls.  Those
with a bit of healthy paranoia are welcome to recompile it themselves. ;-)
	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!

"Water molecules expand as they grow warmer" (C) Popular Science, Oct'02, p.51

[-- Attachment #2: Type: APPLICATION/octet-stream, Size: 15872 bytes --]

[-- Attachment #3: 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/

^ permalink raw reply	[flat|nested] 23+ messages in thread

end of thread, other threads:[~2002-09-15 16:19 UTC | newest]

Thread overview: 23+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-09-12  7:28 Release candidate 1: /etc/hosts Paul Johnston
2002-09-12  8:13 ` Gerrit P. Haase
2002-09-12 10:49 ` Igor Pechtchanski
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

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).