public inbox for cygwin@cygwin.com
 help / color / mirror / Atom feed
* RE: Incomplete environ when running MinGW apps?
@ 2008-02-07 16:29 Phil Betts
  2008-02-07 17:08 ` Paul Leder
  0 siblings, 1 reply; 15+ messages in thread
From: Phil Betts @ 2008-02-07 16:29 UTC (permalink / raw)
  To: cygwin

Paul Leder wrote on Thursday, February 07, 2008 3:31 PM::

> Eric Blake wrote:
> 
>> Bash has two variable namespaces - shell variables, and environment
>> variables.  Are you sure SHELL was exported to the environment, and
>> not just in the bash shell variable namespace?
> 
> thanks - I had no idea there were 2 variable namespaces. It looks like
> everything I can see in 'environ' was explcitly exported in
> /etc/profile, or ~/.bashrc, or picked up from Windows.
> 
> Is there a way for C programs to pick up the contents of the shell
> variable namespace? In particular, is there some way I can pick up
> SHELL, or some other way that I can find out if my app's running on
> bash? 
> 
> Thanks
> 
> -Paul

Just export the variables you want.  That's the whole point of the
export command.

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

^ permalink raw reply	[flat|nested] 15+ messages in thread
* Re: Incomplete environ when running MinGW apps?
@ 2008-07-15 14:26 Pedro Izecksohn
  0 siblings, 0 replies; 15+ messages in thread
From: Pedro Izecksohn @ 2008-07-15 14:26 UTC (permalink / raw)
  To: cygwin

> From: Christopher Faylor
>> I wrote:
>> Reference: http://sourceware.org/ml/cygwin/2008-02/msg00181.html
>> ...
>> 
>> "SHELL The full pathname to the shell is kept in this environment variable."
>>
>> It may also be read from:
>>http://www.gnu.org/software/bash/manual/bashref.html
> 
> Why are you responding to this email 5+ months after it was sent?

  Because I found this in the documentation just now; and I hope that someone fix something.

  I lament this feature is not POSIX.

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

^ permalink raw reply	[flat|nested] 15+ messages in thread
* Re: Incomplete environ when running MinGW apps?
@ 2008-07-15  8:27 Pedro Izecksohn
  2008-07-15 13:48 ` Christopher Faylor
  0 siblings, 1 reply; 15+ messages in thread
From: Pedro Izecksohn @ 2008-07-15  8:27 UTC (permalink / raw)
  To: cygwin

Reference: http://sourceware.org/ml/cygwin/2008-02/msg00181.html

"Are you sure SHELL was exported to the environment, and not just in the bash shell variable namespace?"

It is a documentation problem, from man bash:

"SHELL The full pathname to the shell is kept in this environment variable."

It may also be read from:
http://www.gnu.org/software/bash/manual/bashref.html

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

^ permalink raw reply	[flat|nested] 15+ messages in thread
* Incomplete environ when running MinGW apps?
@ 2008-02-07 14:46 Paul Leder
  2008-02-07 14:47 ` Eric Blake
  0 siblings, 1 reply; 15+ messages in thread
From: Paul Leder @ 2008-02-07 14:46 UTC (permalink / raw)
  To: Cygwin

Hi -

I'm having a problem reading bash environment variables when running a 
MinGW app on Cygwin's bash. I'm trying this on the MinGW list as well, 
but no luck so far. The basic problem is that SHELL is not visible in 
environ (or from getenv) on the app, even thought the program was 
launched from bash, where SHELL has the value /bin/bash. Does that sound 
familiar to anyone?

I've done some simple experimenting, as follows. I've written a
small test prog that prints out the contents of MinGW's stdlib 
'environ'. This is what I'm seeing, running everything from a Cygwin 
bash shell:

$ environ_dump.exe > env1
$ sort env1 > env1s
$ wc env1s
    44 65 1464 env1s
$ set > env2
$ sort env2 > env2s
$ wc env2s
    74 104 2062 env2s

Comparing env1s and env2s, I see:

1 - various bash environment variables never made it as far as
'environ'. These include all the BASH* variables, OSTYPE, SHELL, and so on.

2 - Various single-quoted variables from env2s end up unquoted in 'environ'.

3 - various other minor changes.

At first sight, it appears that all the bash and cygwin-specific stuff
has been left out of environ, but a lot of it is still there -
CVS_RSH, HOME, and so on.

Presumably I'm doing something really dumb. Any ideas? This is a
more-or-less out-of-the-box Win2K machine which I use for testing.

Thanks

-Paul

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

^ permalink raw reply	[flat|nested] 15+ messages in thread

end of thread, other threads:[~2008-07-15 14:27 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-02-07 16:29 Incomplete environ when running MinGW apps? Phil Betts
2008-02-07 17:08 ` Paul Leder
2008-02-07 17:52   ` Greg Chicares
2008-02-07 18:04     ` Paul Leder
2008-02-07 18:14       ` Dave Korn
2008-02-07 20:03         ` Paul Leder
2008-02-07 20:23           ` Dave Korn
2008-02-08  3:52             ` Paul Leder
  -- strict thread matches above, loose matches on Subject: below --
2008-07-15 14:26 Pedro Izecksohn
2008-07-15  8:27 Pedro Izecksohn
2008-07-15 13:48 ` Christopher Faylor
2008-07-15 14:27   ` Markus Hoenicka
2008-02-07 14:46 Paul Leder
2008-02-07 14:47 ` Eric Blake
2008-02-07 16:16   ` Paul Leder

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).