Date: Thu, 19 Mar 2015 14:14:44 +0000 From: bugzilla-noreply@freebsd.org To: freebsd-bugs@FreeBSD.org Subject: [Bug 198706] [libstand] ngets shall exit on EOF Message-ID: <bug-198706-8@https.bugs.freebsd.org/bugzilla/>
next in thread | raw e-mail | index | archive | help
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=198706 Bug ID: 198706 Summary: [libstand] ngets shall exit on EOF Product: Base System Version: 11.0-CURRENT Hardware: Any OS: Any Status: New Severity: Affects Some People Priority: --- Component: kern Assignee: freebsd-bugs@FreeBSD.org Reporter: int0dster@gmail.com Hi All, I`ve noted that ngets() from libstand starts consuming CPU like mad when EOF appears on stdin. I see this issue with bhyveload when forwarding "user input" over pipe. Here is the simpliest program to reproduce: cat > ./bget.c #include #include #include #include int main() { char str[512]; for (;;) { ngets(str, sizeof(str)); if (str[0] == '\n') // <--- The program shall exit on \nEOF here, but it // spins inside ngets() and does not reach this point break; } return 0; } $ echo "balbalbalabl" | ./bget & $ There is no problem in libstand when it is used in the real boot loader, but inside bhyveload it has a bug described above. There is a github pull request with suggested patch https://github.com/freebsd/freebsd/pull/23 -- You are receiving this mail because: You are the assignee for the bug.
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?bug-198706-8>