Package: reportbug
Version: 4.4
Severity: normal
Tags: patch

I was reporting a bug with reportbug, and click 'd' to detach a file. Then, I
regret and hit enter (without writing anything) and reportbug crash with:

Select the file:
Traceback (most recent call last):
  File "/usr/bin/reportbug", line 1877, in <module>
    main()
  File "/usr/bin/reportbug", line 895, in main
    return iface.user_interface()
  File "/usr/bin/reportbug", line 1819, in user_interface
    charset=charset)
  File "/usr/bin/reportbug", line 254, in handle_editing
    attachments.remove(filetodetach)
ValueError: list.remove(x): x not in list


I made two different patches to fix this (both attached).

One just removes the "empty_ok" option, so only valid files are accepted (so not
detaching anything is not an option once you click 'd'). The other one checks if
the file is in the list, if it is it removes it, and if its not, it does not
detach anything (so if you just click enter, you dont detach anything).

I didn't check if there is any option more covenient in ui.menu, I have to go
right now.




Thanks a lot,
Rodrigo


-- Package-specific info:
** Environment settings:
INTERFACE="text"

** /home/rodrigo/.reportbugrc:
reportbug_version "3.31"
mode novice
ui text
email "rodr...@sdfg.com.ar"
no-cc
header "X-Debbugs-CC: rodr...@sdfg.com.ar"
smtphost bugs.debian.org

-- System Information:
Debian Release: squeeze/sid
  APT prefers testing
  APT policy: (990, 'testing'), (500, 'stable'), (400, 'unstable'), (200, 
'experimental')
Architecture: i386 (i686)

Kernel: Linux 2.6.30-1-686 (SMP w/1 CPU core)
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/bash

Versions of packages reportbug depends on:
ii  apt                           0.7.21     Advanced front-end for dpkg
ii  python                        2.5.4-2    An interactive high-level object-o
ii  python-reportbug              4.4        Python modules for interacting wit

reportbug recommends no packages.

Versions of packages reportbug suggests:
pn  debconf-utils                 <none>     (no description available)
ii  debsums                       2.0.44     verification of installed package 
pn  dlocate                       <none>     (no description available)
ii  exim4                         4.69-11    metapackage to ease Exim MTA (v4) 
ii  exim4-daemon-light [mail-tran 4.69-11    lightweight Exim MTA (v4) daemon
ii  file                          5.03-1     Determines file type using "magic"
ii  gnupg                         1.4.9-4    GNU privacy guard - a free PGP rep
pn  python-gnome2-extras          <none>     (no description available)
ii  python-gtk2                   2.14.1-3   Python bindings for the GTK+ widge
pn  python-urwid                  <none>     (no description available)
pn  python-vte                    <none>     (no description available)

-- no debconf information
--- /usr/bin/reportbug  2009-05-25 15:15:08.000000000 -0300
+++ reportbug   2009-07-04 23:51:05.000000000 -0300
@@ -251,8 +251,11 @@
                 myattachments = [(x, '') for x in attachments]
                 filetodetach = ui.menu(detachprompt, myattachments,
                     'Select the file:', default='', empty_ok=True)
-                attachments.remove(filetodetach)
-                ewrite('Attachment file successfully detached.\n')
+                if filetodetach in attachments:
+                    attachments.remove(filetodetach)
+                    ewrite('Attachment file successfully detached.\n')
+                else:
+                    ewrite('Not detaching anything.\n')
         elif x == 'c':
             ed = ui.get_filename('Choose editor: ', default=options.editor)
             if ed:
--- /usr/bin/reportbug  2009-05-25 15:15:08.000000000 -0300
+++ reportbug   2009-07-05 00:13:16.000000000 -0300
@@ -250,7 +250,7 @@
                 myattachments = []
                 myattachments = [(x, '') for x in attachments]
                 filetodetach = ui.menu(detachprompt, myattachments,
-                    'Select the file:', default='', empty_ok=True)
+                    'Select the file:', default='')
                 attachments.remove(filetodetach)
                 ewrite('Attachment file successfully detached.\n')
         elif x == 'c':

Reply via email to