This is the mail archive of the cygwin@cygwin.com 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: Cygwin home dir=/cygwin/c (not /home/<userid>)


a12 wrote:
> 
> Pierre,
> 
> 'echo %HOME%' yields 'C:\'
> 
> Modifying /etc/profile:
> # Set up USER's home directory
> # 020102 magr40 force to use /home/$USER
> #if [ -z "$HOME" ]; then
>   HOME="/home/$USER"
> #fi
> solves my problem, but is it the correct way to do it ?

It's correct but not particularly elegant as it duplicates
what passwd is supposed to be for.
I assume HOME is defined as a system variable in the Windows 
environment and it is the same for everybody. 
Is there a good reason for that?
Otherwise undefine it and everything will be well.

For reference, here is how HOME is set, in order of priority
- When starting from Windows
1) From existing HOME in Windows environment, translated to Posix
2) If the user has an entry in passwd:
   a) from passwd, if the home directory field in non empty
   b) from HOMEDRIVE/HOMEPATH
3) /
- telnetd and rlogind
1) From passwd, if it is a valid directory
2) /
- sshd
1) From passwd, even if it is invalid.
   In that case /etc/profile may actually create it.

Note that in all those cases HOME is never set in /etc/profile !
 
Pierre

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


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