[PATCH] pwclient: Fix silent crash on python 2

Stephen Finucane stephen at that.guru
Wed Apr 5 20:15:31 AEST 2017

On Tue, 2017-03-28 at 11:26 +0200, Robin Jarry wrote:
> Replacing sys.stdout and sys.stderr can cause obscure crashes when
> trying to write non unicode data. The interpreter is terminated with
> SIGINT without any specific error writen on the console.
>   rt_sigaction(SIGINT, {SIG_DFL, [], SA_RESTORER, 0x7f964820e8d0},
>   {0x559f50, [], SA_RESTORER, 0x7f964820e8d0}, 8) = 0
> This happens easily when there is an untrapped exception which should
> lead to printing a traceback on stderr.
> To fix this, the only way is to make sure that the PYTHONIOENCODING
> env
> variable is set *before* starting the interpreter as the
> initialization
> is made very early on and the encoding cannot be set or modified
> after.
> On python 3, the default IO encoding is already properly set
> according
> to locale.
> Fixes: 046419a3bf8f ("pwclient: Fix encoding problems")
> Signed-off-by: Robin Jarry <robin.jarry at 6wind.com>

I've no idea how I could even go about testing this. However, it looks
sane and you've tested it locally so...

Acked-by: Stephen Finucane <stephen at that.guru>

...and applied.

More information about the Patchwork mailing list