[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

ENV shows partial environment only

Eero Saynatkari

10/4/2006 10:58:00 PM

Hi!

It seems that Ruby is not picking up the complete environment
to be accessible through ENV--and I seem to recall this is by
design. Cursory poking-around in {hash,ruby,eval}.c did not
reveal anything particularly enlightening. Could someone shed
light on this if it indeed is done intentionally by Ruby and
not due to some strangeness in the C env functions?

An example session:

18:28:43 ruerue@yawn > ruby -v
ruby 1.8.5 (2006-08-25) [amd64-freebsd6]

18:28:51 ruerue@yawn > set | ruby -e 'p ARGF.readlines.map {|l|
l.split("=").first if l =~ /^[A-Z]/}.compact'

["BASH", "BASH_ARGC", "BASH_ARGV", "BASH_LINENO", "BASH_SOURCE",
"BASH_VERSINFO", "BASH_VERSION", "BLOCKSIZE", "COLUMNS", "DIRSTACK",
"DISPLAY", "EDITOR", "EUID", "FTP_PASSIVE_MODE", "GROUPS", "HISTFILE",
"HISTFILESIZE", "HISTSIZE", "HOME", "HOSTNAME", "HOSTTYPE", "IFS",
"LINES", "LOGNAME", "MACHTYPE", "MAIL", "MAILCHECK", "OPTERR", "OPTIND",
"OSTYPE", "PATH", "PIPESTATUS", "PPID", "PR_BROWN", "PR_CLEAR",
"PR_LTGREY", "PS1", "PS2", "PS4", "PWD", "RS_EMAIL", "RS_NAME", "SHELL",
"SHELLOPTS", "SHLVL", "TERM", "TERMCAP", "UID", "USER", "WINDOWID",
"XAUTHORITY", "XTERM_SHELL", "XTERM_VERSION"]

18:28:54 ruerue@yawn > ruby -e 'p ENV.keys'

["SHELL", "TERM", "WINDOWID", "XTERM_SHELL", "RS_NAME", "USER",
"TERMCAP", "FTP_PASSIVE_MODE", "PATH", "MAIL", "BLOCKSIZE", "PWD",
"EDITOR", "XTERM_VERSION", "HOME", "SHLVL", "LOGNAME", "RS_EMAIL",
"DISPLAY", "XAUTHORITY", "_"]
38 Answers

Logan Capaldo

10/4/2006 11:24:00 PM

0

On Thu, Oct 05, 2006 at 07:57:43AM +0900, Eero Saynatkari wrote:
> Hi!
>
> It seems that Ruby is not picking up the complete environment
> to be accessible through ENV--and I seem to recall this is by
> design. Cursory poking-around in {hash,ruby,eval}.c did not
> reveal anything particularly enlightening. Could someone shed
> light on this if it indeed is done intentionally by Ruby and
> not due to some strangeness in the C env functions?
>
> An example session:
>
> 18:28:43 ruerue@yawn > ruby -v
> ruby 1.8.5 (2006-08-25) [amd64-freebsd6]
>
> 18:28:51 ruerue@yawn > set | ruby -e 'p ARGF.readlines.map {|l|
> l.split("=").first if l =~ /^[A-Z]/}.compact'
>
> ["BASH", "BASH_ARGC", "BASH_ARGV", "BASH_LINENO", "BASH_SOURCE",
> "BASH_VERSINFO", "BASH_VERSION", "BLOCKSIZE", "COLUMNS", "DIRSTACK",
> "DISPLAY", "EDITOR", "EUID", "FTP_PASSIVE_MODE", "GROUPS", "HISTFILE",
> "HISTFILESIZE", "HISTSIZE", "HOME", "HOSTNAME", "HOSTTYPE", "IFS",
> "LINES", "LOGNAME", "MACHTYPE", "MAIL", "MAILCHECK", "OPTERR", "OPTIND",
> "OSTYPE", "PATH", "PIPESTATUS", "PPID", "PR_BROWN", "PR_CLEAR",
> "PR_LTGREY", "PS1", "PS2", "PS4", "PWD", "RS_EMAIL", "RS_NAME", "SHELL",
> "SHELLOPTS", "SHLVL", "TERM", "TERMCAP", "UID", "USER", "WINDOWID",
> "XAUTHORITY", "XTERM_SHELL", "XTERM_VERSION"]
>
> 18:28:54 ruerue@yawn > ruby -e 'p ENV.keys'
>
> ["SHELL", "TERM", "WINDOWID", "XTERM_SHELL", "RS_NAME", "USER",
> "TERMCAP", "FTP_PASSIVE_MODE", "PATH", "MAIL", "BLOCKSIZE", "PWD",
> "EDITOR", "XTERM_VERSION", "HOME", "SHLVL", "LOGNAME", "RS_EMAIL",
> "DISPLAY", "XAUTHORITY", "_"]

Are you sure all those variables are "exported"? (For instance, I
seriously doubt IFS is ever exported by a sane shell unless you
explicitly tell it to do so.)


Mike Dvorkin

10/4/2006 11:29:00 PM

0

Ruby's ENV hash contains environment variables as returned by 'env',
not 'set', i.e.:

# env
# ruby -e 'puts ENV.keys'

produce exact same lists.

Mike Dvorkin
http://www.rubyw...



On Oct 4, 2006, at 3:57 PM, Eero Saynatkari wrote:

> Hi!
>
> It seems that Ruby is not picking up the complete environment
> to be accessible through ENV--and I seem to recall this is by
> design. Cursory poking-around in {hash,ruby,eval}.c did not
> reveal anything particularly enlightening. Could someone shed
> light on this if it indeed is done intentionally by Ruby and
> not due to some strangeness in the C env functions?
>
> An example session:
>
> 18:28:43 ruerue@yawn > ruby -v
> ruby 1.8.5 (2006-08-25) [amd64-freebsd6]
>
> 18:28:51 ruerue@yawn > set | ruby -e 'p ARGF.readlines.map {|l|
> l.split("=").first if l =~ /^[A-Z]/}.compact'
>
> ["BASH", "BASH_ARGC", "BASH_ARGV", "BASH_LINENO", "BASH_SOURCE",
> "BASH_VERSINFO", "BASH_VERSION", "BLOCKSIZE", "COLUMNS", "DIRSTACK",
> "DISPLAY", "EDITOR", "EUID", "FTP_PASSIVE_MODE", "GROUPS", "HISTFILE",
> "HISTFILESIZE", "HISTSIZE", "HOME", "HOSTNAME", "HOSTTYPE", "IFS",
> "LINES", "LOGNAME", "MACHTYPE", "MAIL", "MAILCHECK", "OPTERR",
> "OPTIND",
> "OSTYPE", "PATH", "PIPESTATUS", "PPID", "PR_BROWN", "PR_CLEAR",
> "PR_LTGREY", "PS1", "PS2", "PS4", "PWD", "RS_EMAIL", "RS_NAME",
> "SHELL",
> "SHELLOPTS", "SHLVL", "TERM", "TERMCAP", "UID", "USER", "WINDOWID",
> "XAUTHORITY", "XTERM_SHELL", "XTERM_VERSION"]
>
> 18:28:54 ruerue@yawn > ruby -e 'p ENV.keys'
>
> ["SHELL", "TERM", "WINDOWID", "XTERM_SHELL", "RS_NAME", "USER",
> "TERMCAP", "FTP_PASSIVE_MODE", "PATH", "MAIL", "BLOCKSIZE", "PWD",
> "EDITOR", "XTERM_VERSION", "HOME", "SHLVL", "LOGNAME", "RS_EMAIL",
> "DISPLAY", "XAUTHORITY", "_"]


Ara.T.Howard

10/5/2006 5:22:00 AM

0

Jeff Schwab

10/5/2006 5:47:00 PM

0

ara.t.howard@noaa.gov wrote:
> On Thu, 5 Oct 2006, Eero Saynatkari wrote:
>
>> Hi!
>>
>> It seems that Ruby is not picking up the complete environment
>> to be accessible through ENV--and I seem to recall this is by
>> design. Cursory poking-around in {hash,ruby,eval}.c did not
>> reveal anything particularly enlightening. Could someone shed
>> light on this if it indeed is done intentionally by Ruby and
>> not due to some strangeness in the C env functions?
>>
>> An example session:
>>
>> 18:28:43 ruerue@yawn > ruby -v
>> ruby 1.8.5 (2006-08-25) [amd64-freebsd6]
>>
>> 18:28:51 ruerue@yawn > set | ruby -e 'p ARGF.readlines.map {|l|
>> l.split("=").first if l =~ /^[A-Z]/}.compact'
>>
>> ["BASH", "BASH_ARGC", "BASH_ARGV", "BASH_LINENO", "BASH_SOURCE",
>> "BASH_VERSINFO", "BASH_VERSION", "BLOCKSIZE", "COLUMNS", "DIRSTACK",
>> "DISPLAY", "EDITOR", "EUID", "FTP_PASSIVE_MODE", "GROUPS", "HISTFILE",
>> "HISTFILESIZE", "HISTSIZE", "HOME", "HOSTNAME", "HOSTTYPE", "IFS",
>> "LINES", "LOGNAME", "MACHTYPE", "MAIL", "MAILCHECK", "OPTERR", "OPTIND",
>> "OSTYPE", "PATH", "PIPESTATUS", "PPID", "PR_BROWN", "PR_CLEAR",
>> "PR_LTGREY", "PS1", "PS2", "PS4", "PWD", "RS_EMAIL", "RS_NAME", "SHELL",
>> "SHELLOPTS", "SHLVL", "TERM", "TERMCAP", "UID", "USER", "WINDOWID",
>> "XAUTHORITY", "XTERM_SHELL", "XTERM_VERSION"]
>>
>> 18:28:54 ruerue@yawn > ruby -e 'p ENV.keys'
>>
>> ["SHELL", "TERM", "WINDOWID", "XTERM_SHELL", "RS_NAME", "USER",
>> "TERMCAP", "FTP_PASSIVE_MODE", "PATH", "MAIL", "BLOCKSIZE", "PWD",
>> "EDITOR", "XTERM_VERSION", "HOME", "SHLVL", "LOGNAME", "RS_EMAIL",
>> "DISPLAY", "XAUTHORITY", "_"]
>
> it's been a while, but are you confusing shell vars with env vars? i think
> 'set' only reports the former:
>
> harp:~ > export FOO=ENV_BAR
>
> harp:~ > set FOO=SHELL_BAR
>
> harp:~ > sh
>
> harp:~ > echo $FOO
> ENV_BAR

You're using Bash/ksh syntax, but just so you know, the greater-than
symbol (>) is usually reserved to mean csh or tcsh. $ is the canonical
non-root bash prompt. Switching them up makes examples like this one a
little confusing, and can be frustrating when you have to use someone
else's machine for a second (e.g. to provide tech support through a VNC
session) and some commands fail for no apparent reason.

RichTravsky

9/25/2013 3:39:00 AM

0

Sancho Panza wrote:
>
> On 9/23/2013 12:53 AM, RichTravsky wrote:
> > AlleyCat wrote:
> >>
> >> On Tue, 17 Sep 2013 21:30:42 -0600, RichTravsky says...
> >>
> >>> You mean where only TWO bandaids
> >>> are needed?
> >>
> >> Yeah. Let me bang your head onto a sidewalk hard enough to cause this
> >> wound. Your pussy ass would pass out before I even grabbed you.
> >>
> >> http://i.i.com.com/cnwk.1d/i/tim/2012/05/17/zimmerman6_6...
> >
> > Odd, the doctors don't agree with you...
> >
> Actually it was a physician's assistant, who did not definitively
> conclude that Zimmerman did not suffer a concussion, according to her
> testimony.


http://www.cbsnews.com/8301-504083_162-57466450-504083/trayvon-martin-case-george-zimmermans-medical-reports...
A newly released medical report in the Trayvon Martin case details
injuries that George Zimmerman incurred on the night he fatally shot
the Florida teenager.

The report, from the day after the shooting, was posted online Monday
by Zimmerman's attorney as part of his effort to get the former
neighborhood watch volunteer released from jail while he awaits trial
in Martin's February shooting death.

The report states that the reason Zimmerman sought medical attention
the day after the shooting was to get a note from a doctor for work.
It indicates that he had two lacerations to the back of his head, one
two centimeters long, and one half a centimeter long. They did not
require stitches and he did not complain of any slurred speech or
dizziness.

Sancho Panza

9/25/2013 3:55:00 AM

0

On 9/24/2013 11:39 PM, RichTravsky wrote:
> Sancho Panza wrote:
>>
>> On 9/23/2013 12:53 AM, RichTravsky wrote:
>>> AlleyCat wrote:
>>>>
>>>> On Tue, 17 Sep 2013 21:30:42 -0600, RichTravsky says...
>>>>
>>>>> You mean where only TWO bandaids
>>>>> are needed?
>>>>
>>>> Yeah. Let me bang your head onto a sidewalk hard enough to cause this
>>>> wound. Your pussy ass would pass out before I even grabbed you.
>>>>
>>>> http://i.i.com.com/cnwk.1d/i/tim/2012/05/17/zimmerman6_6...
>>>
>>> Odd, the doctors don't agree with you...
>>>
>> Actually it was a physician's assistant, who did not definitively
>> conclude that Zimmerman did not suffer a concussion, according to her
>> testimony.
>
The following is a repeated posting that shows that the poster is not
paying attention to this thread. Folgate affirmed the banging of
Zimmerman's head on a hard surface.
If you do have some doctor's medical report that confirms some obscure
point you are trying to make, let's see it.

> http://www.cbsnews.com/8301-504083_162-57466450-504083/trayvon-martin-case-george-zimmermans-medical-reports...
> A newly released medical report in the Trayvon Martin case details
> injuries that George Zimmerman incurred on the night he fatally shot
> the Florida teenager.
>
> The report, from the day after the shooting, was posted online Monday
> by Zimmerman's attorney as part of his effort to get the former
> neighborhood watch volunteer released from jail while he awaits trial
> in Martin's February shooting death.
>
> The report states that the reason Zimmerman sought medical attention
> the day after the shooting was to get a note from a doctor for work.
> It indicates that he had two lacerations to the back of his head, one
> two centimeters long, and one half a centimeter long. They did not
> require stitches and he did not complain of any slurred speech or
> dizziness.
>

George Plimpton

9/25/2013 5:15:00 AM

0

On 9/24/2013 8:39 PM, RichTravsky wrote:
> Sancho Panza wrote:
>>
>> On 9/23/2013 12:53 AM, RichTravsky wrote:
>>> AlleyCat wrote:
>>>>
>>>> On Tue, 17 Sep 2013 21:30:42 -0600, RichTravsky says...
>>>>
>>>>> You mean where only TWO bandaids
>>>>> are needed?
>>>>
>>>> Yeah. Let me bang your head onto a sidewalk hard enough to cause this
>>>> wound. Your pussy ass would pass out before I even grabbed you.
>>>>
>>>> http://i.i.com.com/cnwk.1d/i/tim/2012/05/17/zimmerman6_6...
>>>
>>> Odd, the doctors don't agree with you...
>>>
>> Actually it was a physician's assistant, who did not definitively
>> conclude that Zimmerman did not suffer a concussion, according to her
>> testimony.
>
>
> http://www.cbsnews.com/8301-504083_162-57466450-504083/trayvon-martin-case-george-zimmermans-medical-reports...
> A newly released medical report in the Trayvon Martin case details
> injuries that George Zimmerman incurred on the night he fatally shot
> the Florida teenager.

Traycon was the aggressor. You know this and you have acknowledged it.

George Plimpton

10/2/2013 12:39:00 AM

0

On 10/1/2013 5:14 PM, GOP_Decline_and_Fall wrote:
> On Mon, 30 Sep 2013 22:16:53 -0700, George Plimpton <george@si.not>
> wrote:
>
>> On 9/30/2013 10:13 PM, GOP_Decline_and_Fall wrote:
>>> On Mon, 30 Sep 2013 21:59:00 -0700, George Plimpton <george@si.not>
>>> wrote:
>>>
>>>> On 9/30/2013 9:30 PM, GOP_Decline_and_Fall wrote:
>>>>> On Mon, 30 Sep 2013 20:59:38 -0700, George Plimpton <george@si.not>
>>>>> wrote:
>>>>>
>>>>>> On 9/30/2013 5:42 PM, GOP_Decline_and_Fall wrote:
>>>>>>> On Mon, 30 Sep 2013 08:11:05 -0400, Sancho Panza
>>>>>>> <otterpower@xhotmail.com> wrote:
>>>>>>>
>>>>>>>> On 9/25/2013 10:09 PM, GOP_Decline_and_Fall wrote:
>>>>>>>>> On Tue, 24 Sep 2013 23:54:41 -0400, Sancho Panza
>>>>>>>>> <otterpower@xhotmail.com> wrote:
>>>>>>>>>
>>>>>>>>>> On 9/24/2013 11:39 PM, RichTravsky wrote:
>>>>>>>>>>> Sancho Panza wrote:
>>>>>>>>>>>>
>>>>>>>>>>>> On 9/23/2013 12:53 AM, RichTravsky wrote:
>>>>>>>>>>>>> AlleyCat wrote:
>>>>>>>>>>>>>>
>>>>>>>>>>>>>> On Tue, 17 Sep 2013 21:30:42 -0600, RichTravsky says...
>>>>>>>>>>>>>>
>>>>>>>>>>>>>>> You mean where only TWO bandaids
>>>>>>>>>>>>>>> are needed?
>>>>>>>>>>>>>>
>>>>>>>>>>>>>> Yeah. Let me bang your head onto a sidewalk hard enough to cause this
>>>>>>>>>>>>>> wound. Your pussy ass would pass out before I even grabbed you.
>>>>>>>>>>>>>>
>>>>>>>>>>>>>> http://i.i.com.com/cnwk.1d/i/tim/2012/05/17/zimmerman6_6...
>>>>>>>>>>>>>
>>>>>>>>>>>>> Odd, the doctors don't agree with you...
>>>>>>>>>>>>>
>>>>>>>>>>>> Actually it was a physician's assistant, who did not definitively
>>>>>>>>>>>> conclude that Zimmerman did not suffer a concussion, according to her
>>>>>>>>>>>> testimony.
>>>>>>>>>>>
>>>>>>>>>> The following is a repeated posting that shows that the poster is not
>>>>>>>>>> paying attention to this thread. Folgate affirmed the banging of
>>>>>>>>>> Zimmerman's head on a hard surface.
>>>>>>>>>> If you do have some doctor's medical report that confirms some obscure
>>>>>>>>>> point you are trying to make, let's see it.
>>>>>>>>>
>>>>>>>>> Zimmerman made sure there was no medical report .
>>>>>>>>> He refused three times to allow a doctor to examine him.
>>>>>>>>
>>>>>>>> That must be why he went to his regular clinic the next day
>>>>>>>
>>>>>>> He went to get a sick note for work not to be treated for anything.
>>>>>>>
>>>>>>>> and why his regular P.A., who examined him, testified very clearly at the trial. Or
>>>>>>>> maybe you just never watched or checked.>>>>>>>
>>>>>>> Yes, she testified clearly that Zimmerman lied to her
>>>>>>
>>>>>> No.
>>>>>>
>>>>>>
>>>>>>> He didn't even have a headache and
>>>>>>
>>>>>> Prove it.
>>>>>
>>>>> What's to prove?
>>>>
>>>> Your claim.
>>>
>>> Not my claim,
>>
>> Your claim. "Yes, she testified clearly that Zimmerman lied to her"
>> That's your claim. Prove it.
>
> She testified that he told her the EMS diagnosed a broken nose.

You said she *testified* that Zimmerman lied to her. She did not.

You lied.

George Plimpton

10/2/2013 12:54:00 AM

0

On 9/30/2013 8:59 PM, GOP_Decline_and_Fall wrote:
> On Tue, 01 Oct 2013 03:25:06 GMT, benj <benj@iwaynet.net> wrote:
>
>> On Mon, 30 Sep 2013 17:42:59 -0700, GOP_Decline_and_Fall wrote:
>>
>>> Yes, she testified clearly that Zimmerman lied to her saying the EMS
>>> said he has a broken nose when they said no such thing and that she only
>>> had the story he told her.
>>>
>>> He didn't even have a headache and she thought he needed a psychiatrist
>>> not a doctor.
>>>
>>> There was nothing wrong with him,he had no blood in his nose He was
>>> perfectly normal and needed no treatment.
>>
>> GOPer your lie museum of liberal fantasy just keeps filling up!
>>
>> THIS is Zimmerman's nose.
>>
>> http://www.breitbart.com/Big-Government/2013/07/09/Neighbor-Zi...
>> Nose-was-Very-Disfigured-After-Run-In-with-Martin
>>
>> So THAT is what an insane liberal's idea of "nothing wrong" looks like?
>>
>> Now oddly you Libs have declared this photo of his father-in-law's nose
>> that George (the child murderer) supposedly "punched" and "broke" is what
>> a REAL punch in the nose looks like:
>>
>> http://i2.cdn.turner.com/dr/hln/www/release/sites/defa...
>> imagecache/textarticle_640/2013/09/09/zimmerman1.jpg
>>
>> So The first is what a "scratch" looks like and the second is what a
>> "punch in the nose" looks like. Is it any wonder that Sheila has no
>> credibility here? She is SO out of touch with ANY reality that even her
>> Prozac can't bring her back to reality enough to shoot up a post office...
>>
>> The purpose of propaganda is to first fool the propagandist!
>
> Breitbart notwithstanding,the PA testified that Zimmerman's nose was
> not deviated in the slightest when she saw him.

She did not testify that he did not have a broken nose.

GOP_Decline_and_Fall

10/2/2013 2:36:00 AM

0

On Wed, 02 Oct 2013 00:27:40 GMT, benj <benj@iwaynet.net> wrote:

>On Mon, 30 Sep 2013 20:59:23 -0700, GOP_Decline_and_Fall wrote:
>
>> Breitbart notwithstanding,the PA testified that Zimmerman's nose was not
>> deviated in the slightest when she saw him.
>
>You just saw the photo, Sheila. What is your theory? Was the photo photo-
>shopped? Yeah, that's got to be it! It's the big police conspiracy theory
>again! EVERYBODY in the case was lying! Even the prosecution witnesses!
>There are only two groups of people who know what went on. One of them is
>dead and all the other witnesses are lying with faked data. I wonder why
>nobody is interested in pursuing obstruction of justice charges?
>
>Now take a look at that Father-in-law's nose! Now THAT is some obvious
>and serious "deviation"! THAT is clearly what a "punch in the nose" does!
>
>Time for your meds again Sheila!

Yes a very sensational photo.

Yet, a hour later after the EMS wiped him off, there was no sign of
anything untoward and the police station video had to be enhanced to
even see the two small scratches he made such a fuss about.

The lack of any medical evidence is what it is and no amount of
touting a garish cell phone photo alters that which is why you are
reduced to flinging lames and insults.