public inbox for fstests@vger.kernel.org
 help / color / mirror / Atom feed
From: Eryu Guan <eguan@redhat.com>
To: Eric Biggers <ebiggers3@gmail.com>
Cc: fstests@vger.kernel.org, Eric Biggers <ebiggers@google.com>
Subject: Re: [PATCH] generic/397: be compatible with ignored SIGPIPE
Date: Tue, 13 Jun 2017 14:54:38 +0800	[thread overview]
Message-ID: <20170613065438.GA4788@eguan.usersys.redhat.com> (raw)
In-Reply-To: <20170612211528.45666-1-ebiggers3@gmail.com>

On Mon, Jun 12, 2017 at 02:15:28PM -0700, Eric Biggers wrote:
> From: Eric Biggers <ebiggers@google.com>
> 
> If generic/397 is executed in an environment with SIGPIPE ignored, it
> fails because the 'yes' program prints an error message:
> 
>     yes: standard output: Broken pipe
>     yes: write error
> 
> This can be reproduced with:
> 
>     trap '' SIGPIPE; ./check generic/397
> 
> Fix it by generating the string of 255 y's using just 'head' and 'tr'
> instead of 'yes', 'head', and 'tr'.
> 
> Although it's not really a good idea to execute xfstests with SIGPIPE
> ignored, this is the only test I've noticed where it causes a problem,
> so it might as well be fixed in the test.

I'm just curious, why do you need to run fstests with SIGPIPE ignored?

> 
> It would be much nicer to prevent this problem for all tests by making
> the 'check' script restore the default SIGPIPE handler.  But that isn't
> straightforward because bash's 'trap' builtin doesn't allow un-ignoring
> signals that were ignored on entry to the shell.
> 
> Signed-off-by: Eric Biggers <ebiggers@google.com>
> ---
>  tests/generic/397 | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/tests/generic/397 b/tests/generic/397
> index 7077d048..ba920891 100755
> --- a/tests/generic/397
> +++ b/tests/generic/397
> @@ -69,7 +69,7 @@ for dir in $SCRATCH_MNT/edir $SCRATCH_MNT/ref_dir; do
>  	touch $dir/empty > /dev/null
>  	$XFS_IO_PROG -t -f -c "pwrite 0 4k" $dir/a > /dev/null
>  	$XFS_IO_PROG -t -f -c "pwrite 0 33k" $dir/abcdefghijklmnopqrstuvwxyz > /dev/null
> -	maxname=$(yes | head -255 | tr -d '\n') # 255 character filename
> +	maxname=$(head -c 255 /dev/zero | tr '\0' y) # 255 character filename

Using perl seems simpler, we have some other tests do similar tasks
using perl too.

	maxname=$($PERL_PROG -e 'print "y" x 255;')

Thanks,
Eryu

>  	$XFS_IO_PROG -t -f -c "pwrite 0 1k" $dir/$maxname > /dev/null
>  	ln -s a $dir/symlink
>  	ln -s abcdefghijklmnopqrstuvwxyz $dir/symlink2
> -- 
> 2.13.1.508.gb3defc5cc-goog
> 
> --
> To unsubscribe from this list: send the line "unsubscribe fstests" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

  reply	other threads:[~2017-06-13  6:54 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-06-12 21:15 [PATCH] generic/397: be compatible with ignored SIGPIPE Eric Biggers
2017-06-13  6:54 ` Eryu Guan [this message]
2017-06-13 17:38   ` Eric Biggers

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=20170613065438.GA4788@eguan.usersys.redhat.com \
    --to=eguan@redhat.com \
    --cc=ebiggers3@gmail.com \
    --cc=ebiggers@google.com \
    --cc=fstests@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