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

Stephen Finucane stephen at that.guru
Wed May 3 06:49:03 AEST 2017


On Tue, 2017-05-02 at 16:51 +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.
> 
> The only way to prevent UnicodeEncodeErrors is to make sure that one
> of
> the locale-related environment variables (LC_ALL, LANG, LANGUAGE,
> etc.)
> is set. Python will use the correct encoding accordingly.
> 
> Add a note about this on `pwclient --help`. Also, display a help
> message
> when an encoding error occurs.
> 
> Fixes: 046419a3bf8f ("pwclient: Fix encoding problems")
> Signed-off-by: Robin Jarry <robin.jarry at 6wind.com>

Spot on. Moved the help message to the epilog and applied. Thanks,
Robin :)

Stephen



More information about the Patchwork mailing list