From unknown Tue Jun 17 20:18:23 2025 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-Mailer: MIME-tools 5.509 (Entity 5.509) Content-Type: text/plain; charset=utf-8 From: bug#43441 <43441@debbugs.gnu.org> To: bug#43441 <43441@debbugs.gnu.org> Subject: Status: 27.1; [PATCH] Fix incorrectly base64-padded faces in gnus-convert-face-to-png Reply-To: bug#43441 <43441@debbugs.gnu.org> Date: Wed, 18 Jun 2025 03:18:23 +0000 retitle 43441 27.1; [PATCH] Fix incorrectly base64-padded faces in gnus-con= vert-face-to-png reassign 43441 emacs submitter 43441 Alex Bochannek severity 43441 normal tag 43441 fixed patch thanks From debbugs-submit-bounces@debbugs.gnu.org Wed Sep 16 02:07:08 2020 Received: (at submit) by debbugs.gnu.org; 16 Sep 2020 06:07:08 +0000 Received: from localhost ([127.0.0.1]:32968 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kIQay-0001qk-1P for submit@debbugs.gnu.org; Wed, 16 Sep 2020 02:07:08 -0400 Received: from lists.gnu.org ([209.51.188.17]:54440) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kIQaw-0001qd-29 for submit@debbugs.gnu.org; Wed, 16 Sep 2020 02:07:07 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:57938) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kIQav-00066U-Tj for bug-gnu-emacs@gnu.org; Wed, 16 Sep 2020 02:07:05 -0400 Received: from 50-0-39-243.dsl.static.fusionbroadband.com ([50.0.39.243]:35082 helo=mail.lapseofthought.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kIQaq-00053j-Ht for bug-gnu-emacs@gnu.org; Wed, 16 Sep 2020 02:07:04 -0400 Received: from localhost (localhost [127.0.0.1]) by mail.lapseofthought.com (Postfix) with ESMTP id 4BrqPC4nXDz3jjXb for ; Tue, 15 Sep 2020 23:06:55 -0700 (PDT) X-Virus-Scanned: Debian amavisd-new at lapseofthought.com Received: from mail.lapseofthought.com ([127.0.0.1]) by localhost (mail.lapseofthought.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id kssvzpc3i_9E for ; Tue, 15 Sep 2020 23:06:54 -0700 (PDT) Received: from awb-mbp.local (unknown [IPv6:2601:646:4200:b470:b0ed:26e8:d479:c855]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (No client certificate requested) by mail.lapseofthought.com (Postfix) with ESMTPSA id 4BrqPB0kF3z3jhcB for ; Tue, 15 Sep 2020 23:06:54 -0700 (PDT) From: Alex Bochannek To: bug-gnu-emacs@gnu.org Subject: 27.1; [PATCH] Fix incorrectly base64-padded faces in gnus-convert-face-to-png Date: Tue, 15 Sep 2020 23:06:53 -0700 Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.1 (darwin) MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Received-SPF: softfail client-ip=50.0.39.243; envelope-from=alex@bochannek.com; helo=mail.lapseofthought.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/09/16 02:06:56 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: 2 X-Spam_score: 0.2 X-Spam_bar: / X-Spam_report: (0.2 / 5.0 requ) BAYES_00=-1.9, FORGED_SPF_HELO=1, KHOP_HELO_FCRDNS=0.399, SPF_HELO_PASS=-0.001, SPF_SOFTFAIL=0.665, TVD_RCVD_IP=0.001 autolearn=no autolearn_force=no X-Spam_action: no action X-Spam-Score: -1.3 (-) X-Debbugs-Envelope-To: submit X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -2.3 (--) --=-=-= Content-Type: text/plain Hello! I noticed a problem with Faces not showing up despite a Face-header being present in a message. In this particular case, base64-decode-region failed to decode the header, which had incorrect (i.e., excessive) padding. A command line and a Web-based decoder happily ignored the superfluous '='s at the end of the string. Here is the string in question: "iVBORw0KGgoAAAANSUhEUgAAADAAAAAwBAMAAAClLOS0AAAAMFBMVEUwXjFLc0vD0cS7y7zw9PDZ4tkWSRaVrZZ+m39qi2tXfVj////7+/utwK4IPggAOAAJUUA7AAABKklEQVQ4jWPYjQMwDFYJp0NKEKCNJmEf9h8CsimXiL2e33s3/e7F7K2Cs3f3dCMkQkMKj4YuCY3K3iR+e7fMaiSjvkX0/5cFGrWpe2uLzOpaExUVqMS/8PX/Re5ey960OLBTZpFA8+IlSBKPQ92zNyUUBsosN58uIY0k8f+/ONCoYytkVuhWzVwNkYiYbqk5M3NmOVBi41YZ8RsGF7shEtFb5KJ3r969CyixM7OTPeFUxG2IxLO8/9/SvqXlc+/x3h295YzLlj2nIRJQj//nRvc5TEIal8RsXBLVuCQwIgoq/u80DomP6HEOk/iOS+IJLonZOCT+ReOQ+Lkbh0QKLonbOCR+7MYhsRqHBJrVcIl/1TgklqKLQyQ+tGKIgyQOqXpjig94diZRAgAXmDX6jyWafAAAAABJRU5ErkJggg======" The correct number of '='s here is two. I don't suspect this problem is widespread in other uses of the base64 decoder, so it seems appropriate to me to just patch gnus-convert-face-to-png to generate the right amount of padding. --=-=-= Content-Type: text/x-patch Content-Disposition: inline Content-Description: Fix incorrectly base64-padded faces in gnus-convert-face-to-png diff --git a/lisp/gnus/gnus-fun.el b/lisp/gnus/gnus-fun.el index c95449762e..f1773db29a 100644 --- a/lisp/gnus/gnus-fun.el +++ b/lisp/gnus/gnus-fun.el @@ -205,11 +205,27 @@ gnus-face-encode (defun gnus-convert-face-to-png (face) "Convert FACE (which is base64-encoded) to a PNG. The PNG is returned as a string." - (mm-with-unibyte-buffer - (insert face) - (ignore-errors - (base64-decode-region (point-min) (point-max))) - (buffer-string))) + (let ((face (replace-regexp-in-string "[^[:graph:]]" "" face))) + ;; Calculate correct base64 padding + (if (string-match "=" face) + (let ((length (match-beginning 0)) + (padding nil)) + (progn (setq padding + (/ + (- 24 + (pcase (mod (* length 6) 24) + (`0 24) + (n n))) + 6)) + (setq face (concat + (substring face 0 + (match-beginning 0)) + (make-string padding ?=)))))) + (mm-with-unibyte-buffer + (insert face) + (ignore-errors + (base64-decode-region (point-min) (point-max))) + (buffer-string)))) ;;;###autoload (defun gnus-convert-png-to-face (file) --=-=-= Content-Type: text/plain -- Alex. (abochannek@google.com) --=-=-=-- From debbugs-submit-bounces@debbugs.gnu.org Thu Sep 17 11:31:28 2020 Received: (at 43441) by debbugs.gnu.org; 17 Sep 2020 15:31:28 +0000 Received: from localhost ([127.0.0.1]:38679 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kIvsd-0007dC-90 for submit@debbugs.gnu.org; Thu, 17 Sep 2020 11:31:27 -0400 Received: from quimby.gnus.org ([95.216.78.240]:42190) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kIvsa-0007Ve-EL for 43441@debbugs.gnu.org; Thu, 17 Sep 2020 11:31:26 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnus.org; s=20200322; h=Content-Type:MIME-Version:Message-ID:In-Reply-To:Date: References:Subject:Cc:To:From:Sender:Reply-To:Content-Transfer-Encoding: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=qZ3rwku652w7fuWX7vuG3ktu8bBIfd12O34cGEXijes=; b=DbAy5bvrrcbeOk1hQqBx/bbogr yIlgfYLJQCGxCEr0tDK1+CSeRC8Fg539WrD/XaCbMvYWJkHUSkmUYrspEFzcA+sXj4Fym1S2l3/wS 6qhaY+Cbj0ZYmFuAhdtOPGTgNVpR0UDe1JSl7xqQkl7IyaSzzKhMuWyUIh22J226BPV8=; Received: from cm-84.212.202.86.getinternet.no ([84.212.202.86] helo=xo) by quimby with esmtpsa (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1kIvsR-0001wR-0W; Thu, 17 Sep 2020 17:31:17 +0200 From: Lars Ingebrigtsen To: Alex Bochannek Subject: Re: bug#43441: 27.1; [PATCH] Fix incorrectly base64-padded faces in gnus-convert-face-to-png References: X-Now-Playing: PJ Harvey's _Dry Demos_: "Plants And Rags" Date: Thu, 17 Sep 2020 17:31:13 +0200 In-Reply-To: (Alex Bochannek's message of "Tue, 15 Sep 2020 23:06:53 -0700") Message-ID: <875z8cpghq.fsf@gnus.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Report: Spam detection software, running on the system "quimby.gnus.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see @@CONTACT_ADDRESS@@ for details. Content preview: Alex Bochannek writes: > I don't suspect this problem is widespread in other uses of the base64 > decoder, so it seems appropriate to me to just patch > gnus-convert-face-to-png to generate the right amount of padding. Content analysis details: (-2.9 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -1.0 ALL_TRUSTED Passed through trusted hosts only via SMTP -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 43441 Cc: 43441@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) Alex Bochannek writes: > I don't suspect this problem is widespread in other uses of the base64 > decoder, so it seems appropriate to me to just patch > gnus-convert-face-to-png to generate the right amount of padding. Hm... I think it would be nice to have a utility function to fix up base64 padding, and then gnus-convert-face-to-png could just use that? It should work for both base64 that has newlines inserted and not. -- (domestic pets only, the antidote for overdose, milk.) bloggy blog: http://lars.ingebrigtsen.no From debbugs-submit-bounces@debbugs.gnu.org Mon Sep 28 02:05:42 2020 Received: (at 43441) by debbugs.gnu.org; 28 Sep 2020 06:05:43 +0000 Received: from localhost ([127.0.0.1]:51219 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kMmIA-0000n7-DS for submit@debbugs.gnu.org; Mon, 28 Sep 2020 02:05:42 -0400 Received: from 50-0-39-243.dsl.static.fusionbroadband.com ([50.0.39.243]:60113 helo=mail.lapseofthought.com) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kMmI4-0000mp-Is for 43441@debbugs.gnu.org; Mon, 28 Sep 2020 02:05:41 -0400 Received: from localhost (localhost [127.0.0.1]) by mail.lapseofthought.com (Postfix) with ESMTP id 4C0Bp22ZFCz3jj2G; Sun, 27 Sep 2020 23:05:30 -0700 (PDT) X-Virus-Scanned: Debian amavisd-new at lapseofthought.com Received: from mail.lapseofthought.com ([127.0.0.1]) by localhost (mail.lapseofthought.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id k8rr3eUIcmZ2; Sun, 27 Sep 2020 23:05:29 -0700 (PDT) Received: from awb-mbp.local (unknown [IPv6:2601:646:4200:b470:6105:e647:b3d2:53cf]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (No client certificate requested) by mail.lapseofthought.com (Postfix) with ESMTPSA id 4C0Bp11ccFz3jj6Z; Sun, 27 Sep 2020 23:05:29 -0700 (PDT) From: Alex Bochannek To: Lars Ingebrigtsen Subject: Re: bug#43441: 27.1; [PATCH] Fix incorrectly base64-padded faces in gnus-convert-face-to-png References: <875z8cpghq.fsf@gnus.org> Date: Sun, 27 Sep 2020 23:05:28 -0700 In-Reply-To: <875z8cpghq.fsf@gnus.org> (Lars Ingebrigtsen's message of "Thu, 17 Sep 2020 17:31:13 +0200") Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.1 (darwin) MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Spam-Score: 1.4 (+) X-Spam-Report: Spam detection software, running on the system "debbugs.gnu.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see the administrator of that system for details. Content preview: Lars Ingebrigtsen writes: > Alex Bochannek writes: > >> I don't suspect this problem is widespread in other uses of the base64 >> decoder, so it seems appropriate to me to just patch >> gnus-convert-face-t [...] Content analysis details: (1.4 points, 10.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- 0.0 TVD_RCVD_IP Message was received from an IP address 0.0 T_SPF_HELO_TEMPERROR SPF: test of HELO record failed (temperror) 1.0 SPF_SOFTFAIL SPF: sender does not match SPF record (softfail) 0.4 KHOP_HELO_FCRDNS Relay HELO differs from its IP's reverse DNS X-Debbugs-Envelope-To: 43441 Cc: 43441@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: 1.3 (+) X-Spam-Report: Spam detection software, running on the system "debbugs.gnu.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see the administrator of that system for details. Content preview: Lars Ingebrigtsen writes: > Alex Bochannek writes: > >> I don't suspect this problem is widespread in other uses of the base64 >> decoder, so it seems appropriate to me to just patch >> gnus-convert-face-t [...] Content analysis details: (1.3 points, 10.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 SPF_HELO_PASS SPF: HELO matches SPF record 1.0 SPF_SOFTFAIL SPF: sender does not match SPF record (softfail) 1.3 FORGED_SPF_HELO No description available. -1.0 MAILING_LIST_MULTI Multiple indicators imply a widely-seen list manager --=-=-= Content-Type: text/plain Lars Ingebrigtsen writes: > Alex Bochannek writes: > >> I don't suspect this problem is widespread in other uses of the base64 >> decoder, so it seems appropriate to me to just patch >> gnus-convert-face-to-png to generate the right amount of padding. > > Hm... I think it would be nice to have a utility function to fix up > base64 padding, and then gnus-convert-face-to-png could just use that? > > It should work for both base64 that has newlines inserted and not. Took me a little while, but I broke this out into a utility function as you suggested. I also wrote some tests for it. As part of me getting familiar with ERT, I added a bunch of tests for gnus-string< and gnus-string>, which I hope are useful. They should probably be in a separate commit, but I leave that up to you. --=-=-= Content-Type: text/x-patch Content-Disposition: inline Content-Description: Fix incorrectly base64-padded faces in gnus-convert-face-to-png diff --git a/lisp/gnus/gnus-fun.el b/lisp/gnus/gnus-fun.el index c95449762e..2461fd45fd 100644 --- a/lisp/gnus/gnus-fun.el +++ b/lisp/gnus/gnus-fun.el @@ -205,11 +205,12 @@ gnus-face-encode (defun gnus-convert-face-to-png (face) "Convert FACE (which is base64-encoded) to a PNG. The PNG is returned as a string." - (mm-with-unibyte-buffer - (insert face) - (ignore-errors - (base64-decode-region (point-min) (point-max))) - (buffer-string))) + (let ((face (gnus-base64-repad face))) + (mm-with-unibyte-buffer + (insert face) + (ignore-errors + (base64-decode-region (point-min) (point-max))) + (buffer-string)))) ;;;###autoload (defun gnus-convert-png-to-face (file) --=-=-= Content-Type: text/x-patch Content-Disposition: inline Content-Description: Implement gnus-base64-repad utility function to create properly base64-padded strings diff --git a/lisp/gnus/gnus-util.el b/lisp/gnus/gnus-util.el index aa9f137e20..7e8dcaa47c 100644 --- a/lisp/gnus/gnus-util.el +++ b/lisp/gnus/gnus-util.el @@ -1343,6 +1343,58 @@ gnus-url-unhex-string (setq tmp (concat tmp str)) tmp)) +(defun gnus-base64-repad (str &optional reject-newlines line-length) + "Take a base 64-encoded string and return it padded correctly, +regardless of what padding the input string alread had. + +If any combination of CR and LF characters are present and +REJECT-NEWLINES is nil remove them, otherwise raise an error. If +LINE-LENGTH is set and the string (or any line in the string if +REJECT-NEWLINES is nil) is longer than that number, raise an +error. Common line length for input characters are 76 plus CRLF +(RFC 2045 MIME), 64 plus CRLF (RFC 1421 PEM), and 1000 including +CRLF (RFC 5321 SMTP). +" + ;;; RFC 4648 specifies that: + ;;; - three 8-bit inputs make up a 24-bit group + ;;; - the 24-bit group is broken up into four 6-bit values + ;;; - each 6-bit value is mapped to one character of the base 64 alphabet + ;;; - if the final 24-bit quantum is filled with only 8 bits the output + ;;; will be two base 64 characters followed by two "=" padding characters + ;;; - if the final 24-bit quantum is filled with only 16 bits the output + ;;; will be three base 64 character followed by one "=" padding character + ;;; + ;;; RFC 4648 section 3 considerations: + ;;; - if reject-newlines is nil (default), concatenate multi-line + ;;; input (3.1, 3.3) + ;;; - if line-length is set, error on input exceeding the limit (3.1) + ;;; - reject characters outside base encoding (3.3, also section 12) + + (let ((splitstr (split-string str "[\r\n]" t))) + (progn + (if (and reject-newlines (> (length splitstr) 1)) + (error "Invalid Base64 string")) + (dolist (substr splitstr) + (if (and line-length (> (length substr) line-length)) + (error "Base64 string exceeds line-length")) + (if (string-match "[^A-Za-z0-9+/=]" substr) + (error "Invalid Base64 string"))) + (let* ((str (string-join splitstr)) + (len (length str)) + (padding nil)) + (if (string-match "=" str) + (setq len (match-beginning 0))) + (progn (setq padding + (/ + (- 24 + (pcase (mod (* len 6) 24) + (`0 24) + (n n))) + 6)) + (concat + (substring str 0 len) + (make-string padding ?=))))))) + (defun gnus-make-predicate (spec) "Transform SPEC into a function that can be called. SPEC is a predicate specifier that contains stuff like `or', `and', --=-=-= Content-Type: text/x-patch; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Content-Description: Implement test cases of gnus-string>, gnus-string<, and gnus-base64-repad diff --git a/test/lisp/gnus/gnus-util-tests.el b/test/lisp/gnus/gnus-util-t= ests.el index 7eadb0de71..ed33be46a3 100644 --- a/test/lisp/gnus/gnus-util-tests.el +++ b/test/lisp/gnus/gnus-util-tests.el @@ -25,6 +25,65 @@ (require 'ert) (require 'gnus-util) =20 +(ert-deftest gnus-string> () + ;; Failure paths + (should-error (gnus-string> "" 1) + :type 'wrong-type-argument) + (should-error (gnus-string> "") + :type 'wrong-number-of-arguments) + + ;; String tests + (should (gnus-string> "def" "abc")) + (should (gnus-string> 'def 'abc)) + (should (gnus-string> "abc" "DEF")) + (should (gnus-string> "abc" 'DEF)) + (should (gnus-string> "=CE=B1=CE=B2=CE=B3" "abc")) + (should (gnus-string> "=D7=90=D7=91=D7=92" "=CE=B1=CE=B2=CE=B3")) + (should (gnus-string> nil "")) + (should (gnus-string> "abc" "")) + (should (gnus-string> "abc" "ab")) + (should-not (gnus-string> "abc" "abc")) + (should-not (gnus-string> "abc" "def")) + (should-not (gnus-string> "DEF" "abc")) + (should-not (gnus-string> 'DEF "abc")) + (should-not (gnus-string> "123" "abc")) + (should-not (gnus-string> "" ""))) + +(ert-deftest gnus-string< () + ;; Failure paths + (should-error (gnus-string< "" 1) + :type 'wrong-type-argument) + (should-error (gnus-string< "") + :type 'wrong-number-of-arguments) + + ;; String tests + (setq case-fold-search nil) + (should (gnus-string< "abc" "def")) + (should (gnus-string< 'abc 'def)) + (should (gnus-string< "DEF" "abc")) + (should (gnus-string< "DEF" 'abc)) + (should (gnus-string< "abc" "=CE=B1=CE=B2=CE=B3")) + (should (gnus-string< "=CE=B1=CE=B2=CE=B3" "=D7=90=D7=91=D7=92")) + (should (gnus-string< "" nil)) + (should (gnus-string< "" "abc")) + (should (gnus-string< "ab" "abc")) + (should-not (gnus-string< "abc" "abc")) + (should-not (gnus-string< "def" "abc")) + (should-not (gnus-string< "abc" "DEF")) + (should-not (gnus-string< "abc" 'DEF)) + (should-not (gnus-string< "abc" "123")) + (should-not (gnus-string< "" "")) + + ;; gnus-string< checks case-fold-search + (setq case-fold-search t) + (should (gnus-string< "abc" "DEF")) + (should (gnus-string< "abc" 'GHI)) + (should (gnus-string< 'abc "DEF")) + (should (gnus-string< 'GHI 'JKL)) + (should (gnus-string< "abc" "=CE=91=CE=92=CE=93")) + (should-not (gnus-string< "ABC" "abc")) + (should-not (gnus-string< "def" "ABC"))) + (ert-deftest gnus-subsetp () ;; False for non-lists. (should-not (gnus-subsetp "1" "1")) @@ -73,4 +132,43 @@ gnus-setdiff (should (equal '("1") (gnus-setdiff '(2 "1" 2) '(2)))) (should (equal '("1" "1") (gnus-setdiff '(2 "1" 2 "1") '(2))))) =20 +(ert-deftest gnus-base64-repad () + (should-error (gnus-base64-repad "" nil nil nil) + :type 'wrong-number-of-arguments) + (should-error (gnus-base64-repad 1) + :type 'wrong-type-argument) + + ;; RFC4648 test vectors + (should (equal "" (gnus-base64-repad ""))) + (should (equal "Zg=3D=3D" (gnus-base64-repad "Zg=3D=3D"))) + (should (equal "Zm8=3D" (gnus-base64-repad "Zm8=3D"))) + (should (equal "Zm9v" (gnus-base64-repad "Zm9v"))) + (should (equal "Zm9vYg=3D=3D" (gnus-base64-repad "Zm9vYg=3D=3D"))) + (should (equal "Zm9vYmE=3D" (gnus-base64-repad "Zm9vYmE=3D"))) + (should (equal "Zm9vYmFy" (gnus-base64-repad "Zm9vYmFy"))) + + (should (equal "Zm8=3D" (gnus-base64-repad "Zm8"))) + (should (equal "Zg=3D=3D" (gnus-base64-repad "Zg"))) + (should (equal "Zg=3D=3D" (gnus-base64-repad "Zg=3D=3D=3D=3D"))) + + (should-error (gnus-base64-repad " ") + :type 'error) + (should-error (gnus-base64-repad "Zg=3D=3D ") + :type 'error) + (should-error (gnus-base64-repad "Z?\x00g=3D=3D") + :type 'error) + ;; line-length + (should-error (gnus-base64-repad "Zg=3D=3D=3D=3D" nil 4) + :type 'error) + ;; reject-newlines + (should-error (gnus-base64-repad "Zm9v\r\nYmFy" t) + :type 'error) + (should (equal "Zm9vYmFy" (gnus-base64-repad "Zm9vYmFy" t))) + (should (equal "Zm9vYmFy" (gnus-base64-repad "Zm9v\r\nYmFy" nil))) + (should (equal "Zm9vYmFy" (gnus-base64-repad "Zm9v\r\nYmFy\n" nil))) + (should-error (gnus-base64-repad "Zm9v\r\n YmFy\r\n" nil) + :type 'error) + (should-error (gnus-base64-repad "Zm9v\r\nYmFy" nil 3) + :type 'error)) + ;;; gnustest-gnus-util.el ends here --=-=-= Content-Type: text/plain -- Alex. --=-=-=-- From debbugs-submit-bounces@debbugs.gnu.org Mon Sep 28 08:11:09 2020 Received: (at 43441) by debbugs.gnu.org; 28 Sep 2020 12:11:09 +0000 Received: from localhost ([127.0.0.1]:51813 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kMrzm-0005po-Ls for submit@debbugs.gnu.org; Mon, 28 Sep 2020 08:11:09 -0400 Received: from quimby.gnus.org ([95.216.78.240]:48958) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kMrzi-0005pC-3c for 43441@debbugs.gnu.org; Mon, 28 Sep 2020 08:11:05 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnus.org; s=20200322; h=Content-Type:MIME-Version:Message-ID:In-Reply-To:Date: References:Subject:Cc:To:From:Sender:Reply-To:Content-Transfer-Encoding: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=SDbY+WMogULXyAcnj9+hcHvL7CMjg2bSj6gBqj8Unrk=; b=ZT12TtfJoqmUY3NGtG2kFEH0iR ULAOVH7ZGK/nZSkFbCz6itkA/cftKoh1r4+chViZ3S3Ds6+ueTw6RobqV38QUSiVJqGwI46UVk3In bKHcoJVaW7yD4hJGogAlMbm0poCSi0ZrEeTROOFAVrRbJUrclDMr8bs8o6rUkAjoM3tU=; Received: from cm-84.212.202.86.getinternet.no ([84.212.202.86] helo=xo) by quimby with esmtpsa (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1kMrzW-0006tr-Nx; Mon, 28 Sep 2020 14:10:54 +0200 From: Lars Ingebrigtsen To: Alex Bochannek Subject: Re: bug#43441: 27.1; [PATCH] Fix incorrectly base64-padded faces in gnus-convert-face-to-png References: <875z8cpghq.fsf@gnus.org> X-Now-Playing: Sir Stephen's _By Design_: "Move That Body" Date: Mon, 28 Sep 2020 14:10:49 +0200 In-Reply-To: (Alex Bochannek's message of "Sun, 27 Sep 2020 23:05:28 -0700") Message-ID: <878scuw186.fsf@gnus.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Report: Spam detection software, running on the system "quimby.gnus.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see @@CONTACT_ADDRESS@@ for details. Content preview: Alex Bochannek writes: > Took me a little while, but I broke this out into a utility function as > you suggested. I also wrote some tests for it. As part of me getting > familiar with ERT, I added a bunch of tests for gnus- [...] Content analysis details: (-2.9 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -1.0 ALL_TRUSTED Passed through trusted hosts only via SMTP -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 43441 Cc: 43441@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) Alex Bochannek writes: > Took me a little while, but I broke this out into a utility function as > you suggested. I also wrote some tests for it. As part of me getting > familiar with ERT, I added a bunch of tests for gnus-string< and > gnus-string>, which I hope are useful. They should probably be in a > separate commit, but I leave that up to you. Thanks; looks good to me. I did some minor touch-ups before committing -- the first line in the comment string should be a complete sentence, and ";;" instead of ";;;", and when is preferred over else-less ifs and pushed to Emacs 28. -- (domestic pets only, the antidote for overdose, milk.) bloggy blog: http://lars.ingebrigtsen.no From debbugs-submit-bounces@debbugs.gnu.org Mon Sep 28 08:11:16 2020 Received: (at control) by debbugs.gnu.org; 28 Sep 2020 12:11:16 +0000 Received: from localhost ([127.0.0.1]:51816 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kMrzw-0005qA-9u for submit@debbugs.gnu.org; Mon, 28 Sep 2020 08:11:16 -0400 Received: from quimby.gnus.org ([95.216.78.240]:48974) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kMrzu-0005pr-0R for control@debbugs.gnu.org; Mon, 28 Sep 2020 08:11:14 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnus.org; s=20200322; h=Subject:From:To:Message-Id:Date:Sender:Reply-To:Cc: MIME-Version:Content-Type:Content-Transfer-Encoding:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=LXnBQd8JO8sIUcXsLskqw1zGg1UW6b5cG8XQV/m1z0w=; b=F8GcS81FfBFC30YGQR86ICXyQ+ b6GL+TVdMNbZmvYyemQVzsfz0kAmbrc1buajj4ujr7mH3JZkeN77q4yMTjk/oQANjNHTzU8wkFWJ7 NXxo2o/JmrYQ5yeBe3Qjr1mKyNbEgOIW8EqDtSJTYNcGy5aSZ2RtTh2Xun5EA9kULs6Q=; Received: from cm-84.212.202.86.getinternet.no ([84.212.202.86] helo=xo) by quimby with esmtpsa (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1kMrzm-0006wD-Ab for control@debbugs.gnu.org; Mon, 28 Sep 2020 14:11:08 +0200 Date: Mon, 28 Sep 2020 14:11:05 +0200 Message-Id: <877dsew17q.fsf@gnus.org> To: control@debbugs.gnu.org From: Lars Ingebrigtsen Subject: control message for bug #43441 X-Spam-Report: Spam detection software, running on the system "quimby.gnus.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see @@CONTACT_ADDRESS@@ for details. Content preview: tags 43441 fixed close 43441 28.1 quit Content analysis details: (-2.9 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -1.0 ALL_TRUSTED Passed through trusted hosts only via SMTP -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: control X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) tags 43441 fixed close 43441 28.1 quit From debbugs-submit-bounces@debbugs.gnu.org Mon Sep 28 11:58:49 2020 Received: (at 43441) by debbugs.gnu.org; 28 Sep 2020 15:58:49 +0000 Received: from localhost ([127.0.0.1]:53815 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kMvY8-0001Gt-PE for submit@debbugs.gnu.org; Mon, 28 Sep 2020 11:58:49 -0400 Received: from 50-0-39-243.dsl.static.fusionbroadband.com ([50.0.39.243]:23341 helo=mail.lapseofthought.com) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kMvY4-0001Gb-PV for 43441@debbugs.gnu.org; Mon, 28 Sep 2020 11:58:47 -0400 Received: from localhost (localhost [127.0.0.1]) by mail.lapseofthought.com (Postfix) with ESMTP id 4C0RyQ4R2Wz3jlJc; Mon, 28 Sep 2020 08:58:38 -0700 (PDT) X-Virus-Scanned: Debian amavisd-new at lapseofthought.com Received: from mail.lapseofthought.com ([127.0.0.1]) by localhost (mail.lapseofthought.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id o86hf4ECU6zW; Mon, 28 Sep 2020 08:58:37 -0700 (PDT) Received: from awb-mbp.local (unknown [IPv6:2601:646:4200:b470:5cac:749b:fb04:efd2]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (No client certificate requested) by mail.lapseofthought.com (Postfix) with ESMTPSA id 4C0RyP1h2Qz3jjJv; Mon, 28 Sep 2020 08:58:37 -0700 (PDT) From: Alex Bochannek To: Lars Ingebrigtsen Subject: Re: bug#43441: 27.1; [PATCH] Fix incorrectly base64-padded faces in gnus-convert-face-to-png References: <875z8cpghq.fsf@gnus.org> <878scuw186.fsf@gnus.org> Date: Mon, 28 Sep 2020 08:58:36 -0700 In-Reply-To: <878scuw186.fsf@gnus.org> (Lars Ingebrigtsen's message of "Mon, 28 Sep 2020 14:10:49 +0200") Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.1 (darwin) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: 2.4 (++) X-Spam-Report: Spam detection software, running on the system "debbugs.gnu.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see the administrator of that system for details. Content preview: Lars Ingebrigtsen writes: > Alex Bochannek writes: > >> Took me a little while, but I broke this out into a utility function as >> you suggested. I also wrote some tests for it. As part of me getting >> fa [...] Content analysis details: (2.4 points, 10.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- 0.0 TVD_RCVD_IP Message was received from an IP address 1.0 SPF_SOFTFAIL SPF: sender does not match SPF record (softfail) -0.0 SPF_HELO_PASS SPF: HELO matches SPF record 1.0 FORGED_SPF_HELO No description available. 0.4 KHOP_HELO_FCRDNS Relay HELO differs from its IP's reverse DNS X-Debbugs-Envelope-To: 43441 Cc: 43441@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: 1.0 (+) Lars Ingebrigtsen writes: > Alex Bochannek writes: > >> Took me a little while, but I broke this out into a utility function as >> you suggested. I also wrote some tests for it. As part of me getting >> familiar with ERT, I added a bunch of tests for gnus-string< and >> gnus-string>, which I hope are useful. They should probably be in a >> separate commit, but I leave that up to you. > > Thanks; looks good to me. I did some minor touch-ups before committing > -- the first line in the comment string should be a complete sentence, > and ";;" instead of ";;;", and when is preferred over else-less ifs and > pushed to Emacs 28. Great, thanks! -- Alex. From unknown Tue Jun 17 20:18:23 2025 Received: (at fakecontrol) by fakecontrolmessage; To: internal_control@debbugs.gnu.org From: Debbugs Internal Request Subject: Internal Control Message-Id: bug archived. Date: Tue, 27 Oct 2020 11:24:03 +0000 User-Agent: Fakemail v42.6.9 # This is a fake control message. # # The action: # bug archived. thanks # This fakemail brought to you by your local debbugs # administrator