From debbugs-submit-bounces@debbugs.gnu.org Sat Oct 22 13:40:00 2022 Received: (at submit) by debbugs.gnu.org; 22 Oct 2022 17:40:00 +0000 Received: from localhost ([127.0.0.1]:42273 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1omITY-0007Fi-6X for submit@debbugs.gnu.org; Sat, 22 Oct 2022 13:40:00 -0400 Received: from lists.gnu.org ([209.51.188.17]:58500) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1omITV-0007FY-1J for submit@debbugs.gnu.org; Sat, 22 Oct 2022 13:39:58 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1omITU-00022E-N6 for bug-gnu-emacs@gnu.org; Sat, 22 Oct 2022 13:39:56 -0400 Received: from mail-ed1-x52b.google.com ([2a00:1450:4864:20::52b]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1omITS-0005IH-11 for bug-gnu-emacs@gnu.org; Sat, 22 Oct 2022 13:39:56 -0400 Received: by mail-ed1-x52b.google.com with SMTP id e18so16982681edj.3 for ; Sat, 22 Oct 2022 10:39:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=tcd.ie; s=google21; h=mime-version:message-id:date:subject:to:from:from:to:cc:subject :date:message-id:reply-to; bh=tatiUO62JBVWPSuAagz35bboaB3jHip9fCPV8M87ODU=; b=GSS4mMrt7NVb8C6Gpd9ZfiBSb8zUodH1BIeWXJw5XhiMu94w930Ya4DPP9V3A300Nt FHoJXI4yYk7wZkQxUCHtVlHGqbZKgNlskRQaSVpMpze65bRWolIrf5+5izEDLg9itcvK 5KvpN5KTYH/iMWCP2FR9X3JFSHTWJzLF+/8fujd3TTwDhOo+kzbm/Rjvul1PJJVPbAk8 0eMeMtkasatLa+7+lKqcmb8YfMxCrtEvVFnblJ6fFFLN63mwBNM+nlB9AqBwPa8NLZ+u PNJadXYvgStDHDNIaD9E//fk/MXDAc4528Gw4QK+L2yfTerZO4uzwcTNWPFavNa5Lj2c 2ZVw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=mime-version:message-id:date:subject:to:from:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=tatiUO62JBVWPSuAagz35bboaB3jHip9fCPV8M87ODU=; b=KkOzvKENvnkS9AiNrn6Iz+8WUGWyrTzY4w4FpGxYcuLeq0iIBd0oQ6LBYsf2lm7ZiN JoHEGDJ4px0Okm5ORysqKtOHNIjbLRge8Is3VW7+BFP82gsYPq7t9kBGX3WGPOV0JWao ifkjJngj5Re3CLn/amj6ChHBunUTfZvoijt4rcHJZy5zYLlwd2Ei6L/kSBfJwb2YXJxX tUBjAM3qRsEPvziFIEqbJA0ss+BNcb0KfMeAKp9Ef4auFb15bJAH7wqot1yw0z+Jq22m Xnu+OWzLjcRNo2dzQyisRT3GfXtf1qxZFUnMEjnYQGczl+QtqHLq3MnY0ewjd7ZGSI6v VndQ== X-Gm-Message-State: ACrzQf3dP+TMIqGOvfL4QK/wH4HNyBpwFJULcgfmNyccrbWJopzlxhSf rupTNHWb+p1YZFHgAHnCjUJ6rGEaC1pJ2w== X-Google-Smtp-Source: AMsMyM4TTYCvLiwxumR2Z9OMD3+y/gHle0vHj1sI5EPh7EUhRPW2IA8ztwW815A1zreZ5uBxW8GCzg== X-Received: by 2002:a17:907:2bf6:b0:7a3:6230:dc53 with SMTP id gv54-20020a1709072bf600b007a36230dc53mr1255680ejc.82.1666460389250; Sat, 22 Oct 2022 10:39:49 -0700 (PDT) Received: from localhost ([2a02:587:321f:7e8a:d9:365a:ced1:b3d1]) by smtp.gmail.com with ESMTPSA id p10-20020a170906228a00b0078bfe57fc7bsm13011040eja.47.2022.10.22.10.39.47 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 22 Oct 2022 10:39:48 -0700 (PDT) From: "Basil L. Contovounesios" To: bug-gnu-emacs@gnu.org Subject: 29.0.50; Improve error reporting of EUDC plist functions X-Debbugs-Cc: Thomas Fitzsimmons Date: Sat, 22 Oct 2022 20:39:46 +0300 Message-ID: <8735bfpxjx.fsf@tcd.ie> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Received-SPF: pass client-ip=2a00:1450:4864:20::52b; envelope-from=contovob@tcd.ie; helo=mail-ed1-x52b.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-Spam-Score: -1.4 (-) 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.4 (--) --=-=-= Content-Type: text/plain Severity: wishlist Tags: patch In https://bugs.gnu.org/58531#19 it was suggested that eudc-plist-member, eudc-plist-get, and eudc-lax-plist-get could signal a more informative wrong-type-argument instead of a generic static error when passed a degenerate plist argument. The attached patch makes this so. An alternative is to simply call plist-member and plist-get directly, relying on them for any error reporting, and not worry about arguments that degenerate further down the list than the point of interest. WDYT? How important is it to name and shame degenerate plists as eagerly as possible in EUDC? Thanks, -- Basil --=-=-= Content-Type: text/x-diff Content-Disposition: inline; filename=0001-Improve-error-reporting-of-EUDC-plist-functions.patch >From e9e447214b2b0d19af8b7dc43abbcd4c7944a065 Mon Sep 17 00:00:00 2001 From: "Basil L. Contovounesios" Date: Sat, 22 Oct 2022 20:25:54 +0300 Subject: [PATCH] Improve error reporting of EUDC plist functions * lisp/net/eudc.el (eudc--plist-member): Signal a more informative wrong-type-argument instead of a generic error (bug#58531#19). * test/lisp/net/eudc-tests.el (eudc--plist-member) (eudc-plist-member, eudc-plist-get, eudc-lax-plist-get): Update tests accordingly. --- lisp/net/eudc.el | 5 ++--- test/lisp/net/eudc-tests.el | 24 ++++++++++++------------ 2 files changed, 14 insertions(+), 15 deletions(-) diff --git a/lisp/net/eudc.el b/lisp/net/eudc.el index 0283b04574..5f9e78fc7f 100644 --- a/lisp/net/eudc.el +++ b/lisp/net/eudc.el @@ -108,9 +108,8 @@ eudc--using-bbdb-3-or-newer-p (defun eudc--plist-member (plist prop &optional predicate) "Like `plist-member', but signal on invalid PLIST." - ;; Could also use `plistp', but that would change the error. - (or (zerop (% (length plist) 2)) - (error "Malformed plist")) + (or (plistp plist) + (signal 'wrong-type-argument `(plistp ,plist))) (plist-member plist prop predicate)) (defun eudc-plist-member (plist prop) diff --git a/test/lisp/net/eudc-tests.el b/test/lisp/net/eudc-tests.el index 219c250bf0..915006a97c 100644 --- a/test/lisp/net/eudc-tests.el +++ b/test/lisp/net/eudc-tests.el @@ -26,9 +26,9 @@ eudc--plist-member (dolist (obj '(a (a . a) (a a . a))) (should-error (eudc--plist-member obj nil) :type 'wrong-type-argument)) (dolist (plist '((nil) (a) (a a a))) - (dolist (key '(nil a)) - (should (equal (should-error (eudc--plist-member plist key)) - '(error "Malformed plist"))))) + (let ((err `(wrong-type-argument plistp ,(copy-sequence plist)))) + (dolist (key '(nil a)) + (should (equal err (should-error (eudc--plist-member plist key))))))) (let ((-nil (string ?n ?i ?l)) (-a (string ?a))) (should-not (eudc--plist-member () nil)) @@ -56,9 +56,9 @@ eudc-plist-member (dolist (obj '(a (a . a) (a a . a))) (should-error (eudc-plist-member obj nil) :type 'wrong-type-argument)) (dolist (plist '((nil) (a) (a a a))) - (dolist (key '(nil a)) - (should (equal (should-error (eudc-plist-member plist key)) - '(error "Malformed plist"))))) + (let ((err `(wrong-type-argument plistp ,(copy-sequence plist)))) + (dolist (key '(nil a)) + (should (equal err (should-error (eudc-plist-member plist key))))))) (let ((-nil (string ?n ?i ?l)) (-a (string ?a))) (should-not (eudc-plist-member () nil)) @@ -86,9 +86,9 @@ eudc-plist-get (dolist (obj '(a (a . a) (a a . a))) (should-error (eudc-plist-get obj nil) :type 'wrong-type-argument)) (dolist (plist '((nil) (a) (a a a))) - (dolist (key '(nil a)) - (should (equal (should-error (eudc-plist-get plist key)) - '(error "Malformed plist"))))) + (let ((err `(wrong-type-argument plistp ,(copy-sequence plist)))) + (dolist (key '(nil a)) + (should (equal err (should-error (eudc-plist-get plist key))))))) (let ((-nil (string ?n ?i ?l)) (-a (string ?a))) (should-not (eudc-plist-get () nil)) @@ -120,9 +120,9 @@ eudc-lax-plist-get (dolist (obj '(a (a . a) (a a . a))) (should-error (eudc-lax-plist-get obj nil) :type 'wrong-type-argument)) (dolist (plist '((nil) (a) (a a a))) - (dolist (key '(nil a)) - (should (equal (should-error (eudc-lax-plist-get plist key)) - '(error "Malformed plist"))))) + (let ((err `(wrong-type-argument plistp ,(copy-sequence plist)))) + (dolist (key '(nil a)) + (should (equal err (should-error (eudc-lax-plist-get plist key))))))) (let ((-nil (string ?n ?i ?l)) (-a (string ?a))) (should-not (eudc-lax-plist-get () nil)) -- 2.35.1 --=-=-=-- From debbugs-submit-bounces@debbugs.gnu.org Sat Oct 22 14:06:15 2022 Received: (at 58720) by debbugs.gnu.org; 22 Oct 2022 18:06:15 +0000 Received: from localhost ([127.0.0.1]:42291 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1omIsx-0007uR-Ek for submit@debbugs.gnu.org; Sat, 22 Oct 2022 14:06:15 -0400 Received: from mail.fitzsim.org ([69.165.165.189]:33386) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1omIsu-0007uC-UI for 58720@debbugs.gnu.org; Sat, 22 Oct 2022 14:06:14 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=fitzsim.org ; s=20220430; 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=elc6/WRljxOk/n+AqpzNrM2hzTbilZHwXjton9gm+Yc=; b=Iej5/Bh2x6JdYJAOFiuU2yGP42 KMPPmDc4GPJPKeIo+ISqqgYuac56DxIbviUTg9jOkqtwz21M8PS5UwQIUTKrN24rFO3v5aZmZ3yg8 WY3CbFSIuCR7Xru8E8bGDtUYzd8cWEeQcfz27sUOsjheLvKMNIa57hSQWEXJnQHmdryO6hhvrzqYm XFEK8cP4LiyHIC3aT+t9ZlAl5IDfBj0rxmOEUsdFqDQObDrlGlwHJrxT6jzjw03BFTbWFxatM5Fjl AIcxTab6/DCOMmQMw9WwRFMaV+txFhBciI+1fdmoOd0ybTEbmnIrpgqG1pHcqW9kgwxYyV5GSI/0A XlTkYgIw==; Received: from [192.168.1.1] (helo=localhost.localdomain) by mail.fitzsim.org with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.94.2) (envelope-from ) id 1omIsk-000IaU-7x; Sat, 22 Oct 2022 14:06:05 -0400 From: Thomas Fitzsimmons To: "Basil L. Contovounesios" Subject: Re: bug#58720: 29.0.50; Improve error reporting of EUDC plist functions References: <8735bfpxjx.fsf@tcd.ie> Date: Sat, 22 Oct 2022 14:06:00 -0400 In-Reply-To: <8735bfpxjx.fsf@tcd.ie> (Basil L. Contovounesios's message of "Sat, 22 Oct 2022 20:39:46 +0300") Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.1 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 58720 Cc: 58720@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 (-) Hi Basil, "Basil L. Contovounesios" writes: > Severity: wishlist > Tags: patch > > In https://bugs.gnu.org/58531#19 it was suggested that > eudc-plist-member, eudc-plist-get, and eudc-lax-plist-get could signal a > more informative wrong-type-argument instead of a generic static error > when passed a degenerate plist argument. The attached patch makes this > so. > > An alternative is to simply call plist-member and plist-get directly, > relying on them for any error reporting, and not worry about arguments > that degenerate further down the list than the point of interest. > > WDYT? How important is it to name and shame degenerate plists as > eagerly as possible in EUDC? This patch looks good to me. I haven't tested it, but if you have, feel free to push to master. (EUDC is not packaged in GNU ELPA, so it's OK to use new functions like plistp without providing backward compatibility.) Thanks! Thomas From debbugs-submit-bounces@debbugs.gnu.org Sat Oct 22 17:51:13 2022 Received: (at control) by debbugs.gnu.org; 22 Oct 2022 21:51:13 +0000 Received: from localhost ([127.0.0.1]:42510 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1omMOf-0007Pa-69 for submit@debbugs.gnu.org; Sat, 22 Oct 2022 17:51:13 -0400 Received: from mail-ed1-f45.google.com ([209.85.208.45]:34437) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1omMOa-0007PC-Vn for control@debbugs.gnu.org; Sat, 22 Oct 2022 17:51:11 -0400 Received: by mail-ed1-f45.google.com with SMTP id w8so16012123edc.1 for ; Sat, 22 Oct 2022 14:51:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=tcd.ie; s=google21; h=mime-version:user-agent:message-id:date:references:in-reply-to :subject:cc:to:from:from:to:cc:subject:date:message-id:reply-to; bh=v+//kev9dIAGQAmCDD2sXRxNO0qLLNdKPx9RTQ5Ihkk=; b=B5Qo4hrnSGfosw6qPoNWbTcrDWIj93SiU11UFHX3FfxvqKNmOaJLG2yETnNC4T5v9X D2hwayuk2cjeUWeSqE8J5O7ql6yYIPW5TuSttgHlvw2nGhpuW6MUryQHjfhnf/0s+IAz NaT1Ghvo11/h999D2GbTr8hE3/XgalZWKWl8LSpy2EZHup8QPLW5Wljsblt+NNb2W+0L ISti28hBKHWErEfn0iM7h9ybKnPjRAWktMUPknCpg8/DeTFxvDZqYVcrXvkM/z2kOi7R HilrASUS5jexP1913kXtyfYkpz8QjUAJzLeZ3GqAz2PB4hdyYiXdtu2JCDhge3xV4eE2 urFQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=mime-version:user-agent:message-id:date:references:in-reply-to :subject:cc:to:from:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=v+//kev9dIAGQAmCDD2sXRxNO0qLLNdKPx9RTQ5Ihkk=; b=oCuDYnePqicgpSb7OHRUupvp7HR9NRR897gMCHUGlpfgWLiAPqrD6y+SrA8RTzzYAD OCaiFluTTPpJqa3Cj65y//E0PIJ191sq0ClNILnUWSbe1IFoiZTyYoa3rc80C0OKsqB0 +6YGCthxH5J842YJL5PyJoESRnVai1Rt0zhug6lFLPMD8clxiAFp3of9yUqZ3h4Bmh6U BGv1IVG+DK/bKTec3/MeLFJRhos8IZRFvl461JrMExUrnz9vwjxuPLphoK4zdIXjwDD8 SeWAyaZ5ORGFAYrIytyDOVlbfd2uF4r3W6Nuc8/HXbzl8/H1C4MVszpMiBnLlCR9nRr/ BWGQ== X-Gm-Message-State: ACrzQf0OBOXdaMwj/s1wqpROQYEsJKWdKVEV4zaGFsHvRqfEjEYlTE9P tUxFFb4U2RAtFrBpYDjnFm3HeA== X-Google-Smtp-Source: AMsMyM6WOEJ5FdDs9mb4AgLtP+GQc/48sYxytmL10fIiwaJ5x3G9M1rplSzOWDb6WXqftqWZ9uNjnQ== X-Received: by 2002:a17:906:dac8:b0:741:545b:796a with SMTP id xi8-20020a170906dac800b00741545b796amr20878410ejb.240.1666475463064; Sat, 22 Oct 2022 14:51:03 -0700 (PDT) Received: from localhost ([2a02:587:321f:7e8a:d9:365a:ced1:b3d1]) by smtp.gmail.com with ESMTPSA id f20-20020a056402161400b004615d0bee55sm2297942edv.6.2022.10.22.14.51.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 22 Oct 2022 14:51:02 -0700 (PDT) From: "Basil L. Contovounesios" To: Thomas Fitzsimmons Subject: Re: bug#58720: 29.0.50; Improve error reporting of EUDC plist functions In-Reply-To: (Thomas Fitzsimmons's message of "Sat, 22 Oct 2022 14:06:00 -0400") References: <8735bfpxjx.fsf@tcd.ie> Date: Sun, 23 Oct 2022 00:51:00 +0300 Message-ID: <8735bfttmj.fsf@tcd.ie> User-Agent: Gnus/5.13 (Gnus v5.13) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -0.0 (/) X-Debbugs-Envelope-To: control Cc: 58720-done@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 (-) close 58720 29.1 quit Thomas Fitzsimmons [2022-10-22 14:06 -0400] wrote: > "Basil L. Contovounesios" writes: > >> In https://bugs.gnu.org/58531#19 it was suggested that >> eudc-plist-member, eudc-plist-get, and eudc-lax-plist-get could signal a >> more informative wrong-type-argument instead of a generic static error >> when passed a degenerate plist argument. The attached patch makes this >> so. >> >> An alternative is to simply call plist-member and plist-get directly, >> relying on them for any error reporting, and not worry about arguments >> that degenerate further down the list than the point of interest. >> >> WDYT? How important is it to name and shame degenerate plists as >> eagerly as possible in EUDC? > > This patch looks good to me. I haven't tested it, but if you have, feel > free to push to master. (EUDC is not packaged in GNU ELPA, so it's OK > to use new functions like plistp without providing backward > compatibility.) Thanks. Pushed and closing. Improve error reporting of EUDC plist functions 9db7b11cf7 2022-10-23 00:44:52 +0300 https://git.sv.gnu.org/cgit/emacs.git/commit/?id=9db7b11cf7 -- Basil From unknown Sun Jun 22 11:36:34 2025 Received: (at fakecontrol) by fakecontrolmessage; To: internal_control@debbugs.gnu.org From: Debbugs Internal Request Subject: Internal Control Message-Id: bug archived. Date: Sun, 20 Nov 2022 12:24:06 +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