Skip to content

File.open w/ File::RDWR should write \r\n but gets should read as \n after rewind on windows #3742

Description

@enebo

Environment

Note: duplicated issue from #3738. This is broken differently than 1.7's version of this bug so I made a new issue to track it on 9k.

Broken on 9.0.5.0.

Expected Behavior

For the following script:

file = "temptemp"

File.open(file, "w") {}
File.open(file, File::RDWR) do |f|
  f.puts("writing")  # writes "writing\r\n"
  f.flush            # force to disk
  gets               # do not continue until you can verify it was written right
  f.rewind           # backup
  p f.gets           # read it but it should be "writing\n"
end
File.unlink(file)

The comments dictate how it should behave.

Actual Behavior

On JRuby 9.0.5.0 it wil write "writing\n" instead of "writing\r\n" but it will read "writing\n".

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions