ruby-core@ruby-lang.org archive (unofficial mirror)
 help / color / mirror / Atom feed
* [ruby-core:107765] [Ruby master Bug#18605] Fails to run on (newer) 32bit Windows with ucrt
@ 2022-03-03  7:31 lazka (Christoph Reiter)
  2022-04-01  7:52 ` [ruby-core:108151] " naruse (Yui NARUSE)
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: lazka (Christoph Reiter) @ 2022-03-03  7:31 UTC (permalink / raw)
  To: ruby-core

Issue #18605 has been reported by lazka (Christoph Reiter).

----------------------------------------
Bug #18605: Fails to run on (newer) 32bit Windows with ucrt
https://bugs.ruby-lang.org/issues/18605

* Author: lazka (Christoph Reiter)
* Status: Open
* Priority: Normal
* Backport: 2.6: UNKNOWN, 2.7: UNKNOWN, 3.0: UNKNOWN, 3.1: UNKNOWN
----------------------------------------
32bit ruby using ucrt has started to fail on newer Windows with "unexpected ucrtbase.dll" -> https://github.com/ruby/ruby/blob/3fb7d2cadc18472ec107b14234933b017a33c14d/win32/win32.c#L2591

The problem is that ruby depends on ucrt internals and those have apparently changed with newer versions.

See https://github.com/msys2/MINGW-packages/pull/10878 and https://github.com/msys2/MINGW-packages/issues/10896 for some background and a potential fix. But ideally ruby wouldn't depend on Windows internals like this.

thanks!



-- 
https://bugs.ruby-lang.org/

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [ruby-core:108151] [Ruby master Bug#18605] Fails to run on (newer) 32bit Windows with ucrt
  2022-03-03  7:31 [ruby-core:107765] [Ruby master Bug#18605] Fails to run on (newer) 32bit Windows with ucrt lazka (Christoph Reiter)
@ 2022-04-01  7:52 ` naruse (Yui NARUSE)
  2022-10-01 15:12 ` [ruby-core:110160] " ivall (ivall ivall)
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: naruse (Yui NARUSE) @ 2022-04-01  7:52 UTC (permalink / raw)
  To: ruby-core

Issue #18605 has been updated by naruse (Yui NARUSE).


Why Ruby depends to `_pioinfo` is
* to associate socket and fd: CRuby creates fd with dummy file handle and set socket to emulate Unix-like behavior
* to implement overlapped I/O for Windows 2000/XP
* to emulate fcntl(2)

If you know a better way to implement above use cases, we will migrate to that.

Thanks,

----------------------------------------
Bug #18605: Fails to run on (newer) 32bit Windows with ucrt
https://bugs.ruby-lang.org/issues/18605#change-97127

* Author: lazka (Christoph Reiter)
* Status: Open
* Priority: Normal
* Backport: 2.6: UNKNOWN, 2.7: UNKNOWN, 3.0: UNKNOWN, 3.1: UNKNOWN
----------------------------------------
32bit ruby using ucrt has started to fail on newer Windows with "unexpected ucrtbase.dll" -> https://github.com/ruby/ruby/blob/3fb7d2cadc18472ec107b14234933b017a33c14d/win32/win32.c#L2591

The problem is that ruby depends on ucrt internals and those have apparently changed with newer versions.

See https://github.com/msys2/MINGW-packages/pull/10878 and https://github.com/msys2/MINGW-packages/issues/10896 for some background and a potential fix. But ideally ruby wouldn't depend on Windows internals like this.

thanks!



-- 
https://bugs.ruby-lang.org/

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [ruby-core:110160] [Ruby master Bug#18605] Fails to run on (newer) 32bit Windows with ucrt
  2022-03-03  7:31 [ruby-core:107765] [Ruby master Bug#18605] Fails to run on (newer) 32bit Windows with ucrt lazka (Christoph Reiter)
  2022-04-01  7:52 ` [ruby-core:108151] " naruse (Yui NARUSE)
@ 2022-10-01 15:12 ` ivall (ivall ivall)
  2022-10-05 19:46 ` [ruby-core:110186] " MSP-Greg (Greg L)
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: ivall (ivall ivall) @ 2022-10-01 15:12 UTC (permalink / raw)
  To: ruby-core

Issue #18605 has been updated by ivall (ivall ivall).


I have same problem on Windows 11 25206, reinstalling Ruby didn't help.

----------------------------------------
Bug #18605: Fails to run on (newer) 32bit Windows with ucrt
https://bugs.ruby-lang.org/issues/18605#change-99417

* Author: lazka (Christoph Reiter)
* Status: Open
* Priority: Normal
* Backport: 2.6: UNKNOWN, 2.7: UNKNOWN, 3.0: UNKNOWN, 3.1: UNKNOWN
----------------------------------------
32bit ruby using ucrt has started to fail on newer Windows with "unexpected ucrtbase.dll" -> https://github.com/ruby/ruby/blob/3fb7d2cadc18472ec107b14234933b017a33c14d/win32/win32.c#L2591

The problem is that ruby depends on ucrt internals and those have apparently changed with newer versions.

See https://github.com/msys2/MINGW-packages/pull/10878 and https://github.com/msys2/MINGW-packages/issues/10896 for some background and a potential fix. But ideally ruby wouldn't depend on Windows internals like this.

thanks!



-- 
https://bugs.ruby-lang.org/

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [ruby-core:110186] [Ruby master Bug#18605] Fails to run on (newer) 32bit Windows with ucrt
  2022-03-03  7:31 [ruby-core:107765] [Ruby master Bug#18605] Fails to run on (newer) 32bit Windows with ucrt lazka (Christoph Reiter)
  2022-04-01  7:52 ` [ruby-core:108151] " naruse (Yui NARUSE)
  2022-10-01 15:12 ` [ruby-core:110160] " ivall (ivall ivall)
@ 2022-10-05 19:46 ` MSP-Greg (Greg L)
  2022-10-17 17:49 ` [ruby-core:110371] " lazka (Christoph Reiter)
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: MSP-Greg (Greg L) @ 2022-10-05 19:46 UTC (permalink / raw)
  To: ruby-core

Issue #18605 has been updated by MSP-Greg (Greg L).


An issue exists elsewhere, see https://github.com/oneclick/rubyinstaller2/issues/308#issuecomment-1268851455.  I'm just the messenger, I don't have the knowledge needed for this issue.

Quoting the response from ArminG-MSFT:

Hello this is Armin from Microsoft. We encountered the same or at least a very similar issue in our internal compatibility testing. What seems to be the issue is that Ruby is relying on undocumented/unsupported behaviour. It is trying to retrieve a pointer to an internal variable __pioinfo inside urtbase.dll. That itself is not supported, but from our debugging and looking at the code in win32.c it looks like it is doing it by walking back from the ret assembly instruction in _isatty(). But this assumes the ret instruction will be the last instruction in that _isatty().

The issue is that certain optimizations can move function code beyond a ret instruction, so the common/typical instruction path is shorter. And new optimizations we applied to recent ucrtbase.dll builds did exactly that in _isatty(). So it looks like Ruby is now looking at the wrong location and no longer finding __pioinfo.

Short term we'll be rolling out a fix that for this function that undoes this optimization, which should fix this specific error for the many Ruby users in the wild. But it would be great if Ruby can be fixed to not use undocumented behaviour, or perhaps at least be more robust in its function traversal. Note though that at some point we may break it in some way that is not so easily fixed.

The offending code is in win32\win32.c function set_pioinfo_extra.

Feel free to correct me though if our understanding is incorrect.

----------------------------------------
Bug #18605: Fails to run on (newer) 32bit Windows with ucrt
https://bugs.ruby-lang.org/issues/18605#change-99460

* Author: lazka (Christoph Reiter)
* Status: Open
* Priority: Normal
* Backport: 2.6: UNKNOWN, 2.7: UNKNOWN, 3.0: UNKNOWN, 3.1: UNKNOWN
----------------------------------------
32bit ruby using ucrt has started to fail on newer Windows with "unexpected ucrtbase.dll" -> https://github.com/ruby/ruby/blob/3fb7d2cadc18472ec107b14234933b017a33c14d/win32/win32.c#L2591

The problem is that ruby depends on ucrt internals and those have apparently changed with newer versions.

See https://github.com/msys2/MINGW-packages/pull/10878 and https://github.com/msys2/MINGW-packages/issues/10896 for some background and a potential fix. But ideally ruby wouldn't depend on Windows internals like this.

thanks!



-- 
https://bugs.ruby-lang.org/

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [ruby-core:110371] [Ruby master Bug#18605] Fails to run on (newer) 32bit Windows with ucrt
  2022-03-03  7:31 [ruby-core:107765] [Ruby master Bug#18605] Fails to run on (newer) 32bit Windows with ucrt lazka (Christoph Reiter)
                   ` (2 preceding siblings ...)
  2022-10-05 19:46 ` [ruby-core:110186] " MSP-Greg (Greg L)
@ 2022-10-17 17:49 ` lazka (Christoph Reiter)
  2022-12-14 20:15 ` [ruby-core:111291] " larskanis (Lars Kanis)
  2023-06-23 23:58 ` [ruby-core:114015] " awhitenose (Alex Whitenose) via ruby-core
  5 siblings, 0 replies; 7+ messages in thread
From: lazka (Christoph Reiter) @ 2022-10-17 17:49 UTC (permalink / raw)
  To: ruby-core

Issue #18605 has been updated by lazka (Christoph Reiter).


This (unsurprisingly) also breaks ruby on arm64 and is blocking our arm64 porting effort: https://github.com/msys2/MINGW-packages/pull/13115

----------------------------------------
Bug #18605: Fails to run on (newer) 32bit Windows with ucrt
https://bugs.ruby-lang.org/issues/18605#change-99665

* Author: lazka (Christoph Reiter)
* Status: Open
* Priority: Normal
* Backport: 2.6: UNKNOWN, 2.7: UNKNOWN, 3.0: UNKNOWN, 3.1: UNKNOWN
----------------------------------------
32bit ruby using ucrt has started to fail on newer Windows with "unexpected ucrtbase.dll" -> https://github.com/ruby/ruby/blob/3fb7d2cadc18472ec107b14234933b017a33c14d/win32/win32.c#L2591

The problem is that ruby depends on ucrt internals and those have apparently changed with newer versions.

See https://github.com/msys2/MINGW-packages/pull/10878 and https://github.com/msys2/MINGW-packages/issues/10896 for some background and a potential fix. But ideally ruby wouldn't depend on Windows internals like this.

thanks!



-- 
https://bugs.ruby-lang.org/

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [ruby-core:111291] [Ruby master Bug#18605] Fails to run on (newer) 32bit Windows with ucrt
  2022-03-03  7:31 [ruby-core:107765] [Ruby master Bug#18605] Fails to run on (newer) 32bit Windows with ucrt lazka (Christoph Reiter)
                   ` (3 preceding siblings ...)
  2022-10-17 17:49 ` [ruby-core:110371] " lazka (Christoph Reiter)
@ 2022-12-14 20:15 ` larskanis (Lars Kanis)
  2023-06-23 23:58 ` [ruby-core:114015] " awhitenose (Alex Whitenose) via ruby-core
  5 siblings, 0 replies; 7+ messages in thread
From: larskanis (Lars Kanis) @ 2022-12-14 20:15 UTC (permalink / raw)
  To: ruby-core

Issue #18605 has been updated by larskanis (Lars Kanis).


Thanks all for sharing the details!

I started a branch to replace the UCRT/MSVCRT pioinfo here: https://github.com/ruby/ruby/compare/master...larskanis:ruby:pioinfo?expand=1

My rough plan is to first replace pioinfo with a ruby-internal mapping between FD and HANDLE/SOCKET. This makes it necessary to replace all uses of FD and change it to native WINAPI functions using HANDLE/SOCKET. Fortunately many functions are already based on the native WINAPI. Among others it currently fails at the many process spawn variations and the text file CRLF conversions are not yet implemented. Also the few uses of FILE based libc functions still have to be replaced.

After pioinfo is replaced and the implementation is passing all tests again, I would like to replace FD completely by HANDLE/SOCKET including in `IO#fileno` and `IO.new`. This is because the FD is then just an internal number, with no external meaning. But HANDLE/SOCKET is the native Windows handle to access resources and to process events.

Even if this sounds pretty simple, there are a lot of tricky challenges on the way and I'm sure @naruse had very good reasons to build the pioinfo hack.


----------------------------------------
Bug #18605: Fails to run on (newer) 32bit Windows with ucrt
https://bugs.ruby-lang.org/issues/18605#change-100647

* Author: lazka (Christoph Reiter)
* Status: Open
* Priority: Normal
* Backport: 2.6: UNKNOWN, 2.7: UNKNOWN, 3.0: UNKNOWN, 3.1: UNKNOWN
----------------------------------------
32bit ruby using ucrt has started to fail on newer Windows with "unexpected ucrtbase.dll" -> https://github.com/ruby/ruby/blob/3fb7d2cadc18472ec107b14234933b017a33c14d/win32/win32.c#L2591

The problem is that ruby depends on ucrt internals and those have apparently changed with newer versions.

See https://github.com/msys2/MINGW-packages/pull/10878 and https://github.com/msys2/MINGW-packages/issues/10896 for some background and a potential fix. But ideally ruby wouldn't depend on Windows internals like this.

thanks!



-- 
https://bugs.ruby-lang.org/
 ______________________________________________
 ruby-core mailing list -- ruby-core@ml.ruby-lang.org
 To unsubscribe send an email to ruby-core-leave@ml.ruby-lang.org
 ruby-core info -- https://ml.ruby-lang.org/mailman3/postorius/lists/ruby-core.ml.ruby-lang.org/

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [ruby-core:114015] [Ruby master Bug#18605] Fails to run on (newer) 32bit Windows with ucrt
  2022-03-03  7:31 [ruby-core:107765] [Ruby master Bug#18605] Fails to run on (newer) 32bit Windows with ucrt lazka (Christoph Reiter)
                   ` (4 preceding siblings ...)
  2022-12-14 20:15 ` [ruby-core:111291] " larskanis (Lars Kanis)
@ 2023-06-23 23:58 ` awhitenose (Alex Whitenose) via ruby-core
  5 siblings, 0 replies; 7+ messages in thread
From: awhitenose (Alex Whitenose) via ruby-core @ 2023-06-23 23:58 UTC (permalink / raw)
  To: ruby-core; +Cc: awhitenose (Alex Whitenose)

Issue #18605 has been updated by awhitenose (Alex Whitenose).


I have created a simple fix which helped to run 32-bit Ruby 2.6.x up to 3.2.x on Windows 11 without getting 'unexpected ucrtbase.dll' anymore. 

Available here: https://github.com/oneclick/rubyinstaller2/issues/308#issuecomment-1605125295

64-bit is unaffected. But it obviously does not make any changes or help for ARM builds. 

----------------------------------------
Bug #18605: Fails to run on (newer) 32bit Windows with ucrt
https://bugs.ruby-lang.org/issues/18605#change-103677

* Author: lazka (Christoph Reiter)
* Status: Open
* Priority: Normal
* Backport: 2.6: UNKNOWN, 2.7: UNKNOWN, 3.0: UNKNOWN, 3.1: UNKNOWN
----------------------------------------
32bit ruby using ucrt has started to fail on newer Windows with "unexpected ucrtbase.dll" -> https://github.com/ruby/ruby/blob/3fb7d2cadc18472ec107b14234933b017a33c14d/win32/win32.c#L2591

The problem is that ruby depends on ucrt internals and those have apparently changed with newer versions.

See https://github.com/msys2/MINGW-packages/pull/10878 and https://github.com/msys2/MINGW-packages/issues/10896 for some background and a potential fix. But ideally ruby wouldn't depend on Windows internals like this.

thanks!



-- 
https://bugs.ruby-lang.org/
 ______________________________________________
 ruby-core mailing list -- ruby-core@ml.ruby-lang.org
 To unsubscribe send an email to ruby-core-leave@ml.ruby-lang.org
 ruby-core info -- https://ml.ruby-lang.org/mailman3/postorius/lists/ruby-core.ml.ruby-lang.org/

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2023-06-23 23:58 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-03-03  7:31 [ruby-core:107765] [Ruby master Bug#18605] Fails to run on (newer) 32bit Windows with ucrt lazka (Christoph Reiter)
2022-04-01  7:52 ` [ruby-core:108151] " naruse (Yui NARUSE)
2022-10-01 15:12 ` [ruby-core:110160] " ivall (ivall ivall)
2022-10-05 19:46 ` [ruby-core:110186] " MSP-Greg (Greg L)
2022-10-17 17:49 ` [ruby-core:110371] " lazka (Christoph Reiter)
2022-12-14 20:15 ` [ruby-core:111291] " larskanis (Lars Kanis)
2023-06-23 23:58 ` [ruby-core:114015] " awhitenose (Alex Whitenose) via ruby-core

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).