[Reportbug-maint] Bug#769055: reportbug: AttributeError: 'NoneType' object has no attribute 'startswith'

Brian May brian at microcomaustralia.com.au
Sun Nov 23 23:15:22 UTC 2014

On 24 November 2014 at 09:40, Sandro Tosi <morph at debian.org> wrote:

> at first look it seems exactly the temp file is not there, hence the crash.

Which is kind of weird, the temp file should be there.

> In my setup I have smtphost set, and it works, so it smells like
> something else got in the middle.

IIRC, I ran this from an unstable schroot, I don't have smtphost set (yes,
probably should change that), and sendmail wasn't installed.

So I don't expect this to work.

This is reproducible.

However, it does seem odd that the temporary file is getting deleted. Hmmm.
If I understand the code correctly now, it deletes the file created by the
editor, and creates a new file if required. I thought it would keep the
edited file around.

There does seem to be a logic error on these lines:

if outfile or not ((mta and os.path.exists(mta)) or smtphost):
    msgname = os.path.expanduser(outfile) or ('/var/tmp/%s.bug' % package)

I think the intention of this line is "if the user requested that we write
file to outfile or no valid MTA is defined then we should write to a file".

However, this is a problem if we get into this code because if no valid MTA
is defined and the outfile command line option was never set. We have a
default, however that default doesn't happen in time, we have already
crashed before we get to it.

So if we change that code to something like the following, it should stop
it crashing:

    elif outfile or not ((mta and os.path.exists(mta)) or smtphost):
        if outfile:
            msgname = os.path.expanduser(outfile)
            msgname = '/var/tmp/%s.bug' % package

That certainly looks better now:

--- cut ---
Please select tags: (one at a time) [none]
Gathering additional data, this may take a while...
Spawning vimnobak...
Report will be sent to Brian May <bam at debian.org>
Submit this report on reportbug (e to edit) [Y|n|a|c|e|i|l|m|p|q|d|t|s|?]? y
Bug report written as /var/tmp/reportbug.bug
--- cut ---

It could also say why it didn't try to send the report too, but at least
now it isn't crashing, and it is writing the report to a file.
Brian May <brian at microcomaustralia.com.au>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.alioth.debian.org/pipermail/reportbug-maint/attachments/20141124/455b774d/attachment.html>

More information about the Reportbug-maint mailing list