From mboxrd@z Thu Jan 1 00:00:00 1970 From: erik quanstrom Date: Thu, 14 Jan 2010 21:54:39 -0500 To: 9fans@9fans.net Message-ID: <2208182b69351f1e4a1457bc5e2661df@brasstown.quanstro.net> In-Reply-To: <4d90013f1001141721y6d8098cejf16f2abf3476d01c@mail.gmail.com> References: <4d90013f1001141721y6d8098cejf16f2abf3476d01c@mail.gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset="US-ASCII" Content-Transfer-Encoding: 7bit Subject: Re: [9fans] Why isn't there a newline character after the first line of /dev/wsys/wctl? Topicbox-Message-UUID: bf13ce62-ead5-11e9-9d60-3106f5b1d025 > Supposed to just print the first line?, instead, it prints: > > read: error reading /mnt/wsys/wctl: buffer too small > > Several guys from #plan9 in Freenode told me that that was happening > because of a missing newline. not correct. it is happening because rio thinks the read requests too few bytes. sys/src/cmd/rio/xfid.c:791,796. read reads 1 byte at a time. it's not clear that read(5) expressly allows rio to error here, but it seems reasonable enough. read(1) uses realloc to allocate its buffer and would hang looking for a newline if rio allowed 1 byte reads. if /mnt/wsys/wctl produced a stream of output with no newlines, read would eventually fail like this ; time read But, is the current behavior correct? Or is it erroneous? while correct and consistent, a newline might have made life a tad easier for shell scripts. - erik