All of lore.kernel.org
 help / color / mirror / Atom feed
From: Pawel Zalewski <pzalewski@thegoodpenguin.co.uk>
To: Richard Purdie <richard.purdie@linuxfoundation.org>
Cc: openembedded-core@lists.openembedded.org
Subject: Re: [OE-core] [PATCH] classes: decode output data to text
Date: Mon, 16 Jan 2023 11:14:06 +0000	[thread overview]
Message-ID: <CAA6zWZJnwsuuL2nVxADONpw2W7zK4=KpfQ099k88gvRUSRwzyA@mail.gmail.com> (raw)
In-Reply-To: <b982ed0c230158f65a58c3714a308ab6dfb6f5ae.camel@linuxfoundation.org>

[-- Attachment #1: Type: text/plain, Size: 1408 bytes --]

That is a good point, looking at the codebase I think that the go-to for
dealing with it is using the call to ".decode('utf8')".

Thanks,
Pawel

On Mon, 16 Jan 2023 at 11:01, Richard Purdie <
richard.purdie@linuxfoundation.org> wrote:

> On Thu, 2022-12-22 at 10:38 +0000, Pawel Zalewski wrote:
> > The default return value from subprocess.check_output is an encoded byte.
> > The applied fix will decode the value to a string.
> >
> > Signed-off-by: Pawel Zalewski <pzalewski@thegoodpenguin.co.uk>
> > ---
> >  meta/classes/fs-uuid.bbclass | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/meta/classes/fs-uuid.bbclass b/meta/classes/fs-uuid.bbclass
> > index 9b53dfba7a..731ea575bd 100644
> > --- a/meta/classes/fs-uuid.bbclass
> > +++ b/meta/classes/fs-uuid.bbclass
> > @@ -4,7 +4,7 @@
> >  def get_rootfs_uuid(d):
> >      import subprocess
> >      rootfs = d.getVar('ROOTFS')
> > -    output = subprocess.check_output(['tune2fs', '-l', rootfs])
> > +    output = subprocess.check_output(['tune2fs', '-l', rootfs],
> text=True)
> >      for line in output.split('\n'):
> >          if line.startswith('Filesystem UUID:'):
> >              uuid = line.split()[-1]
>
> You mentioned running into this on kirkstone. One problem is that
> text=True is python 3.7 syntax so whilst this is fine for master,
> kirkstone supports older versions of python.
>
> Cheers,
>
> Richard
>

[-- Attachment #2: Type: text/html, Size: 2085 bytes --]

      reply	other threads:[~2023-01-16 11:14 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-12-22 10:38 [PATCH] classes: decode output data to text Pawel Zalewski
2023-01-06 12:06 ` [OE-core] " Richard Purdie
2023-01-06 12:40   ` Pawel Zalewski
2023-01-06 12:43     ` Alexander Kanavin
2023-01-06 13:10       ` Pawel Zalewski
2023-01-06 13:32         ` Alexander Kanavin
2023-01-16 10:58           ` Richard Purdie
2023-01-16 11:01 ` Richard Purdie
2023-01-16 11:14   ` Pawel Zalewski [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='CAA6zWZJnwsuuL2nVxADONpw2W7zK4=KpfQ099k88gvRUSRwzyA@mail.gmail.com' \
    --to=pzalewski@thegoodpenguin.co.uk \
    --cc=openembedded-core@lists.openembedded.org \
    --cc=richard.purdie@linuxfoundation.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.