This is the mail archive of the cygwin mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [ANNOUNCEMENT] Updated: Cygwin 2.2.0-1


Am 05.08.2015 um 09:54 schrieb Corinna Vinschen:
On Aug  4 20:53, Achim Gratz wrote:
Warren Young writes:
Hereâs an interesting experiment to try on your non-Cygwin POSIX boxes:

     $ HOME=/dfjkshkds bash -l
     $ echo $HOME

Guess what it prints.

Hint: It isnât the second-to-last field in /etc/passwd. :)
This is correct behaviour, of course.

Spoiler: Apparently Cygwin is already doing the standard thing.
No, it's not.  Or, to phrase it a bit differently, it doesn't perform
thr action it was supposed to do.  My testing seemed to be a teeny bit
half-hearted...

The problem the fix was *supposed* to fix (but it didn't) was to disallow
incoming $HOME values which are non-POSIX or non-absolute paths.  These
$HOME values should be disregarded.
Why?
So the idea was:

   set HOME=foo		<- ignored, set HOME from passwd DB entry
   set HOME=C:/foo	<- same
No, please don't!
   set HOME=//foo/bar	<- same
   set HOME=/foo/bar	<- valid, taken

Right now, when started from a non-Cygwin process, Cygwin takes the
value of $HOME and simply calls the Win32->POSIX conversion function.
It does so for a long time, but is that right?  Especially if %HOME% is
a non-absolute == relative path, the resulting POSIX value of $HOME
depends on the current directory when starting Cygwin.
Other POSIX systems don't handle this situation well either, so I don't see a need to act here.
This sounds like a terrible idea to me.  Together with cases like
https://cygwin.com/ml/cygwin/2015-07/msg00344.html, and the fact that
$HOME has no meaning in native Windows (HOMEPATH/HOMEDRIVE instead) I'm
inclined to think that any incoming $HOME should make sense from a POSIX
POV, otherwise we take the value from the passwd DB as defined by
/etc/nsswitch.conf.

Does anybody have a *good* reason *not* to change this?
Yes, other Windows software ported or inspired from POSIX may also check for HOME just in case (e.g. my editor does...). Also, if somebody sets HOME in Windows, it is more intuitive to use Windows path syntax, so this case should be handled gracefully, just like PATH is converted.
Thomas

---
Diese E-Mail wurde von Avast Antivirus-Software auf Viren geprÃft.
https://www.avast.com/antivirus


--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]