Skip to content

[SR-11699] Calling closeFile() on standardInput Pipe before calling Process.run() aborts with EBADF on Linux #3377

Closed
@swift-ci

Description

@swift-ci
Previous ID SR-11699
Radar None
Original Reporter Kaiede (JIRA User)
Type Bug
Status Resolved
Resolution Done

Attachment: Download

Environment

First hit on Raspberry Pi w/Raspbian Buster - Swift 5.1.1 RELEASE

Official Swift Docker Container for Linux Also Reproduces It:

  • root@5b62e5c1ca9a:/home/PipeTest# swift --version

  • Swift version 5.1.1 (swift-5.1.1-RELEASE)

  • Target: x86_64-unknown-linux-gnu

Additional Detail from JIRA
Votes 0
Component/s Foundation
Labels Bug
Assignee @spevans
Priority Medium

md5: 6577ae0c207d9cfae623bb7c589a5e6e

relates to:

  • SR-10639 Connecting two Processes with Pipe crashes

Issue Description:

Repro Steps:

  • Unzip PipeTest.zip

  • cd into directory

  • run 'swift test'

Expected:

  • All 4 Tests Pass

Actual

  • testProcess_CrashOnLinux will crash on Linux with EBADF

  • Fatal error: POSIX command failed with error: 9 – EBADF: file /home/buildSwiftOnARM/swift-corelibs-foundation/Foundation/Process.swift, line 825

Compare testProcess_CrashOnLinux with testProcess_WorksOnLinux2. These are functionally the same test, but they close the file handle at different times. Apparently closing the handle before process.run() is called will cause the EBADF on Linux, but not macOS.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions