Skip to content
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

[SR-10639] Connecting two Processes with Pipe crashes #3349

Closed
nikstar opened this issue May 8, 2019 · 2 comments
Closed

[SR-10639] Connecting two Processes with Pipe crashes #3349

nikstar opened this issue May 8, 2019 · 2 comments
Assignees

Comments

@nikstar
Copy link

nikstar commented May 8, 2019

Previous ID SR-10639
Radar None
Original Reporter @nikstar
Type Bug
Status Resolved
Resolution Done
Environment

Ubuntu 18.04; Swift 5.0.1 release, same on swift-DEVELOPMENT-SNAPSHOT-2019-05-07-a-ubuntu18.04

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

md5: 1ad90002f690ee22118f79102bc6ecde

relates to:

  • SR-11699 Calling closeFile() on standardInput Pipe before calling Process.run() aborts with EBADF on Linux

Issue Description:

Following code crashes on Linux:

import Foundation 

let ls = Process() 
ls.executableURL = URL(fileURLWithPath: "/bin/ls")
let cat = Process()
cat.executableURL = URL(fileURLWithPath: "/bin/cat")

let pipe = Pipe() 
ls.standardOutput = pipe
cat.standardInput = pipe

try! ls.run()
try! cat.run()
cat.waitUntilExit()

Console output:

Fatal error: POSIX command failed with error: 9 – EBADF: file /home/buildnode/jenkins/workspace/oss-swift-package-linux-ubuntu-18_04/swift-corelibs-foundation/Foundation/Process.swift, line 977
 Illegal instruction (core dumped)
@spevans
Copy link
Collaborator

spevans commented Nov 3, 2019

This should be fixed by #2553 which is also the fix for https://bugs.swift.org/browse/SR-11699

@spevans
Copy link
Collaborator

spevans commented Nov 14, 2019

This has been merged into master and is fixed in swift-DEVELOPMENT-SNAPSHOT-2019-11-12-a-ubuntu18.04

$ ls
sr-10639.swift
$ cat sr-10639.swift 
import Foundation 

let ls = Process() 
ls.executableURL = URL(fileURLWithPath: "/bin/ls")
let cat = Process()
cat.executableURL = URL(fileURLWithPath: "/bin/cat")

let pipe = Pipe() 
ls.standardOutput = pipe
cat.standardInput = pipe

try! ls.run()
try! cat.run()
cat.waitUntilExit()

$ ~/swift-DEVELOPMENT-SNAPSHOT-2019-11-12-a-ubuntu18.04/usr/bin/swift sr-10639.swift 
sr-10639.swift

@swift-ci swift-ci transferred this issue from apple/swift-issues Apr 25, 2022
@shahmishal shahmishal transferred this issue from apple/swift May 5, 2022
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants