[Bug 198706] [libstand] ngets shall exit on EOF
bugzilla-noreply at freebsd.org
bugzilla-noreply at freebsd.org
Thu Mar 19 14:14:44 UTC 2015
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 at FreeBSD.org
Reporter: int0dster at 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.
More information about the freebsd-bugs
mailing list