OSProcess stdErr issue on Windows
On Windows 7, trying to execute a non-existent program as follows... OSProcess command: 'notepadXX.exe' ...causes an MNU in ExternalWindowsOSProcess>>value. This is due to writing to stderr where "self initialStdErr" returns nil, seemingly due to ExternalWindowsOSProcess missing the #initialize and #setDefaults of E xternalUnixOSProcess. Now I understand that stderr is problematic in general on Windows. The following statements... OSProcess thisOSProcess stdErr nextPutAll: 'test'. FileStream stderr nextPutAll: 'test'. ...both work fine on OSX, but fail on Windows with the error "FileWriteError: File stderr is closed" The result is the same on both Pharo 4 and Squeak 4.5. (Squeak also brings up a bottom message bar saying... "# To disable: F2 -> 'debug options' -> 'show console on errors' WARNING: Manufactured file handle detected!") Pharo has a workaround for the general issue by creating a disk file named 'stderr' as follows... FileStream class >> standardIOStreamNamed: moniker forWrite: forWrite self flag: #todo. "This is an ugly hack, while waiting for a real fix for windows. There several problems with this approach, but it allow us to run tests, etc." Smalltalk os isWin32 ifTrue: [ [ ^ MultiByteFileStream forceNewFileNamed: moniker asString ] on: CannotDeleteFileException do: [ "HACK: if the image is opened a second time windows barks about the already opened locked file" ^ MultiByteFileStream forceNewFileNamed: moniker asString, '_', (Random new nextInt: SmallInteger maxVal) asString ]]. So to address the MNU for OSProcess? 1. wrap the "self initialStdErr" with an #ifNil: check 2. Squeak adopt the Pharo workaround, then lean on that to define #initialize and #setDefaults for ExternalWindowsOSProcess 3. real fix for stderr (outside of OSProcess?) 4. wont fix 5. other? Note that this is not a burning issue for me. I am just cleaning out old issues that I logged in the Pharo bug tracker. If the answer if (4.) I'll just close the issue [1]. For both Squeak and Pharo, I loaded ConfigurationOfOSProcess-ThierryGoubier.33 from... MCHttpRepository location: 'http://smalltalkhub.com/mc/Pharo/MetaRepoForPharo40/main' (Perhaps someone with access can copy that to the main repo) cheers -ben [1] https://pharo.fogbugz.com/default.asp?11615
Thanks Ben, On Sun, Jan 11, 2015 at 12:36:14PM +0800, Ben Coman wrote:
On Windows 7, trying to execute a non-existent program as follows... OSProcess command: 'notepadXX.exe'
...causes an MNU in ExternalWindowsOSProcess>>value. This is due to writing to stderr where "self initialStdErr" returns nil, seemingly due to ExternalWindowsOSProcess missing the #initialize and #setDefaults of E xternalUnixOSProcess.
I made the change to prevent this error, and committed it to the OSProcess repository.
Now I understand that stderr is problematic in general on Windows. The following statements... OSProcess thisOSProcess stdErr nextPutAll: 'test'. FileStream stderr nextPutAll: 'test'.
...both work fine on OSX, but fail on Windows with the error "FileWriteError: File stderr is closed" The result is the same on both Pharo 4 and Squeak 4.5. (Squeak also brings up a bottom message bar saying... "# To disable: F2 -> 'debug options' -> 'show console on errors' WARNING: Manufactured file handle detected!")
A word of explanation is in order here. There is a handle registry in the Windows support code for FilePlugin that was added specifically to prevent use of "manufactured" file handles. I think that the idea was enhance security, although in practice the only effect is to prevent OSProcess from attaching to pipes and stdio streams. A workaround would be to provide an external FilePlugin dll with the handle registry disabled.
Pharo has a workaround for the general issue by creating a disk file named 'stderr' as follows... FileStream class >> standardIOStreamNamed: moniker forWrite: forWrite self flag: #todo. "This is an ugly hack, while waiting for a real fix for windows. There several problems with this approach, but it allow us to run tests, etc." Smalltalk os isWin32 ifTrue: [ [ ^ MultiByteFileStream forceNewFileNamed: moniker asString ] on: CannotDeleteFileException do: [ "HACK: if the image is opened a second time windows barks about the already opened locked file" ^ MultiByteFileStream forceNewFileNamed: moniker asString, '_', (Random new nextInt: SmallInteger maxVal) asString ]].
So to address the MNU for OSProcess? 1. wrap the "self initialStdErr" with an #ifNil: check 2. Squeak adopt the Pharo workaround, then lean on that to define #initialize and #setDefaults for ExternalWindowsOSProcess 3. real fix for stderr (outside of OSProcess?) 4. wont fix 5. other?
Note that this is not a burning issue for me. I am just cleaning out old issues that I logged in the Pharo bug tracker. If the answer if (4.) I'll just close the issue [1].
I did #1, and hopefully that will take care of the issue.
For both Squeak and Pharo, I loaded ConfigurationOfOSProcess-ThierryGoubier.33 from... MCHttpRepository location: 'http://smalltalkhub.com/mc/Pharo/MetaRepoForPharo40/main' (Perhaps someone with access can copy that to the main repo)
I copied ConfigurationOfOSProcess-ThierryGoubier.33 to the OSProcess repository. An update to ConfigurationOfOSProcess will be needed to get the latest version (Thierry, can you do this?). For Squeak, no ConfigurationOfOSProcess is needed, just use the latest version (with SqueakMap, or currently it OSProcess-dtl.93 in the repo). Pharo should also use the latest version if possible, although the Metacello configurations are needed to make things work on various older Pharo versions. The versions for a current spec would be: OSProcess-Base-dtl.46 OSProcess-Unix-dtl.20 OSProcess-Win32-dtl.12 OSProcess-Mac-dtl.2 OSProcess-OS2-dtl.2 OSProcess-RiscOS-dtl.2 OSProcess-AIO-dtl.8 Tests-OSProcess-dtl.21
cheers -ben
Thanks a lot for reporting this! Dave
On Sun, Jan 11, 2015 at 02:42:01PM -0500, David T. Lewis wrote:
I copied ConfigurationOfOSProcess-ThierryGoubier.33 to the OSProcess repository. An update to ConfigurationOfOSProcess will be needed to get the latest version (Thierry, can you do this?).
For Squeak, no ConfigurationOfOSProcess is needed, just use the latest version (with SqueakMap, or currently it OSProcess-dtl.93 in the repo).
Pharo should also use the latest version if possible, although the Metacello configurations are needed to make things work on various older Pharo versions. The versions for a current spec would be:
OSProcess-Base-dtl.46 OSProcess-Unix-dtl.20 OSProcess-Win32-dtl.12 OSProcess-Mac-dtl.2 OSProcess-OS2-dtl.2 OSProcess-RiscOS-dtl.2 OSProcess-AIO-dtl.8 Tests-OSProcess-dtl.21
Oops, sorry. That should be OSProcess-Tests-dtl.12, not Tests-OSProcess-dtl.21. Dave
On Sun, Jan 11, 2015 at 03:07:59PM -0500, David T. Lewis wrote:
On Sun, Jan 11, 2015 at 02:42:01PM -0500, David T. Lewis wrote:
I copied ConfigurationOfOSProcess-ThierryGoubier.33 to the OSProcess repository. An update to ConfigurationOfOSProcess will be needed to get the latest version (Thierry, can you do this?).
For Squeak, no ConfigurationOfOSProcess is needed, just use the latest version (with SqueakMap, or currently it OSProcess-dtl.93 in the repo).
Pharo should also use the latest version if possible, although the Metacello configurations are needed to make things work on various older Pharo versions. The versions for a current spec would be:
OSProcess-Base-dtl.46 OSProcess-Unix-dtl.20 OSProcess-Win32-dtl.12 OSProcess-Mac-dtl.2 OSProcess-OS2-dtl.2 OSProcess-RiscOS-dtl.2 OSProcess-AIO-dtl.8 Tests-OSProcess-dtl.21
Oops, sorry. That should be OSProcess-Tests-dtl.12, not Tests-OSProcess-dtl.21.
Sorry to keep replying to myself, but I noticed some missing test updates from the main OSProcess package, so now it is OSProcess-Tests-dtl.13. Dave
Thanks Dave. I'll try it out this evening. cheers -ben On Mon, Jan 12, 2015 at 4:21 AM, David T. Lewis <lewis@mail.msen.com> wrote:
On Sun, Jan 11, 2015 at 03:07:59PM -0500, David T. Lewis wrote:
On Sun, Jan 11, 2015 at 02:42:01PM -0500, David T. Lewis wrote:
I copied ConfigurationOfOSProcess-ThierryGoubier.33 to the OSProcess repository. An update to ConfigurationOfOSProcess will be needed to get the latest version (Thierry, can you do this?).
For Squeak, no ConfigurationOfOSProcess is needed, just use the latest version (with SqueakMap, or currently it OSProcess-dtl.93 in the repo).
Pharo should also use the latest version if possible, although the Metacello configurations are needed to make things work on various
older
Pharo versions. The versions for a current spec would be:
OSProcess-Base-dtl.46 OSProcess-Unix-dtl.20 OSProcess-Win32-dtl.12 OSProcess-Mac-dtl.2 OSProcess-OS2-dtl.2 OSProcess-RiscOS-dtl.2 OSProcess-AIO-dtl.8 Tests-OSProcess-dtl.21
Oops, sorry. That should be OSProcess-Tests-dtl.12, not Tests-OSProcess-dtl.21.
Sorry to keep replying to myself, but I noticed some missing test updates from the main OSProcess package, so now it is OSProcess-Tests-dtl.13.
Dave
2015-01-11 20:42 GMT+01:00 David T. Lewis <lewis@mail.msen.com>:
Thanks Ben,
I copied ConfigurationOfOSProcess-ThierryGoubier.33 to the OSProcess repository. An update to ConfigurationOfOSProcess will be needed to get the latest version (Thierry, can you do this?).
Yes, I will. Thierry
For Squeak, no ConfigurationOfOSProcess is needed, just use the latest version (with SqueakMap, or currently it OSProcess-dtl.93 in the repo).
Pharo should also use the latest version if possible, although the Metacello configurations are needed to make things work on various older Pharo versions. The versions for a current spec would be:
OSProcess-Base-dtl.46 OSProcess-Unix-dtl.20 OSProcess-Win32-dtl.12 OSProcess-Mac-dtl.2 OSProcess-OS2-dtl.2 OSProcess-RiscOS-dtl.2 OSProcess-AIO-dtl.8 Tests-OSProcess-dtl.21
cheers -ben
Thanks a lot for reporting this!
Dave
On Mon, Jan 12, 2015 at 6:10 AM, Thierry Goubier <thierry.goubier@gmail.com> wrote:
2015-01-11 20:42 GMT+01:00 David T. Lewis <lewis@mail.msen.com>:
Thanks Ben,
I copied ConfigurationOfOSProcess-ThierryGoubier.33 to the OSProcess repository. An update to ConfigurationOfOSProcess will be needed to get the latest version.
Dave, Sorry for the delay getting back to this. I updated the Configuration and tested it loads okay on latest Pharo. You can copy... ConfigurationOfOSProcess-BenComan.36 from... MCHttpRepository location: 'http://smalltalkhub.com/mc/Pharo/MetaRepoForPharo40/main' user: '' password: '' thanks for the fix. cheers -ben
Thanks Ben, Thierry 2015-01-25 6:41 GMT+01:00 Ben Coman <btc@openinworld.com>:
On Mon, Jan 12, 2015 at 6:10 AM, Thierry Goubier < thierry.goubier@gmail.com> wrote:
2015-01-11 20:42 GMT+01:00 David T. Lewis <lewis@mail.msen.com>:
Thanks Ben,
I copied ConfigurationOfOSProcess-ThierryGoubier.33 to the OSProcess repository. An update to ConfigurationOfOSProcess will be needed to get the latest version.
Dave,
Sorry for the delay getting back to this. I updated the Configuration and tested it loads okay on latest Pharo. You can copy...
ConfigurationOfOSProcess-BenComan.36
from...
MCHttpRepository location: 'http://smalltalkhub.com/mc/Pharo/MetaRepoForPharo40/main' user: '' password: ''
thanks for the fix. cheers -ben
On Sun, Jan 25, 2015 at 01:41:01PM +0800, Ben Coman wrote:
On Mon, Jan 12, 2015 at 6:10 AM, Thierry Goubier <thierry.goubier@gmail.com> wrote:
2015-01-11 20:42 GMT+01:00 David T. Lewis <lewis@mail.msen.com>:
I copied ConfigurationOfOSProcess-ThierryGoubier.33 to the OSProcess repository. An update to ConfigurationOfOSProcess will be needed to get the latest version.
Sorry for the delay getting back to this. I updated the Configuration and tested it loads okay on latest Pharo. You can copy...
ConfigurationOfOSProcess-BenComan.36
Done. Thanks Ben! Dave
Hi Dave, Ben, I updated a bit the configuration of OSProcess and propagated it in the three meta repositories (squeaksource, MetaRepoForPharo30, MetaRepoForPharo40), but I also integrated a fix which is in the squeaksource repository (by dkh) which restricts OSProcess to 4.5.8 on Pharo2.x ? Thierry 2015-01-25 16:03 GMT+01:00 David T. Lewis <lewis@mail.msen.com>:
On Sun, Jan 25, 2015 at 01:41:01PM +0800, Ben Coman wrote:
On Mon, Jan 12, 2015 at 6:10 AM, Thierry Goubier < thierry.goubier@gmail.com> wrote:
2015-01-11 20:42 GMT+01:00 David T. Lewis <lewis@mail.msen.com>:
I copied ConfigurationOfOSProcess-ThierryGoubier.33 to the OSProcess repository. An update to ConfigurationOfOSProcess will be needed to get the latest version.
Sorry for the delay getting back to this. I updated the Configuration and tested it loads okay on latest Pharo. You can copy...
ConfigurationOfOSProcess-BenComan.36
Done.
Thanks Ben!
Dave
Oh, one more question: is there a need to bump the command shell version (currently 4.6.9) as well to get it to point to OSProcess 4.5.13? It's now pointing to 4.5.12. Thierry 2015-02-01 10:12 GMT+01:00 Thierry Goubier <thierry.goubier@gmail.com>:
Hi Dave, Ben,
I updated a bit the configuration of OSProcess and propagated it in the three meta repositories (squeaksource, MetaRepoForPharo30, MetaRepoForPharo40), but I also integrated a fix which is in the squeaksource repository (by dkh) which restricts OSProcess to 4.5.8 on Pharo2.x ?
Thierry
2015-01-25 16:03 GMT+01:00 David T. Lewis <lewis@mail.msen.com>:
On Sun, Jan 25, 2015 at 01:41:01PM +0800, Ben Coman wrote:
On Mon, Jan 12, 2015 at 6:10 AM, Thierry Goubier < thierry.goubier@gmail.com> wrote:
2015-01-11 20:42 GMT+01:00 David T. Lewis <lewis@mail.msen.com>:
I copied ConfigurationOfOSProcess-ThierryGoubier.33 to the OSProcess repository. An update to ConfigurationOfOSProcess will be needed to get the latest version.
Sorry for the delay getting back to this. I updated the Configuration and tested it loads okay on latest Pharo. You can copy...
ConfigurationOfOSProcess-BenComan.36
Done.
Thanks Ben!
Dave
Thanks Thierry. But I don't have an answer for you. You might notice in Pharo4MetaRepo it took me three goes to bump ConfigurationOfOSProcess from 4.5.12 to 4.5.13 - my first such modification of a Configuration. (btw, I tried using Versioneer but there was some error and I presumed (perhaps wrongly) that its existing Configuration format might not be compatible with Versioneer, so did it manually) cheers -ben On Sun, Feb 1, 2015 at 5:14 PM, Thierry Goubier <thierry.goubier@gmail.com> wrote:
Oh, one more question:
is there a need to bump the command shell version (currently 4.6.9) as well to get it to point to OSProcess 4.5.13? It's now pointing to 4.5.12.
Thierry
2015-02-01 10:12 GMT+01:00 Thierry Goubier <thierry.goubier@gmail.com>:
Hi Dave, Ben,
I updated a bit the configuration of OSProcess and propagated it in the three meta repositories (squeaksource, MetaRepoForPharo30, MetaRepoForPharo40), but I also integrated a fix which is in the squeaksource repository (by dkh) which restricts OSProcess to 4.5.8 on Pharo2.x ?
Thierry
2015-01-25 16:03 GMT+01:00 David T. Lewis <lewis@mail.msen.com>:
On Sun, Jan 25, 2015 at 01:41:01PM +0800, Ben Coman wrote:
On Mon, Jan 12, 2015 at 6:10 AM, Thierry Goubier < thierry.goubier@gmail.com> wrote:
2015-01-11 20:42 GMT+01:00 David T. Lewis <lewis@mail.msen.com>:
I copied ConfigurationOfOSProcess-ThierryGoubier.33 to the OSProcess repository. An update to ConfigurationOfOSProcess will be needed to get the latest version.
Sorry for the delay getting back to this. I updated the Configuration and tested it loads okay on latest Pharo. You can copy...
ConfigurationOfOSProcess-BenComan.36
Done.
Thanks Ben!
Dave
2015-02-01 11:02 GMT+01:00 Ben Coman <btc@openinworld.com>:
Thanks Thierry. But I don't have an answer for you. You might notice in Pharo4MetaRepo it took me three goes to bump ConfigurationOfOSProcess from 4.5.12 to 4.5.13 - my first such modification of a Configuration. (btw, I tried using Versioneer but there was some error and I presumed (perhaps wrongly) that its existing Configuration format might not be compatible with Versioneer, so did it manually)
No problem. So far, what I have is that trying to load 4.5.13 of OSProcess loads 4.6.9 of CommandShell as a dependency and 4.6.9 loads back 4.5.12 of OSProcess... I'll have to try updating ConfigurationOfCommandShell as well. Thierry
cheers -ben
On Sun, Feb 1, 2015 at 5:14 PM, Thierry Goubier <thierry.goubier@gmail.com
wrote:
Oh, one more question:
is there a need to bump the command shell version (currently 4.6.9) as well to get it to point to OSProcess 4.5.13? It's now pointing to 4.5.12.
Thierry
2015-02-01 10:12 GMT+01:00 Thierry Goubier <thierry.goubier@gmail.com>:
Hi Dave, Ben,
I updated a bit the configuration of OSProcess and propagated it in the three meta repositories (squeaksource, MetaRepoForPharo30, MetaRepoForPharo40), but I also integrated a fix which is in the squeaksource repository (by dkh) which restricts OSProcess to 4.5.8 on Pharo2.x ?
Thierry
2015-01-25 16:03 GMT+01:00 David T. Lewis <lewis@mail.msen.com>:
On Sun, Jan 25, 2015 at 01:41:01PM +0800, Ben Coman wrote:
On Mon, Jan 12, 2015 at 6:10 AM, Thierry Goubier < thierry.goubier@gmail.com> wrote:
2015-01-11 20:42 GMT+01:00 David T. Lewis <lewis@mail.msen.com>:
I copied ConfigurationOfOSProcess-ThierryGoubier.33 to the
OSProcess
repository. An update to ConfigurationOfOSProcess will be needed to get the latest version.
Sorry for the delay getting back to this. I updated the Configuration and tested it loads okay on latest Pharo. You can copy...
ConfigurationOfOSProcess-BenComan.36
Done.
Thanks Ben!
Dave
participants (3)
-
Ben Coman -
David T. Lewis -
Thierry Goubier