[Reportbug-maint] Bug#857794: reportbug: crash when encountering some non-ASCII characters

Stuart Prescott stuart at debian.org
Wed Mar 22 01:45:30 UTC 2017

Hi Nis,

Others may have some additional comments but a couple of thoughts from an 
observer (I'm not the maintainer).

C.UTF-8 is provided within glibc (it's in the libc-bin package so it is always 
available). Is it worth setting that as the locale for all communication with 
subprocesses? It strikes me that could simplify some parts of this encoding 

If we're touching every invocation subprocess.* anyway, can we also take this 
opportunity to get rid of any invocations via the shell?

+def get_command_output(cmd):
+    use_shell = False
+    if isinstance(cmd, str) and ' ' in cmd:
+        use_shell = True
+    return subprocess.run(cmd, shell=use_shell, 

specifically, my suggestion is that we *require* cmd to be a list or tuple and 
always force use_shell=False. Then we never need to worry about nasty 
characters going near the shell, there's also one less subprocess being used.

Associated with that:

* redirection of stderr to /dev/null can be done in python instead

* the uses of COLUMNS=79 are either no-ops because the command doesn't respect 
COLUMNS anyway or no-ops because the command ignores COLUMNS when invoked 
within a pipe.


Stuart Prescott    http://www.nanonanonano.net/   stuart at nanonanonano.net
Debian Developer   http://www.debian.org/         stuart at debian.org
GPG fingerprint    90E2 D2C1 AD14 6A1B 7EBB 891D BBC1 7EBB 1396 F2F7

More information about the Reportbug-maint mailing list