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

Stephen Finucane stephen at that.guru
Tue May 2 19:31:25 AEST 2017


On Sun, 2017-04-30 at 21:54 +0200, Robin Jarry wrote:
> 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?

Yup. That's definitely worth including. I guess you'd want to export
PYTHONIOENCODING too, and maybe suggest they check out the help page
for more information if it's failed?

Do you want to put that patch together as a v3?

Stephen



More information about the Patchwork mailing list