Skip to content

[4.2] SR-7608: Pipe() crashes when the underlying system call fails. #1893

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Feb 11, 2019

Conversation

spevans
Copy link
Contributor

@spevans spevans commented Feb 11, 2019

  • Pipe does not have a failable or throwable initializer but currently
    calls fatalError() for all errors returned from pipe().

  • If pipe() returns EMFILE or ENFILE then set the fileDescriptor
    to -1 for both .fileHandleForReading and .fileHandleForWriting.
    For all other errors call fatalError().

  • TestFileHandle.swift: Remove duplicate test_pipe().

  • TestPipe.swift: Add extra test to try and exhaust the process's pipes.

  • Test the file descriptor is valid and open for certain methods
    and properties to match Darwin.

(cherry picked from commit 870d425)

NSPipe: make fileHandleFor{Reading,Writing} mutable

In Objective-C, the fileHandleFor{Reading,Writing} property is mutable even on a
const instance.  Change the property to read/write.

(cherry picked from commit 09cfc21)

compnerd and others added 2 commits February 10, 2019 08:36
In Objective-C, the fileHandleFor{Reading,Writing} property is mutable even on a
const instance.  Change the property to read/write.

(cherry picked from commit 09cfc21)
- Pipe does not have a failable or throwable initializer but currently
  calls fatalError() for all errors returned from pipe().

- If pipe() returns EMFILE or ENFILE then set the fileDescriptor
  to -1 for both .fileHandleForReading and .fileHandleForWriting.
  For all other errors call fatalError().

- TestFileHandle.swift: Remove duplicate test_pipe().

- TestPipe.swift: Add extra test to try and exhaust the process's pipes.

- Test the file descriptor is valid and open for certain methods
  and properties to match Darwin.

(cherry picked from commit 870d425)
@spevans
Copy link
Contributor Author

spevans commented Feb 11, 2019

@swift-ci test 4.2

@spevans spevans requested review from kevints and weissi February 11, 2019 13:18
Copy link
Contributor

@weissi weissi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thank you!

@weissi weissi merged commit e691868 into swiftlang:swift-4.2-branch Feb 11, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants