public inbox for ltp@lists.linux.it
 help / color / mirror / Atom feed
From: Cyril Hrubis <chrubis@suse.cz>
To: Li Wang <liwang@redhat.com>
Cc: ltp-list@lists.sourceforge.net
Subject: Re: [LTP] [PATCH v2] fs/acls: fix some permission issue in the testcase
Date: Thu, 12 Mar 2015 10:40:57 +0100	[thread overview]
Message-ID: <20150312094057.GA29425@rei> (raw)
In-Reply-To: <1426151599.1400.32.camel@dhcp-13-206.nay.redhat.com>

Hi!
> > There are systems without selinux support that does not have this
> > command available. You should check if setenforce and getenforce is
> > present on the system first, then you can try to set the selinux to
> > permissive.
> Hmm, how about these two ways, which one is better?
> 1.
> if [ -x "/usr/sbin/getenforce" -a -x "/usr/sbin/setenforce" ]; then
>        SELINUX=`getenforce`
> else
>        SELINUX=""
> fi
> 
> 2.
> COMMAND=$(command -v "getenforce" "setenforce" |wc -l)
> if [ $COMMAND -eq 2 ]; then
> 	SELINUX=$(getenforce)
> else
> 	SELINUX=""
> fi

Both looks reasonably fine. The second may be a slightly better because
it does not expect the commands to live under /usr/sbin/, which may not
change, but it's more robust this way.

-- 
Cyril Hrubis
chrubis@suse.cz

------------------------------------------------------------------------------
Dive into the World of Parallel Programming The Go Parallel Website, sponsored
by Intel and developed in partnership with Slashdot Media, is your hub for all
things parallel software development, from weekly thought leadership blogs to
news, videos, case studies, tutorials and more. Take a look and join the 
conversation now. http://goparallel.sourceforge.net/
_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list

  parent reply	other threads:[~2015-03-12  9:41 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-03-10  5:55 [LTP] [PATCH v2] fs/acls: fix some permission issue in the testcase Li Wang
2015-03-11 12:30 ` Cyril Hrubis
     [not found]   ` <1426151599.1400.32.camel@dhcp-13-206.nay.redhat.com>
2015-03-12  9:40     ` Cyril Hrubis [this message]
2015-03-12  9:44     ` Cyril Hrubis

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=20150312094057.GA29425@rei \
    --to=chrubis@suse.cz \
    --cc=liwang@redhat.com \
    --cc=ltp-list@lists.sourceforge.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