From: erik quanstrom <quanstro@quanstro.net>
To: 9fans@9fans.net
Subject: Re: [9fans] Why isn't there a newline character after the first line of /dev/wsys/wctl?
Date: Thu, 14 Jan 2010 21:54:39 -0500 [thread overview]
Message-ID: <2208182b69351f1e4a1457bc5e2661df@brasstown.quanstro.net> (raw)
In-Reply-To: <4d90013f1001141721y6d8098cejf16f2abf3476d01c@mail.gmail.com>
> 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</dev/zero
read: malloc error: virtual memory allocation failed
156.51u 757.95s 916.67r read # status= malloc
> 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
prev parent reply other threads:[~2010-01-15 2:54 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-01-15 1:21 Andrés
2010-01-15 2:54 ` erik quanstrom [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=2208182b69351f1e4a1457bc5e2661df@brasstown.quanstro.net \
--to=quanstro@quanstro.net \
--cc=9fans@9fans.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).