This is the mail archive of the 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: Starting up : file seek order

On Thu, 3 Jul 2003 wrote:

> Four questions with my guessed answers. Please would it be possible for
> somebody who _knows_ the answers to respond? Then there's a 5th question, of
> the right answer to which I haven't a clue. Thanks very much indeed.
> Q1. When starting (a properly installed and mounted) Cygwin up using the
> command c:\bin\bash --login -i <Enter> it seems that the file /etc/profile
> is sought and run then the file ~/.bash_profile likewise. Yes? (This seems
> to happen even when both files are empty, as evidenced by constructing them
> as one-line files of the type "echo This file is called...".)
> Q2. When starting Cygwin up using the command c:\bin\bash <Enter> it seems
> that the file ~/.bashrc is sought and run. The file /etc/profile isn't. Yes?

The above 2 questions can be answered by the bash info page (see "Bash
Features -> Bash Startup Files").

> Q3. Even if all 3 files exist but are empty, Cygwin (however it is started
> up) "knows" what HOME is, and therefore I deduce it gets it from
> /etc/passwd. So, at some stage prior to the searches described in QQ1 and 2,
> /etc/passwd and /etc/group are sought. Yes?

I'm not too clear on this one, perhaps a look at the bash source might

> Q4. If /etc/passwd does not exist, then $HOME is set by default to /. Yes?
> My final question refers to a version of Cygwin run from a portable CD G: on
> a Cygwin-free machine, and therefore I recognise that it might not get
> (might not deserve) an answer. The system is mounted using the command
> g:\bin\mount g:/ / and thereafter it is started using (either) g:\bin\bash
> or g:\bin\bash --login -i. Apart from the differences described in Q1 and Q2
> above either usage is thereafter indistinguishable (to me). The file
> g:\etc\passwd contains one line
>     entry1:entry2:500:544:entry3:/home/entry4:/bin/bash
> and works fine on machines with W98(SE). But not on NT (although,
> annoyingly, I have a memory that once it did).

On NT, the correct /etc/passwd entry is determined by the numeric UID.  If
you're sure you're logging in as Administrator, then the UID is correct,
but check that by running "id".  If it turns out your UID is not correct,
that's probably your problem.  Also, you are missing the SID, but I don't
think there's a very good solution for this, as the SID will change from
machine to machine.

> Q5. Because when an attempt is made to run the CD version from NT machines
> it turns out that HOME is set to /, and not to /home/entry4, I deduce
> (possibly wrongly) that /etc/passwd as written above is either not being
> read or is inadequate to define HOME. Yes?

As mentioned above, most likely the UID is incorrect.

> I know that on NT and XP systems the command mkpasswd -l generates a file
> much more than one line long. I could try to use that, which would
> necessitate understanding it. Yuk. And run the risk of breaking the current
> happy working-ness on W98 systems. I know I could, and should, try it. But
> maybe something I've written will generate a quick and clear pointer to
> what's tripping the NT mounted portable system up?
> Thank you.
> Fergus

Can you compare the entry generated by "mkpasswd -ls" and the one in your
/etc/passwd and see if they differ?

One thing you can do is mount /etc from some place on the local disk, and
regenerate /etc/passwd every time...  You can do this from the .bat file,
and then when you start bash, you'll get the newly created /etc/passwd.  I
know it's ugly, but it's a possibility...
      |\      _,,,---,,_
ZZZzz /,`.-'`'    -.  ;-;;,_
     |,4-  ) )-,_. ,\ (  `'-'		Igor Pechtchanski, Ph.D.
    '---''(_/--'  `-'\_) fL	a.k.a JaguaR-R-R-r-r-r-.-.-.  Meow!

"I have since come to realize that being between your mentor and his route
to the bathroom is a major career booster."  -- Patrick Naughton

Unsubscribe info:
Problem reports:

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