Skip to content

RubySpec fixes for Windows#6357

Merged
headius merged 11 commits intojruby:masterfrom
headius:windows_spec_fixes
Sep 18, 2020
Merged

RubySpec fixes for Windows#6357
headius merged 11 commits intojruby:masterfrom
headius:windows_spec_fixes

Conversation

@headius
Copy link
Member

@headius headius commented Aug 14, 2020

This PR is a WIP to get specs running green on Windows.

The System.console + reflection method of getting the console
encoding is unreliable, since if stdio has been connected to a
pipe the System.console will be null, causing us to fall back on
an incorrect console encoding. This adds logic to first try the
sun.stdout.encoding property, which is populated using the same
Win32 GetConsoleCP function as the Console encoding. This property
if present should allow us to always get the proper encoding for
the console, regardless of whether stdio is a pipe or the actual
console.
NIO allows us to specify more options than the java.io APIs
(specifically FileInput/OutputStream and RandomAccessFile) which
makes more flags and combinations thereof work well when opening
files using JDK-only features.

Examples:

* The Windows FILE_SHARE_DELETE flag is provided via extended
  flags on Windows and can be supported using NIO file-open logic.
* Append mode for non-readable channels can be handled by NIO
  rather than us wrapping the file in a second channel. Note that
  read + write + append triggers an error in the NIO logic, so we
  must still wrap for that case.
* File truncation can be done during file open using NIO logic. We
  still fall back on a no-truncation version to handle pipes and
  fifos, which may duplicate some pre-check logic.
* Properly negotiate encoding of entries whereever returned.
* Add win32 logic for Dir.home with username (only returns a
  result for the login user).
* Unify some redundant entry-walking logic.
* Raise EEXIST for existing files and dirs in Dir.mkdir.

These fixes may help other platforms with unusual filesystem
encodings too.
@headius
Copy link
Member Author

headius commented Sep 17, 2020

The specs are now running to completion (for the "fast" subset, anyway) with around 150 failures and errors. The failures are largely in areas we expect: process launching, low-level IO operations, and a large number from win32ole which does not appear to boot properly for these specs.

I will merge what I have here since rake and mspec are working. Once #6340 lands we can revisit the failing specs and get a tagged run going.

@headius headius marked this pull request as ready for review September 17, 2020 23:21
@headius headius merged commit 76233df into jruby:master Sep 18, 2020
@headius headius deleted the windows_spec_fixes branch September 18, 2020 04:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant