From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Morgan Smith Newsgroups: gmane.emacs.bugs Subject: bug#64064: [PATCH 2/4] Don't error out on 'nil' alist value. Date: Fri, 16 Jun 2023 12:49:45 -0400 Message-ID: References: <87ilbnn1vb.fsf@gmx.de> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="33978"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Cc: 64064@debbugs.gnu.org To: Michael Albinus Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Fri Jun 16 18:50:16 2023 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1qACeN-0008fD-Q2 for geb-bug-gnu-emacs@m.gmane-mx.org; Fri, 16 Jun 2023 18:50:16 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qACeC-0003gV-Vg; Fri, 16 Jun 2023 12:50:04 -0400 Original-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 1qACeB-0003gL-4n for bug-gnu-emacs@gnu.org; Fri, 16 Jun 2023 12:50:03 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qACeA-0005WK-TI for bug-gnu-emacs@gnu.org; Fri, 16 Jun 2023 12:50:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1qACeA-0006WL-8Y for bug-gnu-emacs@gnu.org; Fri, 16 Jun 2023 12:50:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Morgan Smith Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 16 Jun 2023 16:50:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 64064 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch Original-Received: via spool by 64064-submit@debbugs.gnu.org id=B64064.168693419825051 (code B ref 64064); Fri, 16 Jun 2023 16:50:02 +0000 Original-Received: (at 64064) by debbugs.gnu.org; 16 Jun 2023 16:49:58 +0000 Original-Received: from localhost ([127.0.0.1]:50255 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qACe5-0006Vz-Dl for submit@debbugs.gnu.org; Fri, 16 Jun 2023 12:49:57 -0400 Original-Received: from mail-mw2nam10olkn2046.outbound.protection.outlook.com ([40.92.42.46]:49119 helo=NAM10-MW2-obe.outbound.protection.outlook.com) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qACe3-0006Vj-A2 for 64064@debbugs.gnu.org; Fri, 16 Jun 2023 12:49:56 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=jD5F5O6UkFrR+q5KJvZkzhAVZ+V3P2yUawgYUzHddnFS5syqgHHXv3ls5xzkrDvAzUWuUMWIPBDqMXcJDNR56cHaHXjDnZe3ClfquGlcv+1IVEi0RjzLqHdNu51EINjePcK+bJt7+91PwUI+XuV+BQBIzQK7KhQw5en/4ZxTzdrVogu78A1dTGDXECJ0fPGQzoyGO35KQBL4WUkSa2q+Iq43fQyFfCz97/vsXytkB1E6sdGm/vMA2QABRl1YhwEuFMvbreg5G2j/FMLLhILG0K2K/VjWM2MLoqwZjcueopVM3yLnuOKt6JZTpOqI/+Gzo0EsdJ3uGmGLLtMeNOosrg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=SnjuYmMl6gvHvTq0LmZ8a4WMgvz1TQkVIYYU3KhLecA=; b=WZg2HQkHYqhrI6MXnJP7JSkaJx7J0YzZrSjf5mn1YO/ebDfkUJbAL3oMD00HPa++W4ntJf8a6cLpVN9htPgikVLkbRwmMsSzwJm5waJGlYSlE5r49xgDPU5W3JxUuqmXZUISjKU9mGbgOykfQpd+8y6fAPNzfN9pZP1tfQEbFr/lDP3cRy8qxQt2gNCQUB7JZCkypVc8+vbIcVYWf/yvvChCthASS1jVHw5+9loGII9UP2DlkIPniZyHhlSwGDDOfpeLyeeZT3NNZPND3rQR1zTyI5PBTnRENnrh9R+HXrEuiPXcsFJzsWR14ZwLDBdB0rDA5kLLNnqCsldrawOXLg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=none; dmarc=none; dkim=none; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=outlook.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=SnjuYmMl6gvHvTq0LmZ8a4WMgvz1TQkVIYYU3KhLecA=; b=fK+zp163XxvtWv8s/V2UEkOYjQFEbXdUlGb5jRIUDtDLe894EmIAvV7cADfirZRSRgQFs+a8oLO3phjXbF1nhsam5xc4C6FxkxRH8BZ0uSzFsS9PjJke1lTEyT6DlZs0SNTDIELVyC5Iej4XmIZjAUWgo2B7rP4zMudjcFNjg4C6kjZuuHmwiuwlO4PcJCVhmLJCoT5LMHQDF8Pr1cOyGfSws6ZCAWLT93m/iCzVf9k7yrxN+EFRGvlxZClzstkqQg16obt75Ttzp/Rit1VES6//2fZcE1ByUyz2U/fanJtgBNSO7nskYIAP1vLk9/dL86V6VkIWYpNpQmciq35/uA== Original-Received: from DM5PR03MB3163.namprd03.prod.outlook.com (2603:10b6:4:40::24) by SJ2PR03MB7450.namprd03.prod.outlook.com (2603:10b6:a03:561::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6500.29; Fri, 16 Jun 2023 16:49:47 +0000 Original-Received: from DM5PR03MB3163.namprd03.prod.outlook.com ([fe80::d561:bdf5:3af9:b03e]) by DM5PR03MB3163.namprd03.prod.outlook.com ([fe80::d561:bdf5:3af9:b03e%4]) with mapi id 15.20.6500.029; Fri, 16 Jun 2023 16:49:47 +0000 In-Reply-To: <87ilbnn1vb.fsf@gmx.de> (Michael Albinus's message of "Fri, 16 Jun 2023 12:22:00 +0200") X-Hashcash: 1:20:230616:michael.albinus@gmx.de::NNL3tP3vjJY6XV0a:87vf X-Hashcash: 1:20:230616:64064@debbugs.gnu.org::8+eT/9yuVZUe26Ma:G+jp X-TMN: [re1pnEE4+TXXlej9SZcNOHso6wEakXcz] X-ClientProxiedBy: YQBPR0101CA0029.CANPRD01.PROD.OUTLOOK.COM (2603:10b6:c00::42) To DM5PR03MB3163.namprd03.prod.outlook.com (2603:10b6:4:40::24) X-Microsoft-Original-Message-ID: <87zg4z9wt2.fsf@outlook.com> X-MS-Exchange-MessageSentRepresentingType: 1 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DM5PR03MB3163:EE_|SJ2PR03MB7450:EE_ X-MS-Office365-Filtering-Correlation-Id: d127911a-89c6-40b5-0c3d-08db6e89b1ac X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 9wr/xHnM5QPJWnYJdTf1RgMVIHvYFDWGnyaHcbMQ+Yyw3r3rTkddviKLAe6xO1v1MF+GiTJyk/4vtHQXXfVzmRBoKuzwTUc6ok9s1SCBv1Atu9TdJSbM/A8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zKZvi4R26l2WOKowqSnzISa7vIlU78XAZhCU44dMFRPQkmyGvxgaGfGOPJriL5+cuB1uCHjQhi7VSFX795686r9KuNy+sL73UKTJHIFtRqbHDYkS/XADi+bFboJZtBe6eB7VHZ3sAcy+V6JyRSYFr/KpdIzPs52qvBV4sxzNsh19cZzThy3KcDKmwcrZYhHwpeNuQ415FF/SMcvnJYF8ZWtxIwRpVrlnfm7fVJbE6fyfliQzSyz0bM4S6SOIHyeiKDbzZOMSA ZTyJPlKtCnDUcxDSWL6x06NJzWJeq00SAiJUr4ZbntjJo3co4rDoM9mSV5INAiBhWieQmlmpJaIwK6zGe9Obm2qJq2SgI70SP8 X-OriginatorOrg: outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: d127911a-89c6-40b5-0c3d-08db6e89b1ac X-MS-Exchange-CrossTenant-AuthSource: DM5PR03MB3163.namprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 16 Jun 2023 16:49:47.6869 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 84df9e7f-e9f6-40af-b435-aaaaaaaaaaaa X-MS-Exchange-CrossTenant-RMS-PersistedConsumerOrg: 00000000-0000-0000-0000-000000000000 X-MS-Exchange-Transport-CrossTenantHeadersStamped: SJ2PR03MB7450 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:263478 Archived-At: --=-=-= Content-Type: text/plain Michael Albinus writes: > Couldn't we simply fix this in 'debbugs-gnu-sort-submitter' and > 'debbugs-gnu-sort-title'? That is, handling a nil value for submitter > and title? > > And do you have an example bug number where this could happen? You are correct. I have no example and I doubt such a bug exists. We could remove that part of this patch. Although it is odd that the DEFAULT argument to alist-get is set in that case. On a related note, bug#60850 does not have a subject line so here is more complete patch: --=-=-= Content-Type: text/x-patch Content-Disposition: attachment; filename=0001-Don-t-error-out-on-nil-alist-value.patch >From e391f728c3a00215d8d32ac9b54b29961da46774 Mon Sep 17 00:00:00 2001 From: Morgan Smith Date: Mon, 12 Jun 2023 19:56:50 -0400 Subject: [PATCH] Don't error out on 'nil' alist value. The intention of the DEFAULT argument to alist-get is to return "" instead of 'nil'. However, this still returns 'nil' if the key exists but the value is 'nil'. This problem wasn't detected previously since the functions 'debbugs-gnu-sort-submitter' and 'debbugs-gnu-sort-title' weren't actually used until the previous commit. * debbugs-gnu.el (debbugs-gnu-sort-submitter, debbugs-gnu-sort-title): Remove DEFAULT argument of alist-get and instead wrap call with 'or' to return default. * debbugs-org.el (debbugs-org-show-reports): If the subject is empty, use the empty string. --- debbugs-gnu.el | 12 ++++++------ debbugs-org.el | 5 ++--- 2 files changed, 8 insertions(+), 9 deletions(-) diff --git a/debbugs-gnu.el b/debbugs-gnu.el index 81297d8b7f..dae87c75b0 100644 --- a/debbugs-gnu.el +++ b/debbugs-gnu.el @@ -1282,10 +1282,10 @@ Interactively, it is non-nil with the prefix argument." (defun debbugs-gnu-sort-submitter (s1 s2) (let ((address1 (debbugs-gnu--split-address - (decode-coding-string (alist-get 'originator (car s1) "") 'utf-8))) + (decode-coding-string (or (alist-get 'originator (car s1)) "") 'utf-8))) (address2 (debbugs-gnu--split-address - (decode-coding-string (alist-get 'originator (car s2) "") 'utf-8)))) + (decode-coding-string (or (alist-get 'originator (car s2)) "") 'utf-8)))) (cond ;; Bugs I'm the originator of go to the beginning. ((and (string-equal user-mail-address (car address1)) @@ -1303,14 +1303,14 @@ Interactively, it is non-nil with the prefix argument." (defun debbugs-gnu-sort-title (s1 s2) (let ((owner1 (car (debbugs-gnu--split-address - (decode-coding-string (alist-get 'owner (car s1) "") 'utf-8)))) + (decode-coding-string (or (alist-get 'owner (car s1)) "") 'utf-8)))) (subject1 - (decode-coding-string (alist-get 'subject (car s1) "") 'utf-8)) + (decode-coding-string (or (alist-get 'subject (car s1)) "") 'utf-8)) (owner2 (car (debbugs-gnu--split-address - (decode-coding-string (alist-get 'owner (car s2) "") 'utf-8)))) + (decode-coding-string (or (alist-get 'owner (car s2)) "") 'utf-8)))) (subject2 - (decode-coding-string (alist-get 'subject (car s2) "") 'utf-8))) + (decode-coding-string (or (alist-get 'subject (car s2)) "") 'utf-8))) (cond ;; Bugs I'm the owner of go to the beginning. ((and (string-equal user-mail-address owner1) diff --git a/debbugs-org.el b/debbugs-org.el index 3d353c81e4..c3786d3b0e 100644 --- a/debbugs-org.el +++ b/debbugs-org.el @@ -209,9 +209,8 @@ marked as \"client-side filter\"." (archived (alist-get 'archived status)) (tags (append (alist-get 'found_versions status) (alist-get 'tags status))) - (subject (when (alist-get 'subject status) - (decode-coding-string - (alist-get 'subject status) 'utf-8))) + (subject (decode-coding-string + (or (alist-get 'subject status) "") 'utf-8)) (date (alist-get 'date status)) (last-modified (alist-get 'last_modified status)) (originator (when (alist-get 'originator status) -- 2.40.1 --=-=-= Content-Type: text/plain Morgan --=-=-=--