A FogBugz case was opened by Ben Coman.
Case ID: 11569
Title: World > System > System Reporter Win32 Environment Variables
Status: Work Needed
Category: Bug
Project: OS and OSProcess
Area: Misc
Priority: 5 - Fix If Time
Milestone: Later
Assigned To: Everyone
URL:
https://pharo.fogbugz.com/default.asp?11569On Windows 7, World > System > System Reporter > OS Environment
produces an error... KeyNotFound: key '' not found in WIn32Environment.
The first symptom is that 'env keys' in...
SystemReporter >> reportOSEnvironment: aStream
| env |
self header: 'Operating System Environment' on: aStream.
env := [Smalltalk os environment] on: Error do: [^self].
self halt.
env keys asSortedCollection do: [:name |
aStream nextPutAll: name; nextPut: $=; nextPutAll: (env at: name); cr]
returns an empty string as the first element (see attached snapshot) for which '(env at: name)' fails.
The root cause seems to be in
Win32Environment>>keysAndValuesDo:
"Under windows the environemtn variables are a single big String."
| environmentStrings nexString |
self halt.
environmentStrings := self environmentStrings.
[
nexString := environmentStrings readString.
nexString ifEmpty: [ ^ self ].
self
keysAndValuesDo: aBlock
withAssociationString: nexString.
environmentStrings := NBExternalAddress value: (environmentStrings value + nexString size + 1)
] repeat.
where the first value taken by nexString is '=::=::\'
and since Win32Environment>>keysAndValuesDo:withAssociationString:
splits on the equal sign, the key ends up being ''.
The following fixes it....
Win32Environment>>keysAndValuesDo:
"Under windows the environemtn variables are a single big String."
"Lines starting with an equal sign are invalid per
http://stackoverflow.com/questions/10431689/what-are-these-strange-environment-variables"
| environmentStrings nexString |
environmentStrings := self environmentStrings.
[ nexString := environmentStrings readString.
nexString ifEmpty: [ ^ self ].
(nexString first = $=) ifFalse:
[ self
keysAndValuesDo: aBlock
withAssociationString: nexString.
].
environmentStrings := NBExternalAddress value: (environmentStrings value + nexString size + 1)
] repeat.
You are subscribed to this case. If you do not want to receive automatic notifications in the future, unsubscribe (
https://pharo.fogbugz.com/default.asp?pre=preUnsubscribe&pg=pgEditBug&command=view&ixBug=11569) from this case.
_______________________________________________
Pharo-bugtracker mailing list
[hidden email]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-bugtracker