[Reportbug-maint] Bug#866596: querybts: launch_mbox_reader() strips NL characters

Daniel Shahaf danielsh at apache.org
Fri Jun 30 11:08:42 UTC 2017

Package: reportbug
Version: 7.1.7
Severity: important

Dear Maintainer,

1. Run «querybts 860123».
2. Exit the pager.
3. Type 'e' for 'Launch e-mail client to read full log.'

This will launch the configured mbox reader on a file that has no newlines in
it.  (The file does not contain even a single 0D or 0A byte.)

This is because of the following bit of code:

(Pdb) list
1198B	def launch_mbox_reader(cmd, url, http_proxy, timeout):
1199 	    """Runs the command specified by cmd passing the mbox file
1200 	    downloaded from url as a parameter. If cmd is None or fails, then
1201 	    fallback to mail program."""
1202 ->	    mbox = open_url(url, http_proxy, timeout)
1203 	    if mbox is None:
1204 	        return
1205 	    (fd, fname) = TempFile()
1206 	    try:
1207 	        for line in mbox.splitlines():
1208 	            fd.write(line)
1209 	        fd.close()
1210 	        if cmd is not None:
1211 	            try:
1212 	                cmd = cmd % fname
1213 	            except TypeError:
1214 	                cmd = "%s %s" % (cmd, fname)
1215 	            error = os.system(cmd)
1216 	            if not error:
1217 	                return
1218 	        # fallback

The .splitlines() calls returns a list of strings that do *not* contain
newlines (\n characters), and the following .write() does not add its own \n's.



More information about the Reportbug-maint mailing list