[OpenSmalltalk/opensmalltalk-vm] Add accurate check for console stdio + add associated primitive (#254)

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
56 messages Options
123
Reply | Threaded
Open this post in threaded view
|

[OpenSmalltalk/opensmalltalk-vm] Add accurate check for console stdio + add associated primitive (#254)

David T Lewis
 

Related to pharo-project/pharo#694


You can view, comment on, or merge this pull request online at:

  https://github.com/OpenSmalltalk/opensmalltalk-vm/pull/254

Commit Summary

  • First Version
  • Improve Win API compatibility
  • Use the primitive in the main function
  • code ordering
  • move function to Win32Main + add stubs for other plateforms for the primitive implementation
  • remove useless imports

File Changes

Patch Links:


You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub, or mute the thread.

<script type="application/json" data-scope="inboxmarkup">{"api_version":"1.0","publisher":{"api_key":"05dde50f1d1a384dd78767c55493e4bb","name":"GitHub"},"entity":{"external_key":"github/OpenSmalltalk/opensmalltalk-vm","title":"OpenSmalltalk/opensmalltalk-vm","subtitle":"GitHub repository","main_image_url":"https://cloud.githubusercontent.com/assets/143418/17495839/a5054eac-5d88-11e6-95fc-7290892c7bb5.png","avatar_image_url":"https://cloud.githubusercontent.com/assets/143418/15842166/7c72db34-2c0b-11e6-9aed-b52498112777.png","action":{"name":"Open in GitHub","url":"https://github.com/OpenSmalltalk/opensmalltalk-vm"}},"updates":{"snippets":[{"icon":"DESCRIPTION","message":"Add accurate check for console stdio + add associated primitive (#254)"}],"action":{"name":"View Pull Request","url":"https://github.com/OpenSmalltalk/opensmalltalk-vm/pull/254"}}}</script>
Reply | Threaded
Open this post in threaded view
|

Re: [OpenSmalltalk/opensmalltalk-vm] Add accurate check for console stdio + add associated primitive (#254)

David T Lewis
 

@VincentBlondeau pushed 1 commit.

  • e76c9f5 Primitive Returns a bool instead of a int


You are receiving this because you are subscribed to this thread.
View it on GitHub or mute the thread.

<script type="application/json" data-scope="inboxmarkup">{"api_version":"1.0","publisher":{"api_key":"05dde50f1d1a384dd78767c55493e4bb","name":"GitHub"},"entity":{"external_key":"github/OpenSmalltalk/opensmalltalk-vm","title":"OpenSmalltalk/opensmalltalk-vm","subtitle":"GitHub repository","main_image_url":"https://cloud.githubusercontent.com/assets/143418/17495839/a5054eac-5d88-11e6-95fc-7290892c7bb5.png","avatar_image_url":"https://cloud.githubusercontent.com/assets/143418/15842166/7c72db34-2c0b-11e6-9aed-b52498112777.png","action":{"name":"Open in GitHub","url":"https://github.com/OpenSmalltalk/opensmalltalk-vm"}},"updates":{"snippets":[{"icon":"PERSON","message":"@VincentBlondeau pushed 1 commit in #254"}],"action":{"name":"View Pull Request","url":"https://github.com/OpenSmalltalk/opensmalltalk-vm/pull/254/files/2d26199e90e89cf5f153a558c0ff19eb99504181..e76c9f5ad3df06e7a3d3b1e152182b0ce978e3da"}}}</script>
Reply | Threaded
Open this post in threaded view
|

Re: [OpenSmalltalk/opensmalltalk-vm] Add accurate check for console stdio + add associated primitive (#254)

David T Lewis
In reply to this post by David T Lewis
 

Hi Vincent, in isStdioDescriptorATTY at line 898 there is no guard to check if pGetFileInformationByHandleEx has already been fetched. The code needs to be something like

static pfnGetFileInformationByHandleEx pGetFileInformationByHandleEx = NULL;

if (! pGetFileInformationByHandleEx) {
	pGetFileInformationByHandleEx = (pfnGetFileInformationByHandleEx)
		GetProcAddress(GetModuleHandle(TEXT("kernel32.dll")),
					"GetFileInformationByHandleEx");
	if (pGetFileInformationByHandleEx == NULL)  return -2;
}


You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub, or mute the thread.

<script type="application/json" data-scope="inboxmarkup">{"api_version":"1.0","publisher":{"api_key":"05dde50f1d1a384dd78767c55493e4bb","name":"GitHub"},"entity":{"external_key":"github/OpenSmalltalk/opensmalltalk-vm","title":"OpenSmalltalk/opensmalltalk-vm","subtitle":"GitHub repository","main_image_url":"https://cloud.githubusercontent.com/assets/143418/17495839/a5054eac-5d88-11e6-95fc-7290892c7bb5.png","avatar_image_url":"https://cloud.githubusercontent.com/assets/143418/15842166/7c72db34-2c0b-11e6-9aed-b52498112777.png","action":{"name":"Open in GitHub","url":"https://github.com/OpenSmalltalk/opensmalltalk-vm"}},"updates":{"snippets":[{"icon":"PERSON","message":"@eliotmiranda in #254: Hi Vincent, in isStdioDescriptorATTY at line 898 there is no guard to check if pGetFileInformationByHandleEx has already been fetched. The code needs to be something like\r\n\r\n\tstatic pfnGetFileInformationByHandleEx pGetFileInformationByHandleEx = NULL;\r\n\r\n\tif (! pGetFileInformationByHandleEx) {\r\n\t\tpGetFileInformationByHandleEx = (pfnGetFileInformationByHandleEx)\r\n \t\t\tGetProcAddress(GetModuleHandle(TEXT(\"kernel32.dll\")),\r\n\t\t\t\t\t\t\"GetFileInformationByHandleEx\");\r\n\t\tif (pGetFileInformationByHandleEx == NULL) return -2;\r\n\t}"}],"action":{"name":"View Pull Request","url":"https://github.com/OpenSmalltalk/opensmalltalk-vm/pull/254#issuecomment-383789148"}}}</script>
Reply | Threaded
Open this post in threaded view
|

Re: [OpenSmalltalk/opensmalltalk-vm] Add accurate check for console stdio + add associated primitive (#254)

David T Lewis
In reply to this post by David T Lewis
 

Also, in platforms/Cross/plugins/FilePlugin/sqFilePluginBasicPrims.c, the comment "//There is always an TTY to write into for Unix and Mac" (and hence the implementation) is wrong. It should be something like

sqInt sqStdioDescriptorIsATTY(void) {
return isatty(fileno(stdin));
}


You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub, or mute the thread.

<script type="application/json" data-scope="inboxmarkup">{"api_version":"1.0","publisher":{"api_key":"05dde50f1d1a384dd78767c55493e4bb","name":"GitHub"},"entity":{"external_key":"github/OpenSmalltalk/opensmalltalk-vm","title":"OpenSmalltalk/opensmalltalk-vm","subtitle":"GitHub repository","main_image_url":"https://cloud.githubusercontent.com/assets/143418/17495839/a5054eac-5d88-11e6-95fc-7290892c7bb5.png","avatar_image_url":"https://cloud.githubusercontent.com/assets/143418/15842166/7c72db34-2c0b-11e6-9aed-b52498112777.png","action":{"name":"Open in GitHub","url":"https://github.com/OpenSmalltalk/opensmalltalk-vm"}},"updates":{"snippets":[{"icon":"PERSON","message":"@eliotmiranda in #254: Also, in platforms/Cross/plugins/FilePlugin/sqFilePluginBasicPrims.c, the comment \"//There is always an TTY to write into for Unix and Mac\" (and hence the implementation) is wrong. It should be something like\r\n\r\nsqInt sqStdioDescriptorIsATTY(void) {\r\n return isatty(fileno(stdin));\r\n }"}],"action":{"name":"View Pull Request","url":"https://github.com/OpenSmalltalk/opensmalltalk-vm/pull/254#issuecomment-383790127"}}}</script>
Reply | Threaded
Open this post in threaded view
|

Re: [OpenSmalltalk/opensmalltalk-vm] Add accurate check for console stdio + add associated primitive (#254)

David T Lewis
In reply to this post by David T Lewis
 

Thanks Eliot for the piece of advice! I am not an expert in C yet ;)

I made the changes but I was wondering why it is needed to set a guard: the line before just set the pGetFileInformationByHandleEx to NULL.


You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub, or mute the thread.

<script type="application/json" data-scope="inboxmarkup">{"api_version":"1.0","publisher":{"api_key":"05dde50f1d1a384dd78767c55493e4bb","name":"GitHub"},"entity":{"external_key":"github/OpenSmalltalk/opensmalltalk-vm","title":"OpenSmalltalk/opensmalltalk-vm","subtitle":"GitHub repository","main_image_url":"https://cloud.githubusercontent.com/assets/143418/17495839/a5054eac-5d88-11e6-95fc-7290892c7bb5.png","avatar_image_url":"https://cloud.githubusercontent.com/assets/143418/15842166/7c72db34-2c0b-11e6-9aed-b52498112777.png","action":{"name":"Open in GitHub","url":"https://github.com/OpenSmalltalk/opensmalltalk-vm"}},"updates":{"snippets":[{"icon":"PERSON","message":"@VincentBlondeau in #254: Thanks Eliot for the piece of advice! I am not an expert in C yet ;)\r\n\r\nI made the changes but I was wondering why it is needed to set a guard: the line before just set the pGetFileInformationByHandleEx to NULL."}],"action":{"name":"View Pull Request","url":"https://github.com/OpenSmalltalk/opensmalltalk-vm/pull/254#issuecomment-383791517"}}}</script>
Reply | Threaded
Open this post in threaded view
|

Re: [OpenSmalltalk/opensmalltalk-vm] Add accurate check for console stdio + add associated primitive (#254)

David T Lewis
In reply to this post by David T Lewis
 

@VincentBlondeau pushed 1 commit.

  • a3cf816 Add Guard for pGetFileInformationByHandleEx + clean real estate + bug


You are receiving this because you are subscribed to this thread.
View it on GitHub or mute the thread.

<script type="application/json" data-scope="inboxmarkup">{"api_version":"1.0","publisher":{"api_key":"05dde50f1d1a384dd78767c55493e4bb","name":"GitHub"},"entity":{"external_key":"github/OpenSmalltalk/opensmalltalk-vm","title":"OpenSmalltalk/opensmalltalk-vm","subtitle":"GitHub repository","main_image_url":"https://cloud.githubusercontent.com/assets/143418/17495839/a5054eac-5d88-11e6-95fc-7290892c7bb5.png","avatar_image_url":"https://cloud.githubusercontent.com/assets/143418/15842166/7c72db34-2c0b-11e6-9aed-b52498112777.png","action":{"name":"Open in GitHub","url":"https://github.com/OpenSmalltalk/opensmalltalk-vm"}},"updates":{"snippets":[{"icon":"PERSON","message":"@VincentBlondeau pushed 1 commit in #254"}],"action":{"name":"View Pull Request","url":"https://github.com/OpenSmalltalk/opensmalltalk-vm/pull/254/files/e76c9f5ad3df06e7a3d3b1e152182b0ce978e3da..a3cf81626698287cae65c8b0dfaf08b6dffd9a8c"}}}</script>
Reply | Threaded
Open this post in threaded view
|

Re: [OpenSmalltalk/opensmalltalk-vm] Add accurate check for console stdio + add associated primitive (#254)

David T Lewis
In reply to this post by David T Lewis
 

Hi Vincent,

Just based on a quick visual inspection of the code:

  • It looks like on Unix sqStdioDescriptorIsATTY() checks stdin, while on Windows it checks stdout, which is a bit inconsistent and they can be redirected independently anyway. Why not pass an argument allowing the user to specify which file to check (0, 1, 2)?
  • We'll want to modify sqFileStdioHandlesInto() in sqWin32FilePrims.c to use the new check (instead of GetConsoleMode()).
  • Actually, since the result is always stored in the SQFile structure for the stdio streams, the primitive could just return the cached value rather than determining it every time.
  • sqFileAtEnd() on Windows just assumes that stdin is never at EOF if it is a terminal. I don't know how EOF is signalled in a terminal on Windows (Ctrl-D?), but we could also improve this (although maybe this can be a separate PR).

Thanks!
Alistair


You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub, or mute the thread.

<script type="application/json" data-scope="inboxmarkup">{"api_version":"1.0","publisher":{"api_key":"05dde50f1d1a384dd78767c55493e4bb","name":"GitHub"},"entity":{"external_key":"github/OpenSmalltalk/opensmalltalk-vm","title":"OpenSmalltalk/opensmalltalk-vm","subtitle":"GitHub repository","main_image_url":"https://cloud.githubusercontent.com/assets/143418/17495839/a5054eac-5d88-11e6-95fc-7290892c7bb5.png","avatar_image_url":"https://cloud.githubusercontent.com/assets/143418/15842166/7c72db34-2c0b-11e6-9aed-b52498112777.png","action":{"name":"Open in GitHub","url":"https://github.com/OpenSmalltalk/opensmalltalk-vm"}},"updates":{"snippets":[{"icon":"PERSON","message":"@akgrant43 in #254: Hi Vincent,\r\n\r\nJust based on a quick visual inspection of the code:\r\n\r\n- It looks like on Unix sqStdioDescriptorIsATTY() checks stdin, while on Windows it checks stdout, which is a bit inconsistent and they can be redirected independently anyway. Why not pass an argument allowing the user to specify which file to check (0, 1, 2)?\r\n- We'll want to modify sqFileStdioHandlesInto() in sqWin32FilePrims.c to use the new check (instead of GetConsoleMode()).\r\n- Actually, since the result is always stored in the SQFile structure for the stdio streams, the primitive could just return the cached value rather than determining it every time.\r\n- sqFileAtEnd() on Windows just assumes that stdin is never at EOF if it is a terminal. I don't know how EOF is signalled in a terminal on Windows (Ctrl-D?), but we could also improve this (although maybe this can be a separate PR).\r\n\r\nThanks!\r\nAlistair\r\n"}],"action":{"name":"View Pull Request","url":"https://github.com/OpenSmalltalk/opensmalltalk-vm/pull/254#issuecomment-383808814"}}}</script>
Reply | Threaded
Open this post in threaded view
|

Re: [OpenSmalltalk/opensmalltalk-vm] Add accurate check for console stdio + add associated primitive (#254)

timrowledge
 


> On 23-04-2018, at 10:34 PM, akgrant43 <[hidden email]> wrote:
>
> • Actually, since the result is always stored in the SQFile structure for the stdio streams, the primitive could just return the cached value rather than determining it every time.

Unless it can change from external commands?


tim
--
tim Rowledge; [hidden email]; http://www.rowledge.org/tim
Florida: more red in the face


Reply | Threaded
Open this post in threaded view
|

Re: [OpenSmalltalk/opensmalltalk-vm] Add accurate check for console stdio + add associated primitive (#254)

alistairgrant
 
Hi Tim,

On 24 April 2018 at 18:25, tim Rowledge <[hidden email]> wrote:
>
>
>
>> On 23-04-2018, at 10:34 PM, akgrant43 <[hidden email]> wrote:
>>
>>       • Actually, since the result is always stored in the SQFile structure for the stdio streams, the primitive could just return the cached value rather than determining it every time.
>
> Unless it can change from external commands?

I'm not aware of any way this can be done, but also don't claim any
particular expertise (for a long time the VM has assumed that it
doesn't change).

If there is a way to change the stdio stream the correct approach is
to ensure that the SQFile structure is updated appropriately, so it
will still be OK to answer the cached value.

Cheers,
Alistair
Reply | Threaded
Open this post in threaded view
|

Re: [OpenSmalltalk/opensmalltalk-vm] Add accurate check for console stdio + add associated primitive (#254)

timrowledge
 


> On 24-04-2018, at 9:34 AM, Alistair Grant <[hidden email]> wrote:
>
>
> Hi Tim,
>
> On 24 April 2018 at 18:25, tim Rowledge <[hidden email]> wrote:
>>
>>
>>
>>> On 23-04-2018, at 10:34 PM, akgrant43 <[hidden email]> wrote:
>>>
>>>      â€¢ Actually, since the result is always stored in the SQFile structure for the stdio streams, the primitive could just return the cached value rather than determining it every time.
>>
>> Unless it can change from external commands?
>
> I'm not aware of any way this can be done, but also don't claim any
> particular expertise (for a long time the VM has assumed that it
> doesn't change).

Likewise with the not knowing. I tend to the paranoid when it comes to outside resources. Can a file descriptor/stream be changed ? Betting against it being possible on any of the platforms we use is probably a poor idea to be honest.

>
> If there is a way to change the stdio stream the correct approach is
> to ensure that the SQFile structure is updated appropriately, so it
> will still be OK to answer the cached value.

If it were possible to change the status from outside the image and there were some sort of notifier from the OS we'd be ok. Otherwise it's often smart to treat it as a volatile variable. It's like testing that a file exists and is writable and relying upon that staying true over a long period- usually ok but definitely not safe.


tim
--
tim Rowledge; [hidden email]; http://www.rowledge.org/tim
Implementation is the sincerest form of flattery.


Reply | Threaded
Open this post in threaded view
|

Re: [OpenSmalltalk/opensmalltalk-vm] Add accurate check for console stdio + add associated primitive (#254)

David T Lewis
In reply to this post by David T Lewis
 

@VincentBlondeau pushed 2 commits.

  • cf60cec Add fd as parameter for sqStdioDescriptorIsATTY
  • 88546ed get rid of getConsoleMode in sqFileStdioHandlesInto + fix bug on powershell


You are receiving this because you are subscribed to this thread.
View it on GitHub or mute the thread.

<script type="application/json" data-scope="inboxmarkup">{"api_version":"1.0","publisher":{"api_key":"05dde50f1d1a384dd78767c55493e4bb","name":"GitHub"},"entity":{"external_key":"github/OpenSmalltalk/opensmalltalk-vm","title":"OpenSmalltalk/opensmalltalk-vm","subtitle":"GitHub repository","main_image_url":"https://cloud.githubusercontent.com/assets/143418/17495839/a5054eac-5d88-11e6-95fc-7290892c7bb5.png","avatar_image_url":"https://cloud.githubusercontent.com/assets/143418/15842166/7c72db34-2c0b-11e6-9aed-b52498112777.png","action":{"name":"Open in GitHub","url":"https://github.com/OpenSmalltalk/opensmalltalk-vm"}},"updates":{"snippets":[{"icon":"PERSON","message":"@VincentBlondeau pushed 2 commits in #254"}],"action":{"name":"View Pull Request","url":"https://github.com/OpenSmalltalk/opensmalltalk-vm/pull/254/files/a3cf81626698287cae65c8b0dfaf08b6dffd9a8c..88546ed1d5a4723b5d6348ec59a117451cd81a54"}}}</script>
Reply | Threaded
Open this post in threaded view
|

Re: [OpenSmalltalk/opensmalltalk-vm] Add accurate check for console stdio + add associated primitive (#254)

David T Lewis
In reply to this post by David T Lewis
 

Closed #254.


You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub, or mute the thread.

<script type="application/json" data-scope="inboxmarkup">{"api_version":"1.0","publisher":{"api_key":"05dde50f1d1a384dd78767c55493e4bb","name":"GitHub"},"entity":{"external_key":"github/OpenSmalltalk/opensmalltalk-vm","title":"OpenSmalltalk/opensmalltalk-vm","subtitle":"GitHub repository","main_image_url":"https://cloud.githubusercontent.com/assets/143418/17495839/a5054eac-5d88-11e6-95fc-7290892c7bb5.png","avatar_image_url":"https://cloud.githubusercontent.com/assets/143418/15842166/7c72db34-2c0b-11e6-9aed-b52498112777.png","action":{"name":"Open in GitHub","url":"https://github.com/OpenSmalltalk/opensmalltalk-vm"}},"updates":{"snippets":[{"icon":"DESCRIPTION","message":"Closed #254."}],"action":{"name":"View Pull Request","url":"https://github.com/OpenSmalltalk/opensmalltalk-vm/pull/254#event-1592789916"}}}</script>
Reply | Threaded
Open this post in threaded view
|

Re: [OpenSmalltalk/opensmalltalk-vm] Add accurate check for console stdio + add associated primitive (#254)

David T Lewis
In reply to this post by David T Lewis
 

Reopened #254.


You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub, or mute the thread.

<script type="application/json" data-scope="inboxmarkup">{"api_version":"1.0","publisher":{"api_key":"05dde50f1d1a384dd78767c55493e4bb","name":"GitHub"},"entity":{"external_key":"github/OpenSmalltalk/opensmalltalk-vm","title":"OpenSmalltalk/opensmalltalk-vm","subtitle":"GitHub repository","main_image_url":"https://cloud.githubusercontent.com/assets/143418/17495839/a5054eac-5d88-11e6-95fc-7290892c7bb5.png","avatar_image_url":"https://cloud.githubusercontent.com/assets/143418/15842166/7c72db34-2c0b-11e6-9aed-b52498112777.png","action":{"name":"Open in GitHub","url":"https://github.com/OpenSmalltalk/opensmalltalk-vm"}},"updates":{"snippets":[{"icon":"DESCRIPTION","message":"Reopened #254."}],"action":{"name":"View Pull Request","url":"https://github.com/OpenSmalltalk/opensmalltalk-vm/pull/254#event-1592791559"}}}</script>
Reply | Threaded
Open this post in threaded view
|

Re: [OpenSmalltalk/opensmalltalk-vm] Add accurate check for console stdio + add associated primitive (#254)

David T Lewis
In reply to this post by David T Lewis
 

Hi Vincent, shouldn't all the
files[0].isStdioStream = sqIsFileDescriptorATTY(0);
occurrences in platforms/win32/plugins/FilePlugin/sqWin32FilePrims.c: sqFileStdioHandlesInto read either
files[0].isStdioStream = sqIsFileDescriptorATTY(STD_INPUT_HANDLE);
or
files[0].isStdioStream = sqIsFileDescriptorATTY(files[0].file);
? Since sqIsFileDescriptorATTY could a HANDLE right? And then you could get rid of the
h = (HANDLE)_get_osfhandle(fdNum);
call in sqIsFileDescriptorATTY


You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub, or mute the thread.

<script type="application/json" data-scope="inboxmarkup">{"api_version":"1.0","publisher":{"api_key":"05dde50f1d1a384dd78767c55493e4bb","name":"GitHub"},"entity":{"external_key":"github/OpenSmalltalk/opensmalltalk-vm","title":"OpenSmalltalk/opensmalltalk-vm","subtitle":"GitHub repository","main_image_url":"https://cloud.githubusercontent.com/assets/143418/17495839/a5054eac-5d88-11e6-95fc-7290892c7bb5.png","avatar_image_url":"https://cloud.githubusercontent.com/assets/143418/15842166/7c72db34-2c0b-11e6-9aed-b52498112777.png","action":{"name":"Open in GitHub","url":"https://github.com/OpenSmalltalk/opensmalltalk-vm"}},"updates":{"snippets":[{"icon":"PERSON","message":"@eliotmiranda in #254: Hi Vincent, shouldn't all the\r\n files[0].isStdioStream = sqIsFileDescriptorATTY(0);\r\noccurrences in platforms/win32/plugins/FilePlugin/sqWin32FilePrims.c: sqFileStdioHandlesInto read either\r\n files[0].isStdioStream = sqIsFileDescriptorATTY(STD_INPUT_HANDLE);\r\nor\r\n files[0].isStdioStream = sqIsFileDescriptorATTY(files[0].file);\r\n? Since sqIsFileDescriptorATTY could a HANDLE right? And then you could get rid of the \r\n h = (HANDLE)_get_osfhandle(fdNum);\r\ncall in sqIsFileDescriptorATTY"}],"action":{"name":"View Pull Request","url":"https://github.com/OpenSmalltalk/opensmalltalk-vm/pull/254#issuecomment-384105237"}}}</script>
Reply | Threaded
Open this post in threaded view
|

Re: [OpenSmalltalk/opensmalltalk-vm] Add accurate check for console stdio + add associated primitive (#254)

David T Lewis
In reply to this post by David T Lewis
 

The exposed primitive sqIsFileDescriptorATTY should not receive an HANDLE because one needs to call sqIsFileDescriptorATTY to know if an handle is available. But I can change sqWin32FilePrims.c:isFileDescriptorATTY to take an HANDLE as argument instead of a String


You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub, or mute the thread.

<script type="application/json" data-scope="inboxmarkup">{"api_version":"1.0","publisher":{"api_key":"05dde50f1d1a384dd78767c55493e4bb","name":"GitHub"},"entity":{"external_key":"github/OpenSmalltalk/opensmalltalk-vm","title":"OpenSmalltalk/opensmalltalk-vm","subtitle":"GitHub repository","main_image_url":"https://cloud.githubusercontent.com/assets/143418/17495839/a5054eac-5d88-11e6-95fc-7290892c7bb5.png","avatar_image_url":"https://cloud.githubusercontent.com/assets/143418/15842166/7c72db34-2c0b-11e6-9aed-b52498112777.png","action":{"name":"Open in GitHub","url":"https://github.com/OpenSmalltalk/opensmalltalk-vm"}},"updates":{"snippets":[{"icon":"PERSON","message":"@VincentBlondeau in #254: The exposed primitive sqIsFileDescriptorATTY should not receive an HANDLE because one needs to call sqIsFileDescriptorATTY to know if an handle is available. But I can change sqWin32FilePrims.c:isFileDescriptorATTY to take an HANDLE as argument instead of a String"}],"action":{"name":"View Pull Request","url":"https://github.com/OpenSmalltalk/opensmalltalk-vm/pull/254#issuecomment-384108935"}}}</script>
Reply | Threaded
Open this post in threaded view
|

Re: [OpenSmalltalk/opensmalltalk-vm] Add accurate check for console stdio + add associated primitive (#254)

David T Lewis
In reply to this post by David T Lewis
 

@VincentBlondeau pushed 1 commit.

  • 7ce2e5e Change isFileDescriptorATTY(int fdNum) to isFileDescriptorATTY(HANDLE fdHandle) (and the other functions that goes with it)


You are receiving this because you are subscribed to this thread.
View it on GitHub or mute the thread.

<script type="application/json" data-scope="inboxmarkup">{"api_version":"1.0","publisher":{"api_key":"05dde50f1d1a384dd78767c55493e4bb","name":"GitHub"},"entity":{"external_key":"github/OpenSmalltalk/opensmalltalk-vm","title":"OpenSmalltalk/opensmalltalk-vm","subtitle":"GitHub repository","main_image_url":"https://cloud.githubusercontent.com/assets/143418/17495839/a5054eac-5d88-11e6-95fc-7290892c7bb5.png","avatar_image_url":"https://cloud.githubusercontent.com/assets/143418/15842166/7c72db34-2c0b-11e6-9aed-b52498112777.png","action":{"name":"Open in GitHub","url":"https://github.com/OpenSmalltalk/opensmalltalk-vm"}},"updates":{"snippets":[{"icon":"PERSON","message":"@VincentBlondeau pushed 1 commit in #254"}],"action":{"name":"View Pull Request","url":"https://github.com/OpenSmalltalk/opensmalltalk-vm/pull/254/files/88546ed1d5a4723b5d6348ec59a117451cd81a54..7ce2e5ece3c0761de0752543d1869504b09855f8"}}}</script>
Reply | Threaded
Open this post in threaded view
|

Re: [OpenSmalltalk/opensmalltalk-vm] Add accurate check for console stdio + add associated primitive (#254)

David T Lewis
In reply to this post by David T Lewis
 

@VincentBlondeau pushed 1 commit.

  • 702a540 rename isFileDescriptorATTY to isFileHandleATTY


You are receiving this because you are subscribed to this thread.
View it on GitHub or mute the thread.

<script type="application/json" data-scope="inboxmarkup">{"api_version":"1.0","publisher":{"api_key":"05dde50f1d1a384dd78767c55493e4bb","name":"GitHub"},"entity":{"external_key":"github/OpenSmalltalk/opensmalltalk-vm","title":"OpenSmalltalk/opensmalltalk-vm","subtitle":"GitHub repository","main_image_url":"https://cloud.githubusercontent.com/assets/143418/17495839/a5054eac-5d88-11e6-95fc-7290892c7bb5.png","avatar_image_url":"https://cloud.githubusercontent.com/assets/143418/15842166/7c72db34-2c0b-11e6-9aed-b52498112777.png","action":{"name":"Open in GitHub","url":"https://github.com/OpenSmalltalk/opensmalltalk-vm"}},"updates":{"snippets":[{"icon":"PERSON","message":"@VincentBlondeau pushed 1 commit in #254"}],"action":{"name":"View Pull Request","url":"https://github.com/OpenSmalltalk/opensmalltalk-vm/pull/254/files/7ce2e5ece3c0761de0752543d1869504b09855f8..702a540b7ae4f8c3f57db3e968dbd1f67c101b3b"}}}</script>
Reply | Threaded
Open this post in threaded view
|

Re: [OpenSmalltalk/opensmalltalk-vm] Add accurate check for console stdio + add associated primitive (#254)

David T Lewis
In reply to this post by David T Lewis
 

Hi Vincent,

After checking out and building VincentBlondeau:addStdoutIsConsolePrimitive I get:

~/pharo7/pharo-snap/pharo-vm/opensmalltalk-vm/build.win32x86/pharo.cog.spur/builddbg/vm
$ gdb PharoConsole.exe
GNU gdb (GDB) (Cygwin 7.10.1-1) 7.10.1
Copyright (C) 2015 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "i686-pc-cygwin".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
<http://www.gnu.org/software/gdb/documentation/>.
For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from PharoConsole.exe...done.
(gdb) run --version
Starting program: /home/alistair/pharo7/pharo-snap/pharo-vm/opensmalltalk-vm/build.win32x86/pharo.cog.spur/builddbg/vm/PharoConsole.exe --                                               version
[New Thread 6252.0x16b0]
[New Thread 6252.0x1114]
[New Thread 6252.0x1a68]
[New Thread 6252.0x1d10]

Program received signal SIGSEGV, Segmentation fault.
0x76e1299b in msvcrt!_fileno () from /cygdrive/c/WINDOWS/System32/msvcrt.dll
(gdb) bt
#0  0x76e1299b in msvcrt!_fileno () from /cygdrive/c/WINDOWS/System32/msvcrt.dll
#1  0x00b4b17b in ?? ()
#2  0x00b4b333 in ?? ()
#3  0x00b4c567 in ?? ()
#4  0x00c22a7d in ?? ()
#5  0x00a913e3 in ?? ()
#6  0x74fc9564 in KERNEL32!BaseThreadInitThunk () from /cygdrive/c/WINDOWS/System32/KERNEL32.DLL
#7  0x773529ac in ntdll!EtwProcessPrivateLoggerRequest () from /cygdrive/c/WINDOWS/SYSTEM32/ntdll.dll
#8  0x77352980 in ntdll!EtwProcessPrivateLoggerRequest () from /cygdrive/c/WINDOWS/SYSTEM32/ntdll.dll
#9  0x00000000 in ?? ()
(gdb)

Sorry, but I'm out of time for today. Hopefully I'll get to investigate a bit more over the coming days.

Cheers,
Alistair


You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub, or mute the thread.

<script type="application/json" data-scope="inboxmarkup">{"api_version":"1.0","publisher":{"api_key":"05dde50f1d1a384dd78767c55493e4bb","name":"GitHub"},"entity":{"external_key":"github/OpenSmalltalk/opensmalltalk-vm","title":"OpenSmalltalk/opensmalltalk-vm","subtitle":"GitHub repository","main_image_url":"https://cloud.githubusercontent.com/assets/143418/17495839/a5054eac-5d88-11e6-95fc-7290892c7bb5.png","avatar_image_url":"https://cloud.githubusercontent.com/assets/143418/15842166/7c72db34-2c0b-11e6-9aed-b52498112777.png","action":{"name":"Open in GitHub","url":"https://github.com/OpenSmalltalk/opensmalltalk-vm"}},"updates":{"snippets":[{"icon":"PERSON","message":"@akgrant43 in #254: Hi Vincent,\r\n\r\nAfter checking out and building VincentBlondeau:addStdoutIsConsolePrimitive I get:\r\n\r\n```\r\n~/pharo7/pharo-snap/pharo-vm/opensmalltalk-vm/build.win32x86/pharo.cog.spur/builddbg/vm\r\n$ gdb PharoConsole.exe\r\nGNU gdb (GDB) (Cygwin 7.10.1-1) 7.10.1\r\nCopyright (C) 2015 Free Software Foundation, Inc.\r\nLicense GPLv3+: GNU GPL version 3 or later \u003chttp://gnu.org/licenses/gpl.html\u003e\r\nThis is free software: you are free to change and redistribute it.\r\nThere is NO WARRANTY, to the extent permitted by law. Type \"show copying\"\r\nand \"show warranty\" for details.\r\nThis GDB was configured as \"i686-pc-cygwin\".\r\nType \"show configuration\" for configuration details.\r\nFor bug reporting instructions, please see:\r\n\u003chttp://www.gnu.org/software/gdb/bugs/\u003e.\r\nFind the GDB manual and other documentation resources online at:\r\n\u003chttp://www.gnu.org/software/gdb/documentation/\u003e.\r\nFor help, type \"help\".\r\nType \"apropos word\" to search for commands related to \"word\"...\r\nReading symbols from PharoConsole.exe...done.\r\n(gdb) run --version\r\nStarting program: /home/alistair/pharo7/pharo-snap/pharo-vm/opensmalltalk-vm/build.win32x86/pharo.cog.spur/builddbg/vm/PharoConsole.exe -- version\r\n[New Thread 6252.0x16b0]\r\n[New Thread 6252.0x1114]\r\n[New Thread 6252.0x1a68]\r\n[New Thread 6252.0x1d10]\r\n\r\nProgram received signal SIGSEGV, Segmentation fault.\r\n0x76e1299b in msvcrt!_fileno () from /cygdrive/c/WINDOWS/System32/msvcrt.dll\r\n(gdb) bt\r\n#0 0x76e1299b in msvcrt!_fileno () from /cygdrive/c/WINDOWS/System32/msvcrt.dll\r\n#1 0x00b4b17b in ?? ()\r\n#2 0x00b4b333 in ?? ()\r\n#3 0x00b4c567 in ?? ()\r\n#4 0x00c22a7d in ?? ()\r\n#5 0x00a913e3 in ?? ()\r\n#6 0x74fc9564 in KERNEL32!BaseThreadInitThunk () from /cygdrive/c/WINDOWS/System32/KERNEL32.DLL\r\n#7 0x773529ac in ntdll!EtwProcessPrivateLoggerRequest () from /cygdrive/c/WINDOWS/SYSTEM32/ntdll.dll\r\n#8 0x77352980 in ntdll!EtwProcessPrivateLoggerRequest () from /cygdrive/c/WINDOWS/SYSTEM32/ntdll.dll\r\n#9 0x00000000 in ?? ()\r\n(gdb)\r\n```\r\n\r\nSorry, but I'm out of time for today. Hopefully I'll get to investigate a bit more over the coming days.\r\n\r\nCheers,\r\nAlistair"}],"action":{"name":"View Pull Request","url":"https://github.com/OpenSmalltalk/opensmalltalk-vm/pull/254#issuecomment-384182750"}}}</script>
Reply | Threaded
Open this post in threaded view
|

Re: [OpenSmalltalk/opensmalltalk-vm] Add accurate check for console stdio + add associated primitive (#254)

David T Lewis
In reply to this post by David T Lewis
 

@VincentBlondeau pushed 1 commit.

  • f9e79db Use the right functions to deal with WINAPI HANDLEs + refactoring


You are receiving this because you are subscribed to this thread.
View it on GitHub or mute the thread.

<script type="application/json" data-scope="inboxmarkup">{"api_version":"1.0","publisher":{"api_key":"05dde50f1d1a384dd78767c55493e4bb","name":"GitHub"},"entity":{"external_key":"github/OpenSmalltalk/opensmalltalk-vm","title":"OpenSmalltalk/opensmalltalk-vm","subtitle":"GitHub repository","main_image_url":"https://cloud.githubusercontent.com/assets/143418/17495839/a5054eac-5d88-11e6-95fc-7290892c7bb5.png","avatar_image_url":"https://cloud.githubusercontent.com/assets/143418/15842166/7c72db34-2c0b-11e6-9aed-b52498112777.png","action":{"name":"Open in GitHub","url":"https://github.com/OpenSmalltalk/opensmalltalk-vm"}},"updates":{"snippets":[{"icon":"PERSON","message":"@VincentBlondeau pushed 1 commit in #254"}],"action":{"name":"View Pull Request","url":"https://github.com/OpenSmalltalk/opensmalltalk-vm/pull/254/files/702a540b7ae4f8c3f57db3e968dbd1f67c101b3b..f9e79db71d490bf6681fe1a5f337d1d52c379afc"}}}</script>
Reply | Threaded
Open this post in threaded view
|

Re: [OpenSmalltalk/opensmalltalk-vm] Add accurate check for console stdio + add associated primitive (#254)

David T Lewis
In reply to this post by David T Lewis
 

I was using the wrong function to convert the handle to a number. I found another solution that works, now, I hope it will be working


You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub, or mute the thread.

<script type="application/json" data-scope="inboxmarkup">{"api_version":"1.0","publisher":{"api_key":"05dde50f1d1a384dd78767c55493e4bb","name":"GitHub"},"entity":{"external_key":"github/OpenSmalltalk/opensmalltalk-vm","title":"OpenSmalltalk/opensmalltalk-vm","subtitle":"GitHub repository","main_image_url":"https://cloud.githubusercontent.com/assets/143418/17495839/a5054eac-5d88-11e6-95fc-7290892c7bb5.png","avatar_image_url":"https://cloud.githubusercontent.com/assets/143418/15842166/7c72db34-2c0b-11e6-9aed-b52498112777.png","action":{"name":"Open in GitHub","url":"https://github.com/OpenSmalltalk/opensmalltalk-vm"}},"updates":{"snippets":[{"icon":"PERSON","message":"@VincentBlondeau in #254: I was using the wrong function to convert the handle to a number. I found another solution that works, now, I hope it will be working"}],"action":{"name":"View Pull Request","url":"https://github.com/OpenSmalltalk/opensmalltalk-vm/pull/254#issuecomment-384369945"}}}</script>
123