selinux.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Ondrej Mosnacek <omosnace@redhat.com>
To: Stephen Smalley <sds@tycho.nsa.gov>
Cc: Paul Moore <paul@paul-moore.com>, SElinux list <selinux@vger.kernel.org>
Subject: Re: [PATCH] selinux-testsuite: fix test/file to avoid noise in test output
Date: Thu, 19 Sep 2019 09:17:23 +0200	[thread overview]
Message-ID: <CAFqZXNvUv7V5y1CLbaO-HZKOoRnmEQzE+r9myw+o1Eg9fdrYMg@mail.gmail.com> (raw)
In-Reply-To: <20190918125251.10646-1-sds@tycho.nsa.gov>

On Wed, Sep 18, 2019 at 2:52 PM Stephen Smalley <sds@tycho.nsa.gov> wrote:
> commit ec3ea0fcf3742cba319 ("tests/file: use getfattr instead of ls -Z")
> introduced noise in the test output for the file tests because the
> context value returned by getfattr includes the terminating NUL and
> this caused the command lines to be truncated, omitting the stderr
> redirection.  Use the same technique we already use in overlay/test
> by chop()'ing off the terminating NUL.
>
> Signed-off-by: Stephen Smalley <sds@tycho.nsa.gov>
> ---
>  tests/file/test | 1 +
>  1 file changed, 1 insertion(+)
>
> diff --git a/tests/file/test b/tests/file/test
> index 8fe98f6a5b4a..5e080fc6d4e9 100755
> --- a/tests/file/test
> +++ b/tests/file/test
> @@ -51,6 +51,7 @@ system "chcon -t fileop_exec_t $basedir/wait_io 2>&1 > /dev/null";
>  #
>  $good_file_sid =
>    `getfattr --only-values -n security.selinux $basedir/temp_file`;
> +chop($good_file_sid);
>
>  #
>  # Attempt to access a restricted file as the 'good' domain.  The first test
> --
> 2.21.0
>

Thanks for this patch. I agree that chop() is a more straightforward
way to do it than my tr-based solution. I hadn't thought of looking
for existing uses of getfattr in the testsuite...

-- 
Ondrej Mosnacek <omosnace at redhat dot com>
Software Engineer, Security Technologies
Red Hat, Inc.


      reply	other threads:[~2019-09-19  7:17 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-09-18 12:52 [PATCH] selinux-testsuite: fix test/file to avoid noise in test output Stephen Smalley
2019-09-19  7:17 ` Ondrej Mosnacek [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=CAFqZXNvUv7V5y1CLbaO-HZKOoRnmEQzE+r9myw+o1Eg9fdrYMg@mail.gmail.com \
    --to=omosnace@redhat.com \
    --cc=paul@paul-moore.com \
    --cc=sds@tycho.nsa.gov \
    --cc=selinux@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;
as well as URLs for NNTP newsgroup(s).