Package: release.debian.org Severity: normal User: release.debian....@packages.debian.org Usertags: unblock X-Debbugs-Cc: pubpa...@packages.debian.org Control: affects -1 + src:pubpaste
Please unblock package pubpaste [ Reason ] There are two serious crashes in pubpaste in testing right now, which I haven't reported myself but have fixed, as the upstream. [ Impact ] Worst case: program crashes when doing a screenshot. Best case, it works, but fails to copy unicode from Firefox. [ Tests ] I use this code daily, in graphical and console environment. [ Risks ] It's a leaf package, low popcon, low impact on the rest of the ecosystem, really a convenience for the poor users. [ Checklist ] [x] all changes are documented in the d/changelog [x] I reviewed all changes and I approve them [x] attach debdiff against the package in testing [ Other info ] I must apologize for this: I uploaded the package before the hard freeze and miscalculated the transition time. I was expecting 0.8.3 to land in bookworm before the hard freeze. To be more accurate, I had the understanding that the freeze applied to packages uploaded to sid *after* the hard freeze start. Maybe that was engrained in my brain from a previous policy that had changed since? In any case, sorry about this! I hope you're not too swamped by all the unblock requests. (And yes, this package should really have autopkgtests, I only have myself to blame for that one too...) If this fails to unblock, I think it might be preferable to maintain this through backports and simply remove it from bookworm. unblock pubpaste/0.8.3
diff -Nru pubpaste-0.8.1/debian/changelog pubpaste-0.8.3/debian/changelog --- pubpaste-0.8.1/debian/changelog 2023-02-21 11:27:35.000000000 -0500 +++ pubpaste-0.8.3/debian/changelog 2023-03-09 12:29:54.000000000 -0500 @@ -1,3 +1,16 @@ +pubpaste (0.8.3) unstable; urgency=medium + + * fix crash when uploading badly-encoded unicode + * support for Firefox in HTML pastes + + -- Antoine Beaupré <anar...@debian.org> Thu, 09 Mar 2023 12:29:54 -0500 + +pubpaste (0.8.2) unstable; urgency=high + + * fix regression in screenshots introduced in 0.8.1 + + -- Antoine Beaupré <anar...@debian.org> Mon, 06 Mar 2023 14:12:11 -0500 + pubpaste (0.8.1) unstable; urgency=medium * fix another crash when running without GTK diff -Nru pubpaste-0.8.1/pubpaste.py pubpaste-0.8.3/pubpaste.py --- pubpaste-0.8.1/pubpaste.py 2023-02-21 11:27:35.000000000 -0500 +++ pubpaste-0.8.3/pubpaste.py 2023-03-09 12:29:54.000000000 -0500 @@ -48,6 +48,11 @@ Type, TypeVar, ) + +try: + from typing import TypeAlias +except ImportError: + from typing_extensions import TypeAlias # Python 3.9 or earlier from urllib.parse import quote import yaml @@ -76,7 +81,8 @@ gi.require_version("Gtk", "3.0") from gi.repository import GLib, Gtk, Gdk, GdkPixbuf # type: ignore - from Gtk import MessageDialog # type: ignore + + MessageDialog = Gtk.MessageDialog except (ImportError, ValueError): # "ValueError('Namespace %s not available' % namespace)" gi = None @@ -84,6 +90,7 @@ class MessageDialog: # type: ignore pass + __epilog__ = """ This program will upload the provided files on the internet and notify the user when completed. The resulting URL will also be copied to the clipboard. Preprocessors can do fancy things before (only @@ -583,7 +590,7 @@ """ -class TimerWindow(MessageDialog): # type: ignore[misc] +class TimerWindow(MessageDialog): # type: ignore[misc, valid-type] """This widget will show a timer and a spinner in a window for the given delay, then close the dialog. @@ -1072,6 +1079,9 @@ return datetime.now().strftime("%Y-%m-%d"), secrets.token_urlsafe() +SupportedExtensions: TypeAlias = Literal["png", "jpg", "txt", "html"] + + class BaseClipboard: def __init__(self, selection: Literal["CLIPBOARD", "PRIMARY"]) -> None: """configure the clipboard, based on whether the clipboard is PRIMARY @@ -1088,7 +1098,7 @@ def put_image(self, path: bytes) -> bool: raise NotImplementedError() - def get(self) -> Tuple[Optional[bytes], Optional[Literal["png", "jpg", "txt"]]]: + def get(self) -> Tuple[Optional[bytes], Optional[SupportedExtensions]]: raise NotImplementedError() @@ -1181,7 +1191,7 @@ # we use _exit() to avoid firing atexit() in double os._exit(0) - def get(self) -> Tuple[Optional[bytes], Optional[Literal["png", "jpg", "txt"]]]: + def get(self) -> Tuple[Optional[bytes], Optional[Literal["png", "txt"]]]: """get the clipboard content, possible as an image or, failing that, as text GTK clipboards also support "rich text" and "URI", but I'm not @@ -1243,12 +1253,12 @@ logging.warning("could not copy to clipboard with: %r", command) return False - def get(self) -> Tuple[Optional[bytes], Optional[Literal["png", "jpg", "txt"]]]: + def get(self) -> Tuple[Optional[bytes], Optional[SupportedExtensions]]: command = ["wl-paste", "--list-types"] + self.extra logging.debug("listing supported types with %s", command) mimetype_output = subprocess.run(command, stdout=subprocess.PIPE) mimetypes = mimetype_output.stdout.decode("ascii").split("\n") - extension: Optional[Literal["png", "jpg", "txt"]] = None + extension: Optional[SupportedExtensions] = None if mimetypes == ["No selection"]: return None, None if "image/png" in mimetypes: @@ -1257,6 +1267,12 @@ elif "image/jpeg" in mimetypes: extension = "jpg" mimetype = "image/jpeg" + elif "text/html" in mimetypes: + extension = "html" + mimetype = "text/html" + elif "text/plain;charset=utf-8" in mimetypes: + extension = "txt" + mimetype = "text/plain;charset=utf-8" elif "text/plain" in mimetypes: extension = "txt" mimetype = "text/plain" @@ -1520,7 +1536,7 @@ # dump file contents we know is terminal-safe if path in dump_content: - with open(path) as fp: + with open(path, "rb") as fp: print("uploading content: %r" % fp.read()) assert args.output.endswith("/")