linux-integrity.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Mimi Zohar <zohar@linux.ibm.com>
To: Vitaly Chikunov <vt@altlinux.org>
Cc: Mimi Zohar <zohar@linux.vnet.ibm.com>,
	Dmitry Kasatkin <dmitry.kasatkin@gmail.com>,
	linux-integrity@vger.kernel.org
Subject: Re: [PATCH v8 1/2] ima-evm-utils: Add some tests for evmctl
Date: Tue, 31 Mar 2020 12:04:26 -0400	[thread overview]
Message-ID: <1585670666.5188.589.camel@linux.ibm.com> (raw)
In-Reply-To: <20200331151444.o3ginofakm6byiu5@altlinux.org>

On Tue, 2020-03-31 at 18:14 +0300, Vitaly Chikunov wrote:
> Mimi,
> 
> On Tue, Mar 31, 2020 at 10:25:24AM -0400, Mimi Zohar wrote:
> > > +# For hard errors
> > > +red_always() {
> > > +  echo $@ $RED
> > 
> > A few functions - "red_always", "red_if_failure", "color_restore" -
> >  use "$@", but none of the function callers pass any parameters.  Is
> > there a reason for the "$@" or just something left over from
> > debugging?
> 
> It was to pass `-n` I think, but it is never needed in the end.
> 
> > > +  if [ "$chash" ] && [ "$chash" != "$hash" ]; then
> > > +    red_always
> > 
> > Only when "ima_hash.test" is invoked directly, the output is colored
> > red.  Really confusing.
> 
> Non-TTY output is never colored to not clutter log files.
> But logic is to color the errors in red.
> 
> So it thought as 'always red', _when_ there is colored output (TTY).
> 
> And it's "always" in contract to "red if failure" - which make text
> red only when the test is expected to pass (thus, this is real error
> condition), when the test is expected to fail there is no point to
> color it red, because it's not real error (to not confuse user).
> 
> Because it is unconditional (in that sense) is it named "red always".
> 
> I can rename it to something like `color_red'. And rename
> `red_if_failure' to `color_red_on_failure'.

Sure, and add a short comment - "Non-TTY output is never colored".

> 
> > Nice!  The code is very concisely written.
> > 
> > Reviewing this patch would be a lot easier, if it was broken up into
> > smaller pieces.  For example, and this is only an example, the initial
> > patch could define the base ima_hash.test, a subsequent patch could
> > add coloring for the base ima_hash.test, another patch could introduce
> > "make check" and add its coloring.  There's all sorts of ways to break
> > up this patch to simplify review.
> 
> This would make following commits to change code which is already
> committed in previous commits. 

Nothing is committed yet.  I pushed it out in order for others to
review and comment, not only your patches, but mine as well.

> This would make editing code extra hard.
> Especially, when tests was reworked a lot.
> 
> Also, I don't think splitting coloring into separate patch improves
> review. Instead, we can just remember the rule that (real) errors are 
> going to be printed in red.
> 
> For example, if we prefix every error message with word "ERROR:" - why
> it would be easier to review if we split adding this prefix to every
> message in a separate commit?
> 
> Red color, similarly to uppercase "ERROR", just improves visibility of
> errors. (Which is useful, because there is really a lot of tests).

Trust me, I understand breaking up patches to simplify review is a lot
of work.  It's one of the hardest things to teach newbies and explain
to them why it is necessary and why a clean history is worthwhile, but
you know how to do it.  These were just suggestions, just as
separating the two tests was just a suggestion.

BTW, in case it got lost along the way, I really do appreciate your
help.

Thanks!

Mimi


  reply	other threads:[~2020-03-31 16:04 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-03-27  4:25 [PATCH v8 0/2] ima-evm-utils: Add some tests for evmctl Vitaly Chikunov
2020-03-27  4:25 ` [PATCH v8 1/2] " Vitaly Chikunov
     [not found]   ` <f9b36972-df5d-db9a-d840-52e9ff76d271@linux.microsoft.com>
2020-03-30 16:29     ` Lakshmi Ramasubramanian
2020-03-30 17:11       ` Vitaly Chikunov
2020-03-31 14:25   ` Mimi Zohar
2020-03-31 15:14     ` Vitaly Chikunov
2020-03-31 16:04       ` Mimi Zohar [this message]
2020-03-27  4:25 ` [PATCH v8 2/2] ima-evm-utils: Add sign/verify " Vitaly Chikunov
     [not found]   ` <98cfccc0-2191-6072-aebe-296e6e150e0c@linux.microsoft.com>
2020-03-30 16:29     ` Lakshmi Ramasubramanian
2020-03-30 17:16       ` Vitaly Chikunov
2020-04-01 18:00   ` Mimi Zohar
2020-04-02  7:19     ` Vitaly Chikunov
2020-04-02 11:14       ` Mimi Zohar
     [not found] ` <d39b433e-4504-d0a4-116f-dd33ca238f7f@linux.microsoft.com>
2020-03-30 16:28   ` [PATCH v8 0/2] ima-evm-utils: Add some " Lakshmi Ramasubramanian
2020-03-30 17:47     ` James Bottomley

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=1585670666.5188.589.camel@linux.ibm.com \
    --to=zohar@linux.ibm.com \
    --cc=dmitry.kasatkin@gmail.com \
    --cc=linux-integrity@vger.kernel.org \
    --cc=vt@altlinux.org \
    --cc=zohar@linux.vnet.ibm.com \
    /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).