[LLVMbugs] [Bug 23078] New: fstream doesn't play well with named pipes

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Mon Mar 30 17:46:11 PDT 2015


https://llvm.org/bugs/show_bug.cgi?id=23078

            Bug ID: 23078
           Summary: fstream doesn't play well with named pipes
           Product: libc++
           Version: 3.5
          Hardware: Macintosh
                OS: MacOS X
            Status: NEW
          Severity: normal
          Priority: P
         Component: All Bugs
          Assignee: unassignedclangbugs at nondot.org
          Reporter: surfintheusa at yahoo.com
                CC: llvmbugs at cs.uiuc.edu, mclow.lists at gmail.com
    Classification: Unclassified

Given a pipe created at the command line using 'mkfifo my_pipe' and given the
following snippet:

#include <fstream>
#include <iostream>
#include <string>

int main(int, char*[])
{
    std::fstream pipe("my_pipe");
    std::string message;
    while(std::getline(pipe, message) && message != "EXIT")
    {
        std::cout << message << std::endl
    }

    return 0;
}

If I run the program and (from another command prompt) issue the command "echo
banana > my_pipe", nothing gets printed as it appears the call to getline never
returns. The same snippet and scenario with libstdc++ 4.7.2 works as expected.
That is getline returns, cout prints the message and we loop until message is
"EXIT".


MacOS X 10.10.2

clang -v:
Apple LLVM version 6.0 (clang-600.0.57) (based on LLVM 3.5svn)
Target: x86_64-apple-darwin14.1.0
Thread model: posix

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20150331/71b90ae6/attachment.html>


More information about the llvm-bugs mailing list