All of lore.kernel.org
 help / color / mirror / Atom feed
From: Richard Purdie <richard.purdie@linuxfoundation.org>
To: Christopher Larson <clarson@kergoth.com>,
	Ross Burton <ross.burton@intel.com>
Cc: "bitbake-devel@lists.openembedded.org"
	<bitbake-devel@lists.openembedded.org>
Subject: Re: [PATCH] lib/bb/utils: fix set_process_name
Date: Wed, 13 Jul 2016 00:00:48 +0100	[thread overview]
Message-ID: <1468364448.28829.122.camel@linuxfoundation.org> (raw)
In-Reply-To: <CABcZAN=KiVhYkSOUBiOdPSW3kKdJJXfWfrV9FE=o4bbjY5wkng@mail.gmail.com>

On Tue, 2016-07-12 at 08:20 -0700, Christopher Larson wrote:
> 
> On Tue, Jul 12, 2016 at 8:15 AM, Ross Burton <ross.burton@intel.com>
> wrote:
> > With Python 3 create_string_buffer needs a bytes() not a str() but
> > as we were
> > catching all exceptions nobody noticed.
> > 
> > [ YOCTO #9910 ]
> > 
> > Signed-off-by: Ross Burton <ross.burton@intel.com>
> > ---
> >  bitbake/lib/bb/utils.py | 5 ++---
> >  1 file changed, 2 insertions(+), 3 deletions(-)
> > 
> > diff --git a/bitbake/lib/bb/utils.py b/bitbake/lib/bb/utils.py
> > index 0a1bf68..3bc2437 100644
> > --- a/bitbake/lib/bb/utils.py
> > +++ b/bitbake/lib/bb/utils.py
> > @@ -1444,9 +1444,8 @@ def set_process_name(name):
> >      # This is nice to have for debugging, not essential
> >      try:
> >          libc = cdll.LoadLibrary('libc.so.6')
> > -        buff = create_string_buffer(len(name)+1)
> > -        buff.value = name
> > -        libc.prctl(15, byref(buff), 0, 0, 0)
> > +        buf = create_string_buffer(bytes(name, 'utf-8'))
> > +        libc.prctl(15, byref(buf), 0, 0, 0)
> >      except:
> >          pass
> > 
> Why are we catching all exceptions, anyway? That's not usually a good
> idea.

The variety of ways cdll and direct syscalls can fail is potentially
quite large in this code block and if this doesn't work, its not really
a big deal, its there for debugging so at the time it seemed reasonable
just to continue if it fails. If someone wants to figure out the
different cdll failure modes on various distros, I'm happy for them to
do so and send a patch. Obviously it did hurt in the python3 transition
but we won't do that every day...

Cheers,

Richard




      reply	other threads:[~2016-07-12 23:00 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-07-12 15:15 [PATCH] lib/bb/utils: fix set_process_name Ross Burton
2016-07-12 15:20 ` Christopher Larson
2016-07-12 23:00   ` Richard Purdie [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=1468364448.28829.122.camel@linuxfoundation.org \
    --to=richard.purdie@linuxfoundation.org \
    --cc=bitbake-devel@lists.openembedded.org \
    --cc=clarson@kergoth.com \
    --cc=ross.burton@intel.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 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.