* Suggestion: /etc/hosts @ 2002-09-09 2:45 Paul Johnston 2002-09-09 5:38 ` Nicholas Wourms ` (5 more replies) 0 siblings, 6 replies; 38+ messages in thread From: Paul Johnston @ 2002-09-09 2:45 UTC (permalink / raw) To: cygwin Hi, NT has an equivalent to /etc/hosts, so I think the cygwin install should create this symbolic link: /etc/hosts -> ${SYSTEMROOT}/system32/drivers/etc/hosts In fact, you could do this to a few other files in that directory, like services and protocols. hosts is the only one I commonly edit though. 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] 38+ messages in thread
* Re: Suggestion: /etc/hosts 2002-09-09 2:45 Suggestion: /etc/hosts Paul Johnston @ 2002-09-09 5:38 ` Nicholas Wourms 2002-09-09 5:40 ` Marcos Lorenzo de Santiago 2002-09-09 6:51 ` Joe Buehler ` (4 subsequent siblings) 5 siblings, 1 reply; 38+ messages in thread From: Nicholas Wourms @ 2002-09-09 5:38 UTC (permalink / raw) To: Paul Johnston, cygwin --- Paul Johnston <paj@pajhome.org.uk> wrote: > Hi, > > NT has an equivalent to /etc/hosts, so I think the cygwin install > should > create this symbolic link: > > /etc/hosts -> ${SYSTEMROOT}/system32/drivers/etc/hosts > > In fact, you could do this to a few other files in that directory, > like > services and protocols. hosts is the only one I commonly edit > though. > The problem is that location isn't the right place on Win9X/ME, so it ends up setting things wrong for those users. Cheers, Nicholas __________________________________________________ Do You Yahoo!? Yahoo! Finance - Get real-time stock quotes http://finance.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] 38+ messages in thread
* Re: Suggestion: /etc/hosts 2002-09-09 5:38 ` Nicholas Wourms @ 2002-09-09 5:40 ` Marcos Lorenzo de Santiago 0 siblings, 0 replies; 38+ messages in thread From: Marcos Lorenzo de Santiago @ 2002-09-09 5:40 UTC (permalink / raw) To: Nicholas Wourms; +Cc: Paul Johnston, cygwin > --- Paul Johnston <paj@pajhome.org.uk> wrote: > > Hi, > > > > NT has an equivalent to /etc/hosts, so I think the cygwin install > > should > > create this symbolic link: > > > > /etc/hosts -> ${SYSTEMROOT}/system32/drivers/etc/hosts > > > > In fact, you could do this to a few other files in that directory, > > like > > services and protocols. hosts is the only one I commonly edit > > though. > > > The problem is that location isn't the right place on Win9X/ME, so it > ends up setting things wrong for those users. Well, anyway, does cygwin internal scripts know whether the OS is a Windows NT/98/ME/2K/XP? If so that's not a problem. I guess cygwin knows it and therefore could be achieved (if needed). Cheers, m4c. -- 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] 38+ messages in thread
* Re: Suggestion: /etc/hosts 2002-09-09 2:45 Suggestion: /etc/hosts Paul Johnston 2002-09-09 5:38 ` Nicholas Wourms @ 2002-09-09 6:51 ` Joe Buehler 2002-09-09 7:32 ` Christopher Faylor 2002-09-09 11:25 ` news ` (3 subsequent siblings) 5 siblings, 1 reply; 38+ messages in thread From: Joe Buehler @ 2002-09-09 6:51 UTC (permalink / raw) To: cygwin Paul Johnston wrote: > NT has an equivalent to /etc/hosts, so I think the cygwin install should > create this symbolic link: > > /etc/hosts -> ${SYSTEMROOT}/system32/drivers/etc/hosts This is a great idea, making allowances for variations in the different versions of Windows, of course. Joe Buehler -- 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] 38+ messages in thread
* Re: Suggestion: /etc/hosts 2002-09-09 6:51 ` Joe Buehler @ 2002-09-09 7:32 ` Christopher Faylor 2002-09-10 2:19 ` Paul Johnston 0 siblings, 1 reply; 38+ messages in thread From: Christopher Faylor @ 2002-09-09 7:32 UTC (permalink / raw) To: cygwin On Mon, Sep 09, 2002 at 08:48:07AM -0400, Joe Buehler wrote: >Paul Johnston wrote: > >>NT has an equivalent to /etc/hosts, so I think the cygwin install should >>create this symbolic link: >> >>/etc/hosts -> ${SYSTEMROOT}/system32/drivers/etc/hosts > >This is a great idea, making allowances for variations in the different >versions of Windows, of course. So, like all great ideas, all that it needs is an actual patch to make it happen. cgf -- 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] 38+ messages in thread
* Re: Suggestion: /etc/hosts 2002-09-09 7:32 ` Christopher Faylor @ 2002-09-10 2:19 ` Paul Johnston 2002-09-11 7:43 ` Jim 0 siblings, 1 reply; 38+ messages in thread From: Paul Johnston @ 2002-09-10 2:19 UTC (permalink / raw) To: cygwin, cygwin-apps Hi, > >>/etc/hosts -> ${SYSTEMROOT}/system32/drivers/etc/hosts > > So, like all great ideas, all that it needs is an actual patch to make > it happen. Ok, I will have a go at this. As it involves mods to the setup program, I'm going to move the discussion to cygwin-apps. 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] 38+ messages in thread
* Re: Suggestion: /etc/hosts 2002-09-10 2:19 ` Paul Johnston @ 2002-09-11 7:43 ` Jim 0 siblings, 0 replies; 38+ messages in thread From: Jim @ 2002-09-11 7:43 UTC (permalink / raw) To: cygwin, cygwin-apps > Hi, > > > >>/etc/hosts -> ${SYSTEMROOT}/system32/drivers/etc/hosts > > > > So, like all great ideas, all that it needs is an actual patch to make > > it happen. > Uhh - what about just /windows/hosts (for those that are non NT based) ? > Ok, I will have a go at this. As it involves mods to the setup program, I'm > going to move the discussion to cygwin-apps. > > 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] 38+ messages in thread
* Re: Suggestion: /etc/hosts 2002-09-09 2:45 Suggestion: /etc/hosts Paul Johnston 2002-09-09 5:38 ` Nicholas Wourms 2002-09-09 6:51 ` Joe Buehler @ 2002-09-09 11:25 ` news [not found] ` <E17oTbC-0001AV-00@quimby.gnus.org> ` (2 subsequent siblings) 5 siblings, 0 replies; 38+ messages in thread From: news @ 2002-09-09 11:25 UTC (permalink / raw) To: cygwin On 09 Sep 2002, Paul Johnston <paj@pajhome.org.uk> wrote: > I think the cygwin > install should create this symbolic link: > > /etc/hosts -> ${SYSTEMROOT}/system32/drivers/etc/hosts I like the idea in principle. Depending on your setup though, editing a file in your favourite Cygwin based editor might give you an odd looking file in the end (some lines with DOS-endings and some with *n*x-endings). I doubt Cygwin would have a problem with that, but I don't really want to test what Windows would do. -- 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] 38+ messages in thread
[parent not found: <E17oTbC-0001AV-00@quimby.gnus.org>]
* Re: Suggestion: /etc/hosts [not found] ` <E17oTbC-0001AV-00@quimby.gnus.org> @ 2002-09-10 9:52 ` Shankar Unni 0 siblings, 0 replies; 38+ messages in thread From: Shankar Unni @ 2002-09-10 9:52 UTC (permalink / raw) To: cygwin news@garydjones.mailshell.com wrote: > [...] (some lines with DOS-endings and some with *n*x-endings). > I doubt Cygwin would have a problem with that, but I don't > really want to test what Windows would do. Doesn't seem to faze Windows XP, anyway. I converted the file to unix line endings and threw in a few ^Ms here and there. Worked fine. Can't answer for old stacks like Win95 and Win98, but I suspect they would also be able to handle this.. -- Shankar. -- 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] 38+ messages in thread
* Beginnings of a patch: /etc/hosts 2002-09-09 2:45 Suggestion: /etc/hosts Paul Johnston ` (3 preceding siblings ...) [not found] ` <E17oTbC-0001AV-00@quimby.gnus.org> @ 2002-09-10 11:46 ` Paul Johnston 2002-09-10 13:36 ` Igor Pechtchanski 2002-09-11 9:57 ` Joe Buehler 2002-09-10 13:54 ` Suggestion: /etc/hosts Warren Young 5 siblings, 2 replies; 38+ messages in thread From: Paul Johnston @ 2002-09-10 11:46 UTC (permalink / raw) To: cygwin (back in main cygwin list as Robert pointed out this is not a setup change) Hi, I've created an NT-only postinstall script that should be suitible. I suggest it's called /etc/postinstall/make-etc-links.sh I don't have access to a Win 9x machine right now - if someone else could do this bit, that would be great; alternatively I will be able to do it in the next week or so. Paul #!/bin/sh #-- # Creates symbolic links from some /etc files to their windows equivalents #-- VERBOSE=-v if [ "$OS" = "Windows_NT" ] then WINETC=`/bin/cygpath $SYSTEMROOT`/system32/drivers/etc FILES="hosts protocol services" fi for FILE in $FILES do if [ ! -e /etc/$FILE ] then /bin/ln -s $VERBOSE ${WINETC}/$FILE /etc/$FILE fi done > NT has an equivalent to /etc/hosts, so I think the cygwin install should > create this symbolic link: > > /etc/hosts -> ${SYSTEMROOT}/system32/drivers/etc/hosts -- 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] 38+ messages in thread
* Re: Beginnings of a patch: /etc/hosts 2002-09-10 11:46 ` Beginnings of a patch: /etc/hosts Paul Johnston @ 2002-09-10 13:36 ` Igor Pechtchanski 2002-09-11 0:59 ` John Morrison 2002-09-11 9:57 ` Joe Buehler 1 sibling, 1 reply; 38+ messages in thread From: Igor Pechtchanski @ 2002-09-10 13:36 UTC (permalink / raw) To: Paul Johnston; +Cc: cygwin [-- Attachment #1: Type: TEXT/PLAIN, Size: 1841 bytes --] On Tue, 10 Sep 2002, Paul Johnston wrote: > (back in main cygwin list as Robert pointed out this is not a setup > change) > > Hi, > > I've created an NT-only postinstall script that should be suitible. I > suggest it's called /etc/postinstall/make-etc-links.sh I don't have > access to a Win 9x machine right now - if someone else could do this > bit, that would be great; alternatively I will be able to do it in the > next week or so. > > Paul > > > #!/bin/sh > #-- > # Creates symbolic links from some /etc files to their windows > equivalents > #-- > VERBOSE=-v > > if [ "$OS" = "Windows_NT" ] > then > WINETC=`/bin/cygpath $SYSTEMROOT`/system32/drivers/etc > FILES="hosts protocol services" > fi > > for FILE in $FILES > do > if [ ! -e /etc/$FILE ] > then > /bin/ln -s $VERBOSE ${WINETC}/$FILE /etc/$FILE > fi > done > > > NT has an equivalent to /etc/hosts, so I think the cygwin install should > > create this symbolic link: > > > > /etc/hosts -> ${SYSTEMROOT}/system32/drivers/etc/hosts 9x systems also have these files, they should reside in ${WINBOOTDIR}. You also omitted a file called 'networks'. Attached are a new version of your script, as well as a diff with your original version. Note also that the links should probably use proper case for the path and filenames, in case someone has CYGWIN=*check_case:strict*. I'm not sure how to do this properly (use [cmd /c "dir /b "`cygpath -w $file`], maybe?) 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: 623 bytes --] --- make-etc-links.sh-orig 2002-09-10 15:39:42.000000000 -0400 +++ make-etc-links.sh 2002-09-10 15:39:37.000000000 -0400 @@ -4,11 +4,14 @@ #-- VERBOSE=-v -if [ "$OS" = "Windows_NT" ] -then - WINETC=`/bin/cygpath $SYSTEMROOT`/system32/drivers/etc - FILES="hosts protocol services" -fi +OSNAME=`/bin/uname -s` + +case "$OSNAME" in + CYGWIN_NT*) WINETC=`/bin/cygpath $SYSTEMROOT`/system32/drivers/etc ;; + CYGWIN_9*) WINETC=`/bin/cygpath $WINBOOTDIR` ;; + *) echo "Unknown system type $OSNAME; exiting" >&2; exit 1 ;; +esac +FILES="hosts protocol services networks" for FILE in $FILES do [-- Attachment #3: Type: TEXT/PLAIN, Size: 522 bytes --] #!/bin/sh #-- # Creates symbolic links from some /etc files to their windows equivalents #-- VERBOSE=-v OSNAME=`/bin/uname -s` case "$OSNAME" in CYGWIN_NT*) WINETC=`/bin/cygpath $SYSTEMROOT`/system32/drivers/etc ;; CYGWIN_9*) WINETC=`/bin/cygpath $WINBOOTDIR` ;; *) echo "Unknown system type $OSNAME; exiting" >&2; exit 1 ;; esac FILES="hosts protocol services networks" for FILE in $FILES do if [ ! -e /etc/$FILE ] then /bin/ln -s $VERBOSE ${WINETC}/$FILE /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] 38+ messages in thread
* Re: Beginnings of a patch: /etc/hosts 2002-09-10 13:36 ` Igor Pechtchanski @ 2002-09-11 0:59 ` John Morrison 2002-09-11 2:06 ` Corinna Vinschen 0 siblings, 1 reply; 38+ messages in thread From: John Morrison @ 2002-09-11 0:59 UTC (permalink / raw) To: cygwin On Tue, 10 Sep 2002, Igor Pechtchanski wrote: > On Tue, 10 Sep 2002, Paul Johnston wrote: > > > (back in main cygwin list as Robert pointed out this is not a setup > > change) > > > > Hi, > > > > I've created an NT-only postinstall script that should be suitible. I > > suggest it's called /etc/postinstall/make-etc-links.sh I don't have > > access to a Win 9x machine right now - if someone else could do this > > bit, that would be great; alternatively I will be able to do it in the > > next week or so. > > > > Paul <snip/> > > > NT has an equivalent to /etc/hosts, so I think the cygwin install should > > > create this symbolic link: > > > > > > /etc/hosts -> ${SYSTEMROOT}/system32/drivers/etc/hosts > > 9x systems also have these files, they should reside in ${WINBOOTDIR}. > You also omitted a file called 'networks'. > > Attached are a new version of your script, as well as a diff with your > original version. > > Note also that the links should probably use proper case for the path and > filenames, in case someone has CYGWIN=*check_case:strict*. I'm not sure > how to do this properly (use [cmd /c "dir /b "`cygpath -w $file`], maybe?) cygpath -S "output system directory and exit" returns /cygdrive/c/WINNT/system32 for me. Would this work under 9x/ME? 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] 38+ messages in thread
* Re: Beginnings of a patch: /etc/hosts 2002-09-11 0:59 ` John Morrison @ 2002-09-11 2:06 ` Corinna Vinschen 0 siblings, 0 replies; 38+ messages in thread From: Corinna Vinschen @ 2002-09-11 2:06 UTC (permalink / raw) To: cygwin On Wed, Sep 11, 2002 at 09:03:11AM +0100, John Morrison wrote: > > cygpath -S "output system directory and exit" returns > /cygdrive/c/WINNT/system32 for me. > > Would this work under 9x/ME? cygpath -W is the better choice. $ uname -s CYGWIN-98-4.10 $ cygpath -S /cygdrive/c/WINDOWS/SYSTEM $ cygpath -W /cygdrive/c/WINDOWS but that's ok for NT/2K/XP as well. Corinna -- Corinna Vinschen Please, send mails regarding Cygwin to Cygwin Developer mailto:cygwin@cygwin.com Red Hat, Inc. -- 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] 38+ messages in thread
* Re: Beginnings of a patch: /etc/hosts 2002-09-10 11:46 ` Beginnings of a patch: /etc/hosts Paul Johnston 2002-09-10 13:36 ` Igor Pechtchanski @ 2002-09-11 9:57 ` Joe Buehler 2002-09-11 11:17 ` Igor Pechtchanski 1 sibling, 1 reply; 38+ messages in thread From: Joe Buehler @ 2002-09-11 9:57 UTC (permalink / raw) To: cygwin Paul Johnston wrote: > if [ "$OS" = "Windows_NT" ] > then > WINETC=`/bin/cygpath $SYSTEMROOT`/system32/drivers/etc > FILES="hosts protocol services" > fi > > for FILE in $FILES > do > if [ ! -e /etc/$FILE ] > then > /bin/ln -s $VERBOSE ${WINETC}/$FILE /etc/$FILE > fi > done Not likely to happen here, but... beware of whitespace in $SYSTEMROOT / $WINETC. I generally double-quote variable references as a matter of course in shell scripts so I don't run into bugs resulting from white space in the contents. Joe Buehler -- 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] 38+ messages in thread
* Re: Beginnings of a patch: /etc/hosts 2002-09-11 9:57 ` Joe Buehler @ 2002-09-11 11:17 ` Igor Pechtchanski 2002-09-11 11:42 ` Joe Buehler 0 siblings, 1 reply; 38+ messages in thread From: Igor Pechtchanski @ 2002-09-11 11:17 UTC (permalink / raw) To: Joe Buehler; +Cc: cygwin [-- Attachment #1: Type: TEXT/PLAIN, Size: 1470 bytes --] On Wed, 11 Sep 2002, Joe Buehler wrote: > Paul Johnston wrote: > > > if [ "$OS" = "Windows_NT" ] > > then > > WINETC=`/bin/cygpath $SYSTEMROOT`/system32/drivers/etc > > FILES="hosts protocol services" > > fi > > > > for FILE in $FILES > > do > > if [ ! -e /etc/$FILE ] > > then > > /bin/ln -s $VERBOSE ${WINETC}/$FILE /etc/$FILE > > fi > > done > > Not likely to happen here, but... beware of whitespace in > $SYSTEMROOT / $WINETC. > > I generally double-quote variable references as a matter of course > in shell scripts so I don't run into bugs resulting from white > space in the contents. > > Joe Buehler A very good point. Another patch (against my previous post) and the new script are attached. The new version fixes variable quoting and some other minor things and incorporates Corinna's suggestion. (Aside: should I be posting the actual scripts, or can people follow the trail of patches?) TODO: The sed script strikes me as a bit inelegant. Also, I still can't think of a way to make sure the case of the paths is correct. Suggestions? 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: 1535 bytes --] --- make-etc-links.sh-orig 2002-09-10 15:39:37.000000000 -0400 +++ make-etc-links.sh 2002-09-11 14:07:31.000000000 -0400 @@ -1,23 +1,42 @@ #!/bin/sh #-- # Creates symbolic links from some /etc files to their windows equivalents +# +# Version: 0.3 +# +# ChangeLog: +# v0.3 Igor Pechtchanski <pechtcha at cs.nyu.edu>: +# Quote variable references +# Use `cygpath -W` instead of "$SYSTEMROOT" +# Change protocol to protocols on cygwin +# Add ChangeLog +# v0.2 Igor Pechtchanski <pechtcha at cs.nyu.edu>: +# Use `uname -s` instead of "$OS" +# Add Win9x support +# Add networks file +# v0.1 Paul Johnston <paj at pajhome.org.uk>: +# Initial version #-- + VERBOSE=-v OSNAME=`/bin/uname -s` +WINHOME=`/bin/cygpath -W` case "$OSNAME" in - CYGWIN_NT*) WINETC=`/bin/cygpath $SYSTEMROOT`/system32/drivers/etc ;; - CYGWIN_9*) WINETC=`/bin/cygpath $WINBOOTDIR` ;; + CYGWIN_NT*) WINETC="$WINHOME"/system32/drivers/etc ;; + CYGWIN_9*) WINETC="$WINHOME" ;; *) echo "Unknown system type $OSNAME; exiting" >&2; exit 1 ;; esac -FILES="hosts protocol services networks" +FILES="hosts protocols services networks" for FILE in $FILES do - if [ ! -e /etc/$FILE ] + if [ ! -e "/etc/$FILE" ] then - /bin/ln -s $VERBOSE ${WINETC}/$FILE /etc/$FILE + # Windows only uses the first 8 characters + WFILE=`echo $FILE | sed 's/^\(.\{0,8\}\).*/\1/'` + /bin/ln -s $VERBOSE "$WINETC/$WFILE" "/etc/$FILE" fi done [-- Attachment #3: Type: TEXT/PLAIN, Size: 1100 bytes --] #!/bin/sh #-- # Creates symbolic links from some /etc files to their windows equivalents # # Version: 0.3 # # ChangeLog: # v0.3 Igor Pechtchanski <pechtcha at cs.nyu.edu>: # Quote variable references # Use `cygpath -W` instead of "$SYSTEMROOT" # Change protocol to protocols on cygwin # Add ChangeLog # v0.2 Igor Pechtchanski <pechtcha at cs.nyu.edu>: # Use `uname -s` instead of "$OS" # Add Win9x support # Add networks file # v0.1 Paul Johnston <paj at pajhome.org.uk>: # Initial version #-- VERBOSE=-v OSNAME=`/bin/uname -s` WINHOME=`/bin/cygpath -W` case "$OSNAME" in CYGWIN_NT*) WINETC="$WINHOME"/system32/drivers/etc ;; CYGWIN_9*) WINETC="$WINHOME" ;; *) echo "Unknown system type $OSNAME; exiting" >&2; exit 1 ;; esac FILES="hosts protocols services networks" for FILE in $FILES do if [ ! -e "/etc/$FILE" ] then # Windows only uses the first 8 characters WFILE=`echo $FILE | sed 's/^\(.\{0,8\}\).*/\1/'` /bin/ln -s $VERBOSE "$WINETC/$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] 38+ messages in thread
* Re: Beginnings of a patch: /etc/hosts 2002-09-11 11:17 ` Igor Pechtchanski @ 2002-09-11 11:42 ` Joe Buehler 2002-09-11 12:39 ` Igor Pechtchanski 0 siblings, 1 reply; 38+ messages in thread From: Joe Buehler @ 2002-09-11 11:42 UTC (permalink / raw) To: cygwin Igor Pechtchanski wrote: > + WFILE=`echo $FILE | sed 's/^\(.\{0,8\}\).*/\1/'` If you think that inelegant, try using this: expr substr "$FILE" 1 8 Joe Buehler -- 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] 38+ messages in thread
* Re: Beginnings of a patch: /etc/hosts 2002-09-11 11:42 ` Joe Buehler @ 2002-09-11 12:39 ` Igor Pechtchanski 2002-09-11 14:24 ` Paul Johnston 0 siblings, 1 reply; 38+ messages in thread From: Igor Pechtchanski @ 2002-09-11 12:39 UTC (permalink / raw) To: Joe Buehler; +Cc: cygwin On Wed, 11 Sep 2002, Joe Buehler wrote: > Igor Pechtchanski wrote: > > > + WFILE=`echo $FILE | sed 's/^\(.\{0,8\}\).*/\1/'` > > If you think that inelegant, try using this: > > expr substr "$FILE" 1 8 > > Joe Buehler Well, it's certainly more readable (especially to someone who knows of the existence of 'substr' :-D). Thanks. I'll include it in the next version... 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] 38+ messages in thread
* Re: Beginnings of a patch: /etc/hosts 2002-09-11 12:39 ` Igor Pechtchanski @ 2002-09-11 14:24 ` Paul Johnston 2002-09-11 14:53 ` Warren Young 0 siblings, 1 reply; 38+ messages in thread From: Paul Johnston @ 2002-09-11 14:24 UTC (permalink / raw) To: cygwin Hi, Brilliant to see so much progress on this! Are you sure that "CYGWIN_9*)" correctly catches Windows ME? I think we're safe with the case issue, given that cygpath -W seems to return the correct case. However, I think adding this belt-and-braces check might be a good idea: if [ ! -d "$WINETC" ] then echo "ERROR: Directory $WINETC not found" >&2 exit 2 fi Apart from that, seems just about ready to go. Not sure if the change history is necessary though, at least not until it's first checked-in. 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] 38+ messages in thread
* Re: Beginnings of a patch: /etc/hosts 2002-09-11 14:24 ` Paul Johnston @ 2002-09-11 14:53 ` Warren Young 2002-09-11 15:37 ` Igor Pechtchanski 0 siblings, 1 reply; 38+ messages in thread From: Warren Young @ 2002-09-11 14:53 UTC (permalink / raw) To: Cygwin-L Paul Johnston wrote: > > Are you sure that "CYGWIN_9*)" correctly catches Windows ME? You might take a look at my alternate patch in the patches list. It doesn't rely on that sort of thing -- it relies instead on well-known environment variables: $SYSTEMROOT and $WINDIR. It still has some OS-specific knowledge in it, in that it knows that only NT-derived OSes define SYSTEMROOT and uses WINDIR as a fallback for 9x systems. I don't know which approach is superior. > However, I think adding this belt-and-braces check might be a good idea: I'm not a fan of the "if X, scream and die" bit in this original script or the one you've proposed. Postinstall scripts shouldn't fail. I think they should give best effort, and if they can't do what you want, they should simply quietly skip that bit. Besides, this patch may be put into some other postinstall script, and you don't want to avoid doing the other tasks in that script just because the /etc/hosts part can't find the Windows system directory. -- 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] 38+ messages in thread
* Re: Beginnings of a patch: /etc/hosts 2002-09-11 14:53 ` Warren Young @ 2002-09-11 15:37 ` Igor Pechtchanski 2002-09-11 15:40 ` Paul Johnston ` (3 more replies) 0 siblings, 4 replies; 38+ messages in thread From: Igor Pechtchanski @ 2002-09-11 15:37 UTC (permalink / raw) To: cygwin; +Cc: Paul Johnston, Warren Young [-- Attachment #1: Type: TEXT/PLAIN, Size: 3143 bytes --] Hi, Script attached; comments below. On Wed, 11 Sep 2002, Paul Johnston wrote: > Hi, > Brilliant to see so much progress on this! > Are you sure that "CYGWIN_9*)" correctly catches Windows ME? No, I'm not. I'm incorporating Warren Young's suggestion. Unless someone with ME can confirm that 'uname -s' returns CYGWIN_9*? Nicholas? > I think we're safe with the case issue, given that cygpath -W seems to > return the correct case. Yes, but we are assuming that the file names are all lowercase. > However, I think adding this belt-and-braces check might be a good idea: > > if [ ! -d "$WINETC" ] > then > echo "ERROR: Directory $WINETC not found" >&2 > exit 2 > fi Done, but without the error code. Should we still print a message, though? > Apart from that, seems just about ready to go. Not sure if the change > history is necessary though, at least not until it's first checked-in. > > Paul The change history was for me to keep track of what I've done. It should probably be deleted when this is submitted as an official patch... This is my alternative to setting up a cvs repository for one file (probably should have, though, same effort, and fewer complaints :-) ). On Wed, 11 Sep 2002, Warren Young wrote: > Paul Johnston wrote: > > > > Are you sure that "CYGWIN_9*)" correctly catches Windows ME? > > You might take a look at my alternate patch in the patches list. It > doesn't rely on that sort of thing -- it relies instead on well-known > environment variables: $SYSTEMROOT and $WINDIR. It still has some > OS-specific knowledge in it, in that it knows that only NT-derived OSes > define SYSTEMROOT and uses WINDIR as a fallback for 9x systems. I don't > know which approach is superior. I've incorporated yours for now. If people confirm that `uname -s` returns either CYGWIN_NT* or CYGWIN_9* on all relevant systems, we could revert to that mechanism. > > However, I think adding this belt-and-braces check might be a good idea: > > I'm not a fan of the "if X, scream and die" bit in this original script > or the one you've proposed. Postinstall scripts shouldn't fail. I > think they should give best effort, and if they can't do what you want, > they should simply quietly skip that bit. Besides, this patch may be > put into some other postinstall script, and you don't want to avoid > doing the other tasks in that script just because the /etc/hosts part > can't find the Windows system directory. Well, we should at least refrain from making the symlinks then... On another note, I'm not sure why you were checking for the presence of the windows files. We could still create dangling symlinks if they are missing, which will allow the files to be created by editing/saving the symlink. 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: 1373 bytes --] #!/bin/sh #-- # Creates symbolic links from some /etc files to their windows equivalents # # Version: 0.4 # # ChangeLog: # v0.4 Igor Pechtchanski <pechtcha at cs.nyu.edu>: # Use $SYSTEMROOT and $WINDIR to determine the OS (thx Warren Young) # Check for existence of $WINETC directory (thx Paul Johnston) # Use `expr substr` instead of `echo | sed` (thx Joe Buehler) # v0.3 Igor Pechtchanski <pechtcha at cs.nyu.edu>: # Quote variable references (thx Joe Buehler) # Use `cygpath -W` instead of "$SYSTEMROOT" (thx Corinna Vinschen) # Change protocol to protocols on cygwin # Add ChangeLog # v0.2 Igor Pechtchanski <pechtcha at cs.nyu.edu>: # Use `uname -s` instead of "$OS" # Add Win9x support # Add networks file # v0.1 Paul Johnston <paj at pajhome.org.uk>: # Initial version #-- VERBOSE=-v WINHOME=`/bin/cygpath -W` if [ -n "$SYSTEMROOT" ] then WINETC="$WINHOME/system32/drivers/etc" elif [ -n "$WINDIR" ] then WINETC="$WINHOME" else exit 0 fi FILES="hosts protocols services networks" if [ ! -d "$WINETC" ] then exit 0 fi for FILE in $FILES do if [ ! -e "/etc/$FILE" ] then # Windows only uses the first 8 characters WFILE=`expr substr "$FILE" 1 8` /bin/ln -s $VERBOSE "$WINETC/$WFILE" "/etc/$FILE" fi done [-- Attachment #3: Type: TEXT/PLAIN, Size: 1769 bytes --] --- make-etc-links.sh-orig 2002-09-11 14:07:31.000000000 -0400 +++ make-etc-links.sh 2002-09-11 18:08:39.000000000 -0400 @@ -2,12 +2,16 @@ #-- # Creates symbolic links from some /etc files to their windows equivalents # -# Version: 0.3 +# Version: 0.4 # # ChangeLog: +# v0.4 Igor Pechtchanski <pechtcha at cs.nyu.edu>: +# Use $SYSTEMROOT and $WINDIR to determine the OS (thx Warren Young) +# Check for existence of $WINETC directory (thx Paul Johnston) +# Use `expr substr` instead of `echo | sed` (thx Joe Buehler) # v0.3 Igor Pechtchanski <pechtcha at cs.nyu.edu>: -# Quote variable references -# Use `cygpath -W` instead of "$SYSTEMROOT" +# Quote variable references (thx Joe Buehler) +# Use `cygpath -W` instead of "$SYSTEMROOT" (thx Corinna Vinschen) # Change protocol to protocols on cygwin # Add ChangeLog # v0.2 Igor Pechtchanski <pechtcha at cs.nyu.edu>: @@ -20,22 +24,30 @@ VERBOSE=-v -OSNAME=`/bin/uname -s` WINHOME=`/bin/cygpath -W` -case "$OSNAME" in - CYGWIN_NT*) WINETC="$WINHOME"/system32/drivers/etc ;; - CYGWIN_9*) WINETC="$WINHOME" ;; - *) echo "Unknown system type $OSNAME; exiting" >&2; exit 1 ;; -esac +if [ -n "$SYSTEMROOT" ] +then + WINETC="$WINHOME/system32/drivers/etc" +elif [ -n "$WINDIR" ] +then + WINETC="$WINHOME" +else + exit 0 +fi FILES="hosts protocols services networks" +if [ ! -d "$WINETC" ] +then + exit 0 +fi + for FILE in $FILES do if [ ! -e "/etc/$FILE" ] then # Windows only uses the first 8 characters - WFILE=`echo $FILE | sed 's/^\(.\{0,8\}\).*/\1/'` + WFILE=`expr substr "$FILE" 1 8` /bin/ln -s $VERBOSE "$WINETC/$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] 38+ messages in thread
* Re: Beginnings of a patch: /etc/hosts 2002-09-11 15:37 ` Igor Pechtchanski @ 2002-09-11 15:40 ` Paul Johnston 2002-09-11 16:15 ` Igor Pechtchanski 2002-09-11 17:54 ` Igor Pechtchanski ` (2 subsequent siblings) 3 siblings, 1 reply; 38+ messages in thread From: Paul Johnston @ 2002-09-11 15:40 UTC (permalink / raw) To: cygwin Hi, > No, I'm not. I'm incorporating Warren Young's suggestion. Unless someone > with ME can confirm that 'uname -s' returns CYGWIN_9*? Nicholas? To me that's a step backwards - uname -s or $OS are the correct ways to detect the operating system. Warren's approach would be fooled if a user defined $SYSTEMROOT on Win 9x. Nit picks... FILES=... should probably go nearer the top On reflection, I think we'll always want it verbose, so we could lose $VERBOSE That's gotta be it... in principle this is a very simple script! 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] 38+ messages in thread
* Re: Beginnings of a patch: /etc/hosts 2002-09-11 15:40 ` Paul Johnston @ 2002-09-11 16:15 ` Igor Pechtchanski 2002-09-11 16:35 ` Robert Collins 0 siblings, 1 reply; 38+ messages in thread From: Igor Pechtchanski @ 2002-09-11 16:15 UTC (permalink / raw) To: Paul Johnston; +Cc: cygwin [-- Attachment #1: Type: TEXT/PLAIN, Size: 1377 bytes --] On Wed, 11 Sep 2002, Paul Johnston wrote: > > No, I'm not. I'm incorporating Warren Young's suggestion. Unless someone > > with ME can confirm that 'uname -s' returns CYGWIN_9*? Nicholas? > > To me that's a step backwards - uname -s or $OS are the correct ways to > detect the operating system. Warren's approach would be fooled if a user > defined $SYSTEMROOT on Win 9x. Win 9x does not set $OS... At least my Win 98 machine at home doesn't. Besides, the user can always set $OS to fool the script, by the same token. I'd prefer 'uname -s'. Pending confirmation from someone with Win ME... > Nit picks... FILES=... should probably go nearer the top Agreed. > On reflection, I think we'll always want it verbose, so we could lose > $VERBOSE Probably. In which case we should also print messages if the OS is not detected or $WINETC is not found... > That's gotta be it... in principle this is a very simple script! Ok, one more iteration (script 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! 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: 1614 bytes --] #!/bin/sh #-- # Creates symbolic links from some /etc files to their windows equivalents # # Version: 0.5 # # ChangeLog: # v0.5 Igor Pechtchanski <pechtcha at cs.nyu.edu>: # Move FILES to top; removed VERBOSE (thx Paul Johnston) # Print messages on abnormal exit # v0.4 Igor Pechtchanski <pechtcha at cs.nyu.edu>: # Use $SYSTEMROOT and $WINDIR to determine the OS (thx Warren Young) # Check for existence of $WINETC directory (thx Paul Johnston) # Use `expr substr` instead of `echo | sed` (thx Joe Buehler) # v0.3 Igor Pechtchanski <pechtcha at cs.nyu.edu>: # Quote variable references (thx Joe Buehler) # Use `cygpath -W` instead of "$SYSTEMROOT" (thx Corinna Vinschen) # Change protocol to protocols on cygwin # Add ChangeLog # v0.2 Igor Pechtchanski <pechtcha at cs.nyu.edu>: # Use `uname -s` instead of "$OS" # Add Win9x support # Add networks file # v0.1 Paul Johnston <paj at pajhome.org.uk>: # Initial version #-- FILES="hosts protocols services networks" WINHOME=`/bin/cygpath -W` if [ -n "$SYSTEMROOT" ] then WINETC="$WINHOME/system32/drivers/etc" elif [ -n "$WINDIR" ] then WINETC="$WINHOME" else echo "Unknown system type; exiting" >&2 exit 0 fi if [ ! -d "$WINETC" ] then echo "Directory $WINETC does not exist; exiting" >&2 exit 0 fi for FILE in $FILES do if [ ! -e "/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: 1327 bytes --] --- make-etc-links.sh-orig 2002-09-11 18:08:39.000000000 -0400 +++ make-etc-links.sh 2002-09-11 18:57:01.000000000 -0400 @@ -2,9 +2,12 @@ #-- # Creates symbolic links from some /etc files to their windows equivalents # -# Version: 0.4 +# Version: 0.5 # # ChangeLog: +# v0.5 Igor Pechtchanski <pechtcha at cs.nyu.edu>: +# Move FILES to top; removed VERBOSE (thx Paul Johnston) +# Print messages on abnormal exit # v0.4 Igor Pechtchanski <pechtcha at cs.nyu.edu>: # Use $SYSTEMROOT and $WINDIR to determine the OS (thx Warren Young) # Check for existence of $WINETC directory (thx Paul Johnston) @@ -22,7 +25,7 @@ # Initial version #-- -VERBOSE=-v +FILES="hosts protocols services networks" WINHOME=`/bin/cygpath -W` @@ -33,12 +36,13 @@ elif [ -n "$WINDIR" ] then WINETC="$WINHOME" else + echo "Unknown system type; exiting" >&2 exit 0 fi -FILES="hosts protocols services networks" if [ ! -d "$WINETC" ] then + echo "Directory $WINETC does not exist; exiting" >&2 exit 0 fi @@ -48,7 +52,7 @@ do then # Windows only uses the first 8 characters WFILE=`expr substr "$FILE" 1 8` - /bin/ln -s $VERBOSE "$WINETC/$WFILE" "/etc/$FILE" + /bin/ln -s -v "$WINETC/$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] 38+ messages in thread
* Re: Beginnings of a patch: /etc/hosts 2002-09-11 16:15 ` Igor Pechtchanski @ 2002-09-11 16:35 ` Robert Collins 2002-09-11 17:10 ` Randall R Schulz 2002-09-11 17:14 ` Igor Pechtchanski 0 siblings, 2 replies; 38+ messages in thread From: Robert Collins @ 2002-09-11 16:35 UTC (permalink / raw) To: cygwin; +Cc: Paul Johnston [-- Attachment #1: Type: text/plain, Size: 801 bytes --] On Thu, 2002-09-12 at 08:57, Igor Pechtchanski wrote: > On Wed, 11 Sep 2002, Paul Johnston wrote: > > > > No, I'm not. I'm incorporating Warren Young's suggestion. Unless someone > > > with ME can confirm that 'uname -s' returns CYGWIN_9*? Nicholas? > > > > To me that's a step backwards - uname -s or $OS are the correct ways to > > detect the operating system. Warren's approach would be fooled if a user > > defined $SYSTEMROOT on Win 9x. > > Win 9x does not set $OS... At least my Win 98 machine at home doesn't. > Besides, the user can always set $OS to fool the script, Rule #1: The user knows better than the tool. If the user wants to fool the script, they can, even with uname. If a user is doing that, assume they have a reason and let them do it with grace. Rob [-- Attachment #2: This is a digitally signed message part --] [-- Type: application/pgp-signature, Size: 189 bytes --] ^ permalink raw reply [flat|nested] 38+ messages in thread
* Re: Beginnings of a patch: /etc/hosts 2002-09-11 16:35 ` Robert Collins @ 2002-09-11 17:10 ` Randall R Schulz 2002-09-11 17:26 ` OT " Igor Pechtchanski ` (3 more replies) 2002-09-11 17:14 ` Igor Pechtchanski 1 sibling, 4 replies; 38+ messages in thread From: Randall R Schulz @ 2002-09-11 17:10 UTC (permalink / raw) To: cygwin Rob, That rule is only apt if the user knows what external state is used as input to the program they're running. If that input or dependency is made explicit somehow (documentation might suffice), then you're right and it's a matter of user control. However, if the user must examine the program's source code to know why it's not behaving in the manner its authors describe, that's not cool. As you may know, I don't subscribe to that "Use the Source, Duke" business. If one must understand the internal workings of a thing just to use it, it's not very good technology. It virtually negates the concept of automation! Randall Schulz Mountain View, CA USA At 16:15 2002-09-11, Robert Collins wrote: >On Thu, 2002-09-12 at 08:57, Igor Pechtchanski wrote: > > On Wed, 11 Sep 2002, Paul Johnston wrote: > > > > > > No, I'm not. I'm incorporating Warren Young's suggestion. Unless > someone > > > > with ME can confirm that 'uname -s' returns CYGWIN_9*? Nicholas? > > > > > > To me that's a step backwards - uname -s or $OS are the correct ways to > > > detect the operating system. Warren's approach would be fooled if a user > > > defined $SYSTEMROOT on Win 9x. > > > > Win 9x does not set $OS... At least my Win 98 machine at home doesn't. > > Besides, the user can always set $OS to fool the script, > >Rule #1: The user knows better than the tool. If the user wants to fool >the script, they can, even with uname. If a user is doing that, assume >they have a reason and let them do it with grace. > >Rob -- 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] 38+ messages in thread
* OT Re: Beginnings of a patch: /etc/hosts 2002-09-11 17:10 ` Randall R Schulz @ 2002-09-11 17:26 ` Igor Pechtchanski 2002-09-12 4:33 ` Nicholas Wourms 2002-09-11 19:00 ` Christopher Faylor ` (2 subsequent siblings) 3 siblings, 1 reply; 38+ messages in thread From: Igor Pechtchanski @ 2002-09-11 17:26 UTC (permalink / raw) To: Randall R Schulz; +Cc: cygwin On Wed, 11 Sep 2002, Randall R Schulz wrote: > As you may know, I don't subscribe to that "Use the Source, Duke" > business. If one must understand the internal workings of a thing just > to use it, it's not very good technology. It virtually negates the > concept of automation! Used to be all drivers had to be mechanics... (sorry, couldn't resist) :-D 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] 38+ messages in thread
* Re: OT Re: Beginnings of a patch: /etc/hosts 2002-09-11 17:26 ` OT " Igor Pechtchanski @ 2002-09-12 4:33 ` Nicholas Wourms 2002-09-12 4:46 ` Nicholas Wourms 0 siblings, 1 reply; 38+ messages in thread From: Nicholas Wourms @ 2002-09-12 4:33 UTC (permalink / raw) To: cygwin, Randall R Schulz; +Cc: cygwin --- Igor Pechtchanski <pechtcha@cs.nyu.edu> wrote: > On Wed, 11 Sep 2002, Randall R Schulz wrote: > > > As you may know, I don't subscribe to that "Use the Source, Duke" > > business. If one must understand the internal workings of a > thing just > > to use it, it's not very good technology. It virtually negates > the > > concept of automation! > > Used to be all drivers had to be mechanics... > (sorry, couldn't resist) :-D Then the people got a clue and engaged in an enlightened practice called "Division of Labor". 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] 38+ messages in thread
* Re: OT Re: Beginnings of a patch: /etc/hosts 2002-09-12 4:33 ` Nicholas Wourms @ 2002-09-12 4:46 ` Nicholas Wourms 0 siblings, 0 replies; 38+ messages in thread From: Nicholas Wourms @ 2002-09-12 4:46 UTC (permalink / raw) To: cygwin, Randall R Schulz; +Cc: cygwin --- Igor Pechtchanski <pechtcha@cs.nyu.edu> wrote: > On Wed, 11 Sep 2002, Randall R Schulz wrote: > > > As you may know, I don't subscribe to that "Use the Source, Duke" > > business. If one must understand the internal workings of a > thing just > > to use it, it's not very good technology. It virtually negates > the > > concept of automation! > > Used to be all drivers had to be mechanics... > (sorry, couldn't resist) :-D Then the people got a clue and engaged in an enlightened practice called "Division of Labor". 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] 38+ messages in thread
* Re: Beginnings of a patch: /etc/hosts 2002-09-11 17:10 ` Randall R Schulz 2002-09-11 17:26 ` OT " Igor Pechtchanski @ 2002-09-11 19:00 ` Christopher Faylor 2002-09-12 8:56 ` Joe Buehler 2002-09-11 23:25 ` Robert Collins 2002-09-12 4:11 ` Nicholas Wourms 3 siblings, 1 reply; 38+ messages in thread From: Christopher Faylor @ 2002-09-11 19:00 UTC (permalink / raw) To: cygwin On Wed, Sep 11, 2002 at 04:35:58PM -0700, Randall R Schulz wrote: >That rule is only apt if the user knows what external state is used as >input to the program they're running. If that input or dependency is made >explicit somehow (documentation might suffice), then you're right and it's >a matter of user control. However, if the user must examine the program's >source code to know why it's not behaving in the manner its authors >describe, that's not cool. I agree with this, especially in this case. If a user casually changes an environment variable to something "nonstandard" then they shouldn't be surprised by the behavior of our tools. This is different from prompting them for OS and letting the user lie if they want to. In that case, I'd agree that they should be able to do this. >As you may know, I don't subscribe to that "Use the Source, Duke" >business. If one must understand the internal workings of a thing just >to use it, it's not very good technology. It virtually negates the >concept of automation! It's not necessarily bad technology. It could be bad documentation. It could be poor comprehension. People *often* jump to the conclusion that if something is confusing to them it is an indication of some flaw in the product or documentation. While consistent complaints of a problem probably do indicate this, isolated cases of "This is confusing to me!" do not necessarily mean anything other than the fact that someone may have limited capabilities. However, regardless of any of the above, in a free software project, the source could well be the best documentation available. If it isn't then that boils down to either helping to fix the documentation, or to fix the program itself, or being satisfied that you got what you paid for. cgf -- 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] 38+ messages in thread
* Re: Beginnings of a patch: /etc/hosts 2002-09-11 19:00 ` Christopher Faylor @ 2002-09-12 8:56 ` Joe Buehler 0 siblings, 0 replies; 38+ messages in thread From: Joe Buehler @ 2002-09-12 8:56 UTC (permalink / raw) To: cygwin Christopher Faylor wrote: > I agree with this, especially in this case. If a user casually changes > an environment variable to something "nonstandard" then they shouldn't > be surprised by the behavior of our tools. This is different from > prompting them for OS and letting the user lie if they want to. In > that case, I'd agree that they should be able to do this. Environment variables are the source of a lot of trouble, and I avoid them as much as possible. What a great idea -- global variables in your program that any user can change -- regardless of whether he knows he did it, or what the effect might be! Joe Buehler -- 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] 38+ messages in thread
* Re: Beginnings of a patch: /etc/hosts 2002-09-11 17:10 ` Randall R Schulz 2002-09-11 17:26 ` OT " Igor Pechtchanski 2002-09-11 19:00 ` Christopher Faylor @ 2002-09-11 23:25 ` Robert Collins 2002-09-12 4:11 ` Nicholas Wourms 3 siblings, 0 replies; 38+ messages in thread From: Robert Collins @ 2002-09-11 23:25 UTC (permalink / raw) To: Randall R Schulz; +Cc: cygwin [-- Attachment #1: Type: text/plain, Size: 932 bytes --] On Thu, 2002-09-12 at 09:35, Randall R Schulz wrote: > Rob, > > That rule is only apt if the user knows what external state is used as > input to the program they're running. If that input or dependency is made > explicit somehow (documentation might suffice), then you're right and it's > a matter of user control. However, if the user must examine the program's > source code to know why it's not behaving in the manner its authors > describe, that's not cool. > > As you may know, I don't subscribe to that "Use the Source, Duke" business. > If one must understand the internal workings of a thing just to use it, > it's not very good technology. It virtually negates the concept of automation! I agree completely. My point (which I think you may have missed) is that buliding the internal workings on the basis that 'someone may override foo and we must prevent that' is not good technology. Rob [-- Attachment #2: This is a digitally signed message part --] [-- Type: application/pgp-signature, Size: 189 bytes --] ^ permalink raw reply [flat|nested] 38+ messages in thread
* Re: Beginnings of a patch: /etc/hosts 2002-09-11 17:10 ` Randall R Schulz ` (2 preceding siblings ...) 2002-09-11 23:25 ` Robert Collins @ 2002-09-12 4:11 ` Nicholas Wourms 3 siblings, 0 replies; 38+ messages in thread From: Nicholas Wourms @ 2002-09-12 4:11 UTC (permalink / raw) To: Randall R Schulz, cygwin > As you may know, I don't subscribe to that "Use the Source, Duke" > business. > If one must understand the internal workings of a thing just to use > it, > it's not very good technology. It virtually negates the concept of > automation! Hell Yeah Randall!! I completely agree, as this "Use the Source, Duke" crap is also contrary to OOP. In OOP, as we all know, you shouldn't have to worry about how the object actually works, you should only care that it works given the proper input. In the same way, one shouldn't not be forced to learn the internals of every "tool" just to use it. As for another point, some of us aren't Star Wars fans (myself included). [I know this is off topic, but I've been rather partial to Star Trek myself...] 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] 38+ messages in thread
* Re: Beginnings of a patch: /etc/hosts 2002-09-11 16:35 ` Robert Collins 2002-09-11 17:10 ` Randall R Schulz @ 2002-09-11 17:14 ` Igor Pechtchanski 2002-09-12 1:27 ` Robert Collins 1 sibling, 1 reply; 38+ messages in thread From: Igor Pechtchanski @ 2002-09-11 17:14 UTC (permalink / raw) To: Robert Collins; +Cc: cygwin On 12 Sep 2002, Robert Collins wrote: > On Thu, 2002-09-12 at 08:57, Igor Pechtchanski wrote: > > On Wed, 11 Sep 2002, Paul Johnston wrote: > > > > > > No, I'm not. I'm incorporating Warren Young's suggestion. > > > > Unless someone with ME can confirm that 'uname -s' returns > > > > CYGWIN_9*? Nicholas? > > > > > > To me that's a step backwards - uname -s or $OS are the correct ways > > > to detect the operating system. Warren's approach would be fooled if > > > a user defined $SYSTEMROOT on Win 9x. > > > > Win 9x does not set $OS... At least my Win 98 machine at home doesn't. > > Besides, the user can always set $OS to fool the script, > > Rule #1: The user knows better than the tool. If the user wants to fool > the script, they can, even with uname. If a user is doing that, assume > they have a reason and let them do it with grace. > > Rob True. Hey, I'm a control freak myself... I was not speaking against "fooling the script", I was just making an observation. However, the issue here is not the intentional "fooling" that you describe, but unintentional. It's much harder to do that with 'uname -s' than with an environment variable. Besides, why would anyone want to fool a post-install script? Mmm, I guess I could think of a few reasons, but then shouldn't all post-install scripts be susceptible to fooling in the same way, i.e., "with grace"? Should this be documented somewhere? 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] 38+ messages in thread
* Re: Beginnings of a patch: /etc/hosts 2002-09-11 17:14 ` Igor Pechtchanski @ 2002-09-12 1:27 ` Robert Collins 0 siblings, 0 replies; 38+ messages in thread From: Robert Collins @ 2002-09-12 1:27 UTC (permalink / raw) To: cygwin [-- Attachment #1: Type: text/plain, Size: 1270 bytes --] On Thu, 2002-09-12 at 10:10, Igor Pechtchanski wrote: > > Rule #1: The user knows better than the tool. If the user wants to fool > > the script, they can, even with uname. If a user is doing that, assume > > they have a reason and let them do it with grace. > > > > Rob > > True. Hey, I'm a control freak myself... I was not speaking against > "fooling the script", I was just making an observation. However, the > issue here is not the intentional "fooling" that you describe, but > unintentional. It's much harder to do that with 'uname -s' than with an > environment variable. Ok, I mis-interpreted your intention. > Besides, why would anyone want to fool a post-install script? > Mmm, I guess I could think of a few reasons, but then shouldn't all > post-install scripts be susceptible to fooling in the same way, i.e., > "with grace"? Should this be documented somewhere? I wasn't suggesting they *should* or *should not* be foolable. I was really trying to say that the design should not be based on whether or not a user can *intentionally* override something - because one way or another the user can. The design should be whatever is: * easy to maintain * robust in the face of usual and common-unusual conditions. Rob [-- Attachment #2: This is a digitally signed message part --] [-- Type: application/pgp-signature, Size: 189 bytes --] ^ permalink raw reply [flat|nested] 38+ messages in thread
* Re: Beginnings of a patch: /etc/hosts 2002-09-11 15:37 ` Igor Pechtchanski 2002-09-11 15:40 ` Paul Johnston @ 2002-09-11 17:54 ` Igor Pechtchanski 2002-09-12 4:08 ` Nicholas Wourms 2002-09-12 10:11 ` Warren Young 3 siblings, 0 replies; 38+ messages in thread From: Igor Pechtchanski @ 2002-09-11 17:54 UTC (permalink / raw) To: Warren Young; +Cc: cygwin On Wed, 11 Sep 2002, Igor Pechtchanski wrote: > On another note, I'm not sure why you were checking for the presence of > the windows files. We could still create dangling symlinks if they are > missing, which will allow the files to be created by editing/saving the > symlink. Sorry, misread your script. Please disregard 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 -- 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] 38+ messages in thread
* Re: Beginnings of a patch: /etc/hosts 2002-09-11 15:37 ` Igor Pechtchanski 2002-09-11 15:40 ` Paul Johnston 2002-09-11 17:54 ` Igor Pechtchanski @ 2002-09-12 4:08 ` Nicholas Wourms 2002-09-12 10:08 ` Warren Young 2002-09-12 10:11 ` Warren Young 3 siblings, 1 reply; 38+ messages in thread From: Nicholas Wourms @ 2002-09-12 4:08 UTC (permalink / raw) To: cygwin; +Cc: Paul Johnston, Warren Young --- Igor Pechtchanski <pechtcha@cs.nyu.edu> wrote: > Hi, > Script attached; comments below. > > On Wed, 11 Sep 2002, Paul Johnston wrote: > > > Hi, > > Brilliant to see so much progress on this! > > Are you sure that "CYGWIN_9*)" correctly catches Windows ME? > > No, I'm not. I'm incorporating Warren Young's suggestion. Unless > someone > with ME can confirm that 'uname -s' returns CYGWIN_9*? Nicholas? Nope, it returns "CYGWIN_ME-4.90" 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] 38+ messages in thread
* Re: Beginnings of a patch: /etc/hosts 2002-09-12 4:08 ` Nicholas Wourms @ 2002-09-12 10:08 ` Warren Young 0 siblings, 0 replies; 38+ messages in thread From: Warren Young @ 2002-09-12 10:08 UTC (permalink / raw) To: Cygwin-L Nicholas Wourms wrote: >>>Brilliant to see so much progress on this! >>>Are you sure that "CYGWIN_9*)" correctly catches Windows ME? >> >>No, I'm not. I'm incorporating Warren Young's suggestion. Unless >>someone >>with ME can confirm that 'uname -s' returns CYGWIN_9*? Nicholas? > > Nope, it returns "CYGWIN_ME-4.90" Okay, two possibilities now. One is to add a special case for ME. It occurs to me that this is somewhat brittle -- who's to say this won't break again when yet another flavor of Windows comes out? (<rhetoric>Why, Microsoft, oh why, are version numbers so offensive in thy sight?</rhetoric>) The other is to go with my environment variable approach. I'm pretty sure SYSTEMROOT is automatically defined on NT; it can be removed by a determined user, of course. Can anyone make such a claim for WINDIR on 9x type systems? The variable exists on the Win98 box in my office. I agree with the previous posts about letting people monkey-wrench the system if they're determined to, for what that's worth. I think that the protection of checking that the directory name we come up with exists is sufficient protection -- if it exists, assume that it's the correct directory. If it's not a directory, then we can safely assume that something's hosed and refuse to make the symlinks. -- 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] 38+ messages in thread
* Re: Beginnings of a patch: /etc/hosts 2002-09-11 15:37 ` Igor Pechtchanski ` (2 preceding siblings ...) 2002-09-12 4:08 ` Nicholas Wourms @ 2002-09-12 10:11 ` Warren Young 3 siblings, 0 replies; 38+ messages in thread From: Warren Young @ 2002-09-12 10:11 UTC (permalink / raw) To: cygwin Igor Pechtchanski wrote: > > On another note, I'm not sure why you were checking for the presence of > the windows files. I'm only checking for the existence of the Windows directory where we are expecting to find the hosts file and such. This is to protect against the preceding code somehow failing to find the correct directory. Let's say the script is somehow fooled into generating a WinNT-style path on a 9x type box: in that case the path won't exist, so even though the symlink can be created, it won't point to a useful path. > We could still create dangling symlinks if they are > missing, which will allow the files to be created by editing/saving the > symlink. Precisely the correct behavior. On Win9x systems, hosts and such don't exist until the user creates one. There's a *.sam ("sample") version of those files by default. -- 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] 38+ messages in thread
* Re: Suggestion: /etc/hosts 2002-09-09 2:45 Suggestion: /etc/hosts Paul Johnston ` (4 preceding siblings ...) 2002-09-10 11:46 ` Beginnings of a patch: /etc/hosts Paul Johnston @ 2002-09-10 13:54 ` Warren Young 5 siblings, 0 replies; 38+ messages in thread From: Warren Young @ 2002-09-10 13:54 UTC (permalink / raw) To: Cygwin-L news@garydjones.mailshell.com wrote: > On 09 Sep 2002, Paul Johnston <paj@pajhome.org.uk> wrote: > > Depending on your setup though, > editing a file in your favourite Cygwin based editor might give > you an odd looking file in the end (some lines with DOS-endings > and some with *n*x-endings). Vim is smart enough to detect what kind of text file you have and set its editing mode to match. Any other editor worth using behaves the same way, but that's just a tautology. :) -- 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] 38+ messages in thread
end of thread, other threads:[~2002-09-12 17:01 UTC | newest] Thread overview: 38+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2002-09-09 2:45 Suggestion: /etc/hosts Paul Johnston 2002-09-09 5:38 ` Nicholas Wourms 2002-09-09 5:40 ` Marcos Lorenzo de Santiago 2002-09-09 6:51 ` Joe Buehler 2002-09-09 7:32 ` Christopher Faylor 2002-09-10 2:19 ` Paul Johnston 2002-09-11 7:43 ` Jim 2002-09-09 11:25 ` news [not found] ` <E17oTbC-0001AV-00@quimby.gnus.org> 2002-09-10 9:52 ` Shankar Unni 2002-09-10 11:46 ` Beginnings of a patch: /etc/hosts Paul Johnston 2002-09-10 13:36 ` Igor Pechtchanski 2002-09-11 0:59 ` John Morrison 2002-09-11 2:06 ` Corinna Vinschen 2002-09-11 9:57 ` Joe Buehler 2002-09-11 11:17 ` Igor Pechtchanski 2002-09-11 11:42 ` Joe Buehler 2002-09-11 12:39 ` Igor Pechtchanski 2002-09-11 14:24 ` Paul Johnston 2002-09-11 14:53 ` Warren Young 2002-09-11 15:37 ` Igor Pechtchanski 2002-09-11 15:40 ` Paul Johnston 2002-09-11 16:15 ` Igor Pechtchanski 2002-09-11 16:35 ` Robert Collins 2002-09-11 17:10 ` Randall R Schulz 2002-09-11 17:26 ` OT " Igor Pechtchanski 2002-09-12 4:33 ` Nicholas Wourms 2002-09-12 4:46 ` Nicholas Wourms 2002-09-11 19:00 ` Christopher Faylor 2002-09-12 8:56 ` Joe Buehler 2002-09-11 23:25 ` Robert Collins 2002-09-12 4:11 ` Nicholas Wourms 2002-09-11 17:14 ` Igor Pechtchanski 2002-09-12 1:27 ` Robert Collins 2002-09-11 17:54 ` Igor Pechtchanski 2002-09-12 4:08 ` Nicholas Wourms 2002-09-12 10:08 ` Warren Young 2002-09-12 10:11 ` Warren Young 2002-09-10 13:54 ` Suggestion: /etc/hosts Warren Young
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).