Bug in $PATH initialization?

View: New views
7 Messages — Rating Filter:   Alert me  

Bug in $PATH initialization?

by Lennart Borgman (gmail) :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

I am trying to get "bash -i" to start up with $PATH having

   /usr/local/bin:/usr/bin:/bin

at the beginning. I believe I need to do this without any init file
running so I set the windows Path variable to contain the
corresponding windows directories first. So I set Path in cmd.exe with

  set Path=c:\cygwin\bin;%Path%
  set Path=c:\cygwin\usr\bin;%Path%
  set Path=c:\cygwin\usr\local\bin;%Path%

and then I do

  bash -i

However $PATH starts with

   /usr/local/bin:/usr/bin:/usr/bin

I thought the last dir above should be /bin, not /usr/bin.

Is this intentional or is it a bug. If it is intentional can I somehow
do what I want another way?

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


Re: Bug in $PATH initialization?

by Bugzilla from en.ABCD@gmail.com :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Lennart Borgman wrote:

> I am trying to get "bash -i" to start up with $PATH having
>
>    /usr/local/bin:/usr/bin:/bin
>
> at the beginning. I believe I need to do this without any init file
> running so I set the windows Path variable to contain the
> corresponding windows directories first. So I set Path in cmd.exe with
>
>   set Path=c:\cygwin\bin;%Path%
>   set Path=c:\cygwin\usr\bin;%Path%
>   set Path=c:\cygwin\usr\local\bin;%Path%
>
> and then I do
>
>   bash -i
>
> However $PATH starts with
>
>    /usr/local/bin:/usr/bin:/usr/bin
>
> I thought the last dir above should be /bin, not /usr/bin.
>
> Is this intentional or is it a bug. If it is intentional can I somehow
> do what I want another way?
>

In Cygwin, /bin and /usr/bin both always point to the same place, so it
does get the effect you seem to want, just not in the way you expected.

- --
ABCD
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.11 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iEYEARECAAYFAkotkKAACgkQOypDUo0oQOpQ6wCg20NQ1Yf/7/sW08Pxbp3NUgA6
3akAoMztsU4OQPr79EPJXo7c1or8kgc5
=Pqw2
-----END PGP SIGNATURE-----


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


Re: Bug in $PATH initialization?

by Lennart Borgman (gmail) :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Tue, Jun 9, 2009 at 12:28 AM, ABCD<en.ABCD@...> wrote:

> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> Lennart Borgman wrote:
>> I am trying to get "bash -i" to start up with $PATH having
>>
>>    /usr/local/bin:/usr/bin:/bin
>>
>> at the beginning. I believe I need to do this without any init file
>> running so I set the windows Path variable to contain the
>> corresponding windows directories first. So I set Path in cmd.exe with
>>
>>   set Path=c:\cygwin\bin;%Path%
>>   set Path=c:\cygwin\usr\bin;%Path%
>>   set Path=c:\cygwin\usr\local\bin;%Path%
>>
>> and then I do
>>
>>   bash -i
>>
>> However $PATH starts with
>>
>>    /usr/local/bin:/usr/bin:/usr/bin
>>
>> I thought the last dir above should be /bin, not /usr/bin.
>>
>> Is this intentional or is it a bug. If it is intentional can I somehow
>> do what I want another way?
>>
>
> In Cygwin, /bin and /usr/bin both always point to the same place, so it
> does get the effect you seem to want, just not in the way you expected.

Thanks, but why do I see both /usr/bin and /bin in a cygwin shell
started with --login then?

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


Parent Message unknown Re: Bug in $PATH initialization?

by Mark Harig :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

 From the bash manual (in emacs: M-: (info "(bash) Bash Startup Files")):

"When Bash is invoked as an interactive login shell, or as a
non-interactive shell with the `--login' option, it first reads and
executes commands from the file `/etc/profile', if that file exists.
After reading that file, it looks for `~/.bash_profile',
`~/.bash_login', and `~/.profile', in that order, and reads and
executes commands from the first one that exists and is readable.  The
`--noprofile' option may be used when the shell is started to inhibit
this behavior."

and

"When an interactive shell that is not a login shell is started, Bash
reads and executes commands from `~/.bashrc', if that file exists.
This may be inhibited by using the `--norc' option."

So, in the typical case, when you start bash with '-i', it sources the
following files:
          /etc/profile   # which typically contains PATH initialization
          ~/.bash_profile  # or some other "login" file, such as ~/.profile
          ~/.bash_profile will usually source ~/.bashrc (the non-login code)

To avoid having these files read, start bash with '--noprofile' (if you wish
to avoid reading /etc/profile and ~/.bash_profile) and '--norc' (if you wish
to avoid reading ~/.bashrc.  Or, simply edit /etc/profile and ~/.bashrc,
where PATH is typically set to get PATH to have the ordering that you
want.


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


Re: Bug in $PATH initialization?

by Lennart Borgman (gmail) :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Tue, Jun 9, 2009 at 1:05 AM, Mark Harig<idirectscm@...> wrote:

> From the bash manual (in emacs: M-: (info "(bash) Bash Startup Files")):
>
> "When an interactive shell that is not a login shell is started, Bash
> reads and executes commands from `~/.bashrc', if that file exists.
> This may be inhibited by using the `--norc' option."
>
> So, in the typical case, when you start bash with '-i', it sources the
> following files:
>         /etc/profile   # which typically contains PATH initialization
>         ~/.bash_profile  # or some other "login" file, such as ~/.profile
>         ~/.bash_profile will usually source ~/.bashrc (the non-login code)
>
> To avoid having these files read, start bash with '--noprofile' (if you wish
> to avoid reading /etc/profile and ~/.bash_profile) and '--norc' (if you wish
> to avoid reading ~/.bashrc.  Or, simply edit /etc/profile and ~/.bashrc,
> where PATH is typically set to get PATH to have the ordering that you
> want.

Thanks Mark. I might need this information, I am not sure at the
moment, but I am trying to do avoid changing anything in this file. I
am not the user so to say.

What I am trying to do is to make the setup for the command
cygwin-shell in the Emacs+EmacsW32 distro as automatic as possible.
The user should not have to care. It should just work. (This is native
Emacs, compiled for windows, not for cygwin.)

So therefor I check the cygwin installation from the windows registry
and try to add the path for cygwin as I told before.

The information I got here is that the result from what I do should
work as expected. There is now only one flaw and that is that cygwin
will not show the expected path in $PATH. This could be a source of
great confusion and waste a lot of time for a user hunting a difficult
error so it would be good if it could be fixed.

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


Bash initialization w/cygwin-1.7

by Jerry DeLisle :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

I am making the switch to 1.7.  I started with a clean windows (nt4) environment
and went through the usual run of setup-1.7 downloaded today.

All appears fine, but bash does not get initialized.

pwd is /usr/bin

path is not set

home directory is not created

These are all taken care of nicely for the user with cygwin 1.5

I think this is a bug unless I am missing something in the install process.

Please advise.

Jerry

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


Re: Bash initialization w/cygwin-1.7

by Eric Blake :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

According to Jerry DeLisle on 7/4/2009 7:10 PM:
> All appears fine, but bash does not get initialized.

And this has already been brought up.  I'm hoping that today's binutils
release solves things, although I won't have a chance to release an
updated readline until Monday.

http://cygwin.com/ml/cygwin/2009-07/msg00114.html
http://cygwin.com/ml/cygwin/2009-07/msg00126.html

- --
Don't work too hard, make some time for fun as well!

Eric Blake             ebb9@...
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (Cygwin)
Comment: Public key at home.comcast.net/~ericblake/eblake.gpg
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iEYEARECAAYFAkpQLDgACgkQ84KuGfSFAYA2OQCfWcLfhiwJeHtgCn4KmwP9dFtd
BlYAoNdct2BAqEDJj5RowRVa4RXxTfYu
=wJvU
-----END PGP SIGNATURE-----

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