mailarchive of the ptxdist mailing list
 help / color / mirror / Atom feed
From: Roland Hieber <rhi@pengutronix.de>
To: ptxdist@pengutronix.de
Subject: Re: [ptxdist] [PATCH v2 1/7] ptxd_lib_code_signing: cs_get_ca(): improve error handling
Date: Thu, 8 Jul 2021 22:16:24 +0200	[thread overview]
Message-ID: <20210708201624.lgt6dvs4aot4rg4l@pengutronix.de> (raw)
In-Reply-To: <20210628063825.GJ25044@pengutronix.de>

On Mon, Jun 28, 2021 at 08:38:25AM +0200, Michael Olbrich wrote:
> On Mon, Jun 28, 2021 at 01:11:15AM +0200, Roland Hieber wrote:
> > From: Marc Kleine-Budde <mkl@pengutronix.de>
> > 
> > This patch changes cs_get_ca() to only output the CA if it actually
> > exists, or print an error and return 1 instead. This makes it possible
> > to use make's $(if $(filter-out, ERROR_CA_NOT_YET_SET, ...))
> > conditional.
> > 
> > Co-authored-by: Roland Hieber <rhi@pengutronix.de>
> > Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
> > Signed-off-by: Roland Hieber <rhi@pengutronix.de>
> > ---
> > PATCH v2 (rhi):
> >  - reorder from PATCH 3/n to PATCH 1/n
> >  - echo "ERROR_CA_NOT_YET_SET" in case of error (feedback from Michael
> >    Olbrich) and also return 1
> > 
> > PATCH v1 (mkl): https://lore.ptxdist.org/ptxdist/20210412161900.2376802-3-mkl@pengutronix.de
> > ---
> >  scripts/lib/ptxd_lib_code_signing.sh | 8 +++++++-
> >  1 file changed, 7 insertions(+), 1 deletion(-)
> > 
> > diff --git a/scripts/lib/ptxd_lib_code_signing.sh b/scripts/lib/ptxd_lib_code_signing.sh
> > index 3e1654bb36e4..0026cdc4dec0 100644
> > --- a/scripts/lib/ptxd_lib_code_signing.sh
> > +++ b/scripts/lib/ptxd_lib_code_signing.sh
> > @@ -243,7 +243,13 @@ cs_get_ca() {
> >      local role="${1}"
> >      cs_init_variables
> >  
> > -    echo "${keydir}/${role}/ca.pem"
> > +    local ca="${keydir}/${role}/ca.pem"
> > +
> > +    if [ ! -e "${ca}" ]; then
> 
> This is not what I suggested. I think this breaks the use-case described in
> the patch description:
> An empty string should be returned when the key setup is done but nothing
> was added to the CA. I'm quite certain, that the file does not exist in
> this case. You need to check for '[ ! -d "${keydir}" ]'.

Hmm yes, my bad, that's even what you suggested in 
<https://lore.ptxdist.org/ptxdist/20210423063320.GE4162561@pengutronix.de/>…
will fix it in v2.

BTW, I like to get feedback mail as Cc into my inbox so I can keep a
simple backlog of my still-to-be-done patches in addition to the
PTXdist list mails, which go to a separate folder. (You often keep me in
Cc, but somehow not always, but I think mutt should do this by default
with the list-reply key binding …)

 - Roland

> 
> Michael
> 
> > +	echo "ERROR_CA_NOT_YET_SET"
> > +	return 1
> > +    fi
> > +    echo "${ca}"
> >  }
> >  export -f cs_get_ca
> >  
> > -- 
> > 2.30.2
> > 
> > 
> > _______________________________________________
> > ptxdist mailing list
> > ptxdist@pengutronix.de
> > To unsubscribe, send a mail with subject "unsubscribe" to ptxdist-request@pengutronix.de
> > 
> 
> -- 
> Pengutronix e.K.                           |                             |
> Steuerwalder Str. 21                       | http://www.pengutronix.de/  |
> 31137 Hildesheim, Germany                  | Phone: +49-5121-206917-0    |
> Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |
> 
> _______________________________________________
> ptxdist mailing list
> ptxdist@pengutronix.de
> To unsubscribe, send a mail with subject "unsubscribe" to ptxdist-request@pengutronix.de
> 

-- 
Roland Hieber, Pengutronix e.K.          | r.hieber@pengutronix.de     |
Steuerwalder Str. 21                     | https://www.pengutronix.de/ |
31137 Hildesheim, Germany                | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686         | Fax:   +49-5121-206917-5555 |

_______________________________________________
ptxdist mailing list
ptxdist@pengutronix.de
To unsubscribe, send a mail with subject "unsubscribe" to ptxdist-request@pengutronix.de

  reply	other threads:[~2021-07-08 20:16 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-06-27 23:11 Roland Hieber
2021-06-27 23:11 ` [ptxdist] [PATCH v2 2/7] ptxd_lib_code_signing: introduce role groups Roland Hieber
2021-06-27 23:11 ` [ptxdist] [PATCH v2 3/7] templates/code-signing-provider: set up the 'imx-habv4-srk' role group Roland Hieber
2021-06-27 23:11 ` [ptxdist] [PATCH v2 4/7] templates/barebox-imx-habv4: use " Roland Hieber
2021-06-27 23:11 ` [ptxdist] [PATCH v2 5/7] host-ptx-code-signing-dev: version bump 0.4 -> 0.5 Roland Hieber
2021-06-27 23:11 ` [ptxdist] [PATCH v2 6/7] ptxd_lib_imx_hab: fix indentation Roland Hieber
2021-06-28  6:42   ` Michael Olbrich
2021-07-08 20:02     ` Roland Hieber
2021-07-09  6:53       ` Michael Olbrich
2021-07-09 10:12     ` Alexander Dahl
2021-07-09 10:41       ` Michael Olbrich
2021-07-16 11:38     ` Marc Kleine-Budde
2021-06-27 23:11 ` [ptxdist] [PATCH v2 7/7] ptxd_lib_code_signing: " Roland Hieber
2021-06-28  6:38 ` [ptxdist] [PATCH v2 1/7] ptxd_lib_code_signing: cs_get_ca(): improve error handling Michael Olbrich
2021-07-08 20:16   ` Roland Hieber [this message]
2021-07-09  7:42     ` Michael Olbrich
2021-07-09 11:26       ` Roland Hieber
2021-07-09 11:41         ` Michael Olbrich

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=20210708201624.lgt6dvs4aot4rg4l@pengutronix.de \
    --to=rhi@pengutronix.de \
    --cc=ptxdist@pengutronix.de \
    --subject='Re: [ptxdist] [PATCH v2 1/7] ptxd_lib_code_signing: cs_get_ca(): improve error handling' \
    /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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox