~lioploum/offpunk#8: 
archive command triggers offpunk crash

Hi Ploum,

While working on the automated package test suite (autopkgtest), I noticed that if I type in the "archive" command out of the blue, it will crash the browser with the below symptom and exit code 1:

$ offpunk 
Welcome to Offpunk!
Type `help` to get the list of available command.
ON> archive
Traceback (most recent call last):
  File "/usr/bin/offpunk", line 33, in <module>
    sys.exit(load_entry_point('offpunk==1.8', 'console_scripts', 'offpunk')())
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3/dist-packages/offpunk.py", line 4428, in main
    gc.cmdloop()
  File "/usr/lib/python3.11/cmd.py", line 138, in cmdloop
    stop = self.onecmd(line)
           ^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/cmd.py", line 217, in onecmd
    return func(arg)
           ^^^^^^^^^
  File "/usr/lib/python3/dist-packages/offpunk.py", line 3749, in do_archive
    deleted = self.list_rm_url(self.gi.url_mode(),li)
                               ^^^^^^^^^^^^^^^^
AttributeError: 'NoneType' object has no attribute 'url_mode'
$ echo $?
1

This is probably not a huge problem, as I guess I'm most likely not using the "archive" command appropriately in the test condition. Yet, maybe a clear message and giving back the hand to the end user might be consistent with the behavior of most other commands.

#Thanks for your work on Offpunk! Have a nice day, :)

Étienne Mollier emollier@emlwks999.eu Fingerprint: 8f91 b227 c7d6 f2b1 948c 8236 793c f67e 8f0d 11da Sent from /dev/pts/5, please excuse my verbosity. On air: Fahrenheit - Ascent

Status
RESOLVED IMPLEMENTED
Submitter
Étienne Mollier
Assigned to
No-one
Submitted
1 year, 6 months ago
Updated
1 year, 6 months ago
Labels
No labels applied.

~lioploum 1 year, 6 months ago

Thanks for the report, this is already fixed with a bunch of very similar crash in the upcoming 1.9. I should probably release it quickly.

~lioploum REPORTED IMPLEMENTED 1 year, 6 months ago

Étienne Mollier 1 year, 6 months ago · edit

Ploum, on 2023-02-28:

Thanks for the report, this is already fixed with a bunch of very similar crash in the upcoming 1.9. I should probably release it quickly.

Thanks for the release of Offpunk 1.9, I am preparing the upload to Debian unstable. Note that it seems this issue went through the cracks as I still witnessed it when trying to update my test script. If I apply the below patch to append the "needs_gi" decorator to the "do_archive" function, it fixes/workarounds the issue for me:

--- a/offpunk.py
+++ b/offpunk.py
@@ -3765,6 +3765,7 @@ Bookmarks are stored using the 'add' command."""
         else:
             self.list_show("bookmarks")
  
+    @needs_gi
     def do_archive(self,args):
         """Archive current page by removing it from every list and adding it to
 archives, which is a special historical list limited in size. It is similar to `move archives`."""

If it looks appropriate to you, I may patch the Debian version before next Offpunk release.

In hope this helps,

Étienne.

~lioploum 1 year, 6 months ago

Damn, I missed that one. Fixed plenty of those and thought it was fixed.

Just released 1.9.1 to fix that properly.

Étienne Mollier 1 year, 6 months ago · edit

~lioploum, on 2023-03-08:

Just released 1.9.1 to fix that properly.

Thanks, I uploaded that version to Debian unstable this evening.

Have a nice day :)

Register here or Log in to comment, or comment via email.