public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Michael Tokarev <mjt@tls.msk.ru>
To: Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: bug reading /proc/sys/kernel/*: only first byte read.
Date: Fri, 20 Oct 2006 16:43:39 +0400	[thread overview]
Message-ID: <4538C47B.9060808@tls.msk.ru> (raw)

I were debugging a weird problem with busybox, and come across
this chunk of strace output:

open("/proc/sys/kernel/osrelease", O_RDONLY) = 3
read(3, "2", 1)                         = 1
read(3, "", 1)                          = 0
close(3)                                = 0

As you can see, after reading one byte from /proc/sys/kernel/osrelease,
next read() returns 0, which is treated as end-of-file by an application.

Why busybox does this single-byte reads is another question (many
shells does that, in order to be able to stop reading at newline).

But this is definitely a bug in kernel, and should be fixed....

It exists in 2.6.17 and 2.6.18

Thanks.

/mjt

             reply	other threads:[~2006-10-20 12:43 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-10-20 12:43 Michael Tokarev [this message]
2007-01-30 10:24 ` bug reading /proc/sys/kernel/*: only first byte read Andrew Morton
2007-01-30 13:25   ` Oleg Nesterov
2007-01-30 14:00     ` Oleg Nesterov
2007-01-30 15:07       ` Eric W. Biederman
2007-01-30 15:57         ` Michael Tokarev

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=4538C47B.9060808@tls.msk.ru \
    --to=mjt@tls.msk.ru \
    --cc=linux-kernel@vger.kernel.org \
    /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