This is the mail archive of the cygwin-developers 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]

setup/mkpasswd and HOMEDRIVE/HOMEPATH


Here's another question.

Right now, mkpasswd -c generates the homedir for the current user in the
following order:

  if $HOME exists use $HOME for pw_dir
  else if $HOMEPATH exists use $HOMEDRIVE/$HOMEPATH for pw_dir
  else construct pw_dir as "/home/$USER"

However, everything after the first line is practically useless because
the Cygwin DLL itself will create a $HOME variable if it doesn't exist
using a very similar algorithm:

  if $HOME exists leave it alone
  else if user entry in /etc/passwd exists and has non-empty pw_dir, use it
  else if $HOMEDRIVE/$HOMEPATH exist and are non-empty, use them
  else set $HOME to "/"

I found an annoying problem with this when the passwd entry for the
current user is created for the first time after a fresh Cygwin
installation.

Since $HOME usually doesn't exist and no passwd entry exists either,
$HOMEDRIVE/$HOMEPATH is used to construct the home dir for the user.  On
Vista or later this will result in a default home dir of, in my case,
/cygdrive/c/Users/corinna.

I'm wondering if that's (still) the right thing to do.

First of all, the user's default Cygwin home dir is outside of the
Cygwin tree which is not exactly clean, IMHO.

Second, since the user's home dir already exists the first time a shell
is started, the mechanism in /etc/profile which creates the skeleton
files over into the user's home dir doesn't kick in and the user is left
with no personal profiles.

Third, starting with Vista, Windows Explorer has the annoying habit of
marking all files with an additional "shared file" marker in the User's
profile directory, which have (for instance) ACEs for Everyone in their
ACL.  This makes Explorer incredibly slow if many files have to get this
marker. Since all Cygwin files have an ACE for Everyone to reflect the
POSIX permissions for "others", you can guess what happens.  We already
had reports about this on the list.

So, what I'd like to propose is to change the $HOME evaluation in Cygwin
to something like this:

  if $HOME exists leave it alone
  else if user entry in /etc/passwd exists and has non-empty pw_dir, use it
  else set $HOME to "/home/$USER"

and mkpasswd:

  if $HOME exists use $HOME for pw_dir
  else construct pw_dir as "/home/$USER"

The downside is that the default UNIX mechanism to set a user's homedir
to "/" if pw_dir is empty is dropped.  However, the longer I think about
it, the more I think that the above outlined change better reflects what
we need for Cygwin.


Opinions?  Cool, Blerch, Shrug?


Corinna

-- 
Corinna Vinschen                  Please, send mails regarding Cygwin to
Cygwin Project Co-Leader          cygwin AT cygwin DOT com
Red Hat


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