mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Takashi Iwai <tiwai@suse.de>
To: Kees Cook <keescook@chromium.org>
Cc: Shuah Khan <shuah@kernel.org>,
	John Stultz <john.stultz@linaro.org>,
	Thomas Gleixner <tglx@linutronix.de>,
	Stephen Boyd <sboyd@kernel.org>,
	linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 1/2] selftests: Remove forced unbuffering for test running
Date: Tue, 21 May 2019 07:21:42 +0200	[thread overview]
Message-ID: <s5hlfz0757d.wl-tiwai@suse.de> (raw)
In-Reply-To: <20190520223749.13476-2-keescook@chromium.org>

On Tue, 21 May 2019 00:37:48 +0200,
Kees Cook wrote:
> 
> As it turns out, the "stdbuf" command will actually force all
> subprocesses into unbuffered output, and some implementations of "echo"
> turn into single-character writes, which utterly wrecks writes to /sys
> and /proc files.
> 
> Instead, drop the "stdbuf" usage, and for any tests that want explicit
> flushing between newlines, they'll have to add "fflush(stdout);" as
> needed.
> 
> Reported-by: Takashi Iwai <tiwai@suse.de>
> Fixes: 5c069b6dedef ("selftests: Move test output to diagnostic lines")
> Signed-off-by: Kees Cook <keescook@chromium.org>

Tested-by: Takashi Iwai <tiwai@suse.de>

BTW, this might be specific to shell invocation.  As in the original
discussion thread, it starts working when I replace "echo" with
"/usr/bin/echo".

Still it's not easy to control in a script itself, so dropping the
unbuffered mode is certainly safer, yes.

Thanks!


Takashi


> ---
>  tools/testing/selftests/kselftest/runner.sh | 12 +-----------
>  1 file changed, 1 insertion(+), 11 deletions(-)
> 
> diff --git a/tools/testing/selftests/kselftest/runner.sh b/tools/testing/selftests/kselftest/runner.sh
> index eff3ee303d0d..00c9020bdda8 100644
> --- a/tools/testing/selftests/kselftest/runner.sh
> +++ b/tools/testing/selftests/kselftest/runner.sh
> @@ -24,16 +24,6 @@ tap_prefix()
>  	fi
>  }
>  
> -# If stdbuf is unavailable, we must fall back to line-at-a-time piping.
> -tap_unbuffer()
> -{
> -	if ! which stdbuf >/dev/null ; then
> -		"$@"
> -	else
> -		stdbuf -i0 -o0 -e0 "$@"
> -	fi
> -}
> -
>  run_one()
>  {
>  	DIR="$1"
> @@ -54,7 +44,7 @@ run_one()
>  		echo "not ok $test_num $TEST_HDR_MSG"
>  	else
>  		cd `dirname $TEST` > /dev/null
> -		(((((tap_unbuffer ./$BASENAME_TEST 2>&1; echo $? >&3) |
> +		(((((./$BASENAME_TEST 2>&1; echo $? >&3) |
>  			tap_prefix >&4) 3>&1) |
>  			(read xs; exit $xs)) 4>>"$logfile" &&
>  		echo "ok $test_num $TEST_HDR_MSG") ||
> -- 
> 2.17.1
> 

  reply	other threads:[~2019-05-21  5:21 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-05-20 22:37 [PATCH v5.2-rc2 0/2] " Kees Cook
2019-05-20 22:37 ` [PATCH 1/2] " Kees Cook
2019-05-21  5:21   ` Takashi Iwai [this message]
2019-05-21 14:12     ` shuah
2019-05-20 22:37 ` [PATCH 2/2] selftests/timers: Add missing fflush(stdout) calls Kees Cook

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=s5hlfz0757d.wl-tiwai@suse.de \
    --to=tiwai@suse.de \
    --cc=john.stultz@linaro.org \
    --cc=keescook@chromium.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-kselftest@vger.kernel.org \
    --cc=sboyd@kernel.org \
    --cc=shuah@kernel.org \
    --cc=tglx@linutronix.de \
    /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

all inboxes | Powered by JetHome®