[PATCH v2] pwclient: Fix silent crash on python 2

Robin Jarry robin.jarry at 6wind.com
Mon May 1 05:54:47 AEST 2017


Hi Stephen,

On Apr 28, 2017 11:46 PM, "Stephen Finucane" <stephen at that.guru> wrote:
>
> I understand the issue now - thanks for clarifying :) Sorry for the
> delay in replying also.
>
> Now, while I understand what you're doing here, I'm wondering if we
> could simply revert the original patch instead. I clearly merged that
> without fully understanding the issue and not only does it cause the
> issues you've trying to resolve here but it seems it's not necessary
> for a lot of people (including me. Fedora 24). For those users that are
> affected, there are less hacky workarounds. For example, a simple
> script like so would so the job, I imagine.
>
>     $ cat pwclient2
>     #!/usr/bin/env bash
>     PYTHONIOENCODING=UTF-8 pwclient
>
> I'd be happy to include an epilog detailing this issue that would
> appear when you'd run '--help'. I realize that were still be an extra
> step for affected users, but the vast majority aren't and wouldn't be
> affected.
>
> Would this be acceptable?

I wouldn't revert the whole patch, I remember I fixed some minor things
which should remain.

However, in addition of a small help messge, we could also wrap the call to
main() to display a more useful error message:

  try:
      main()
  except UnicodeEncodeError as e
      traceback.print_traceback()
      sys.stderr.write('you should export the LANG or LC_ALL environment
variables\n')
      sys.exit(1)

what do you think?

> Stephen
>
> PS: What kind of environment are you encountering this issue in?

On debian 8 (stable).

Robin
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.ozlabs.org/pipermail/patchwork/attachments/20170430/5050bd4d/attachment.html>


More information about the Patchwork mailing list