[Vm-dev] OSProcess chdir

David T. Lewis lewis at mail.msen.com
Fri May 25 19:04:42 UTC 2012

On Fri, May 25, 2012 at 11:33:17AM -0700, Sean P. DeNigris wrote:
> UnixOSProcessPlugin>>primitiveChdir
> ...
> 	(self chdir: path)
> 		ifTrue: [interpreterProxy pop: 2; push: interpreterProxy nilObject]
> 		ifFalse: [interpreterProxy pop: 2; pushInteger: errno].
> Shouldn't the conditional branches be reversed (or the test be "(self chdir:
> path) == 0" - however you would write that in Slang)? chdir returns 0 on
> success and -1 on error. In c, the above becomes:
> 	if (chdir(path))
> {...interpreterProxy->push(interpreterProxy->nilObject());}
> 	else {...interpreterProxy->pushInteger(errno);}
> So success takes the else branch and returns the irrelevant errno, which I
> guess is why I'm getting confusing error codes in Pharo 2.0 even though the
> chdir has taken effect.

Yes this is a bug.

> b.t.w. if the above is correct, how would I submit a patch (i.e. changes to
> the UnixOSProcessPlugin class)? 

Just a change set is usually the easiest thing, although in this case
the bug is already fixed in the sources (Damien Cassou spotted the same
thing recently).

The fixed version is OSProcessPlugin versionString 4.4.11 in
VMConstruction-Plugins-OSProcessPlugin-dtl.35.mcz on SqueakSource/OSProcessPlugin.
And Eliot picked up the fix for Cog in VMConstruction-Plugins-OSProcessPlugin.oscog-eem.35.mcz.


More information about the Vm-dev mailing list