From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on inbox.vuxu.org X-Spam-Level: X-Spam-Status: No, score=-3.3 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=ham autolearn_force=no version=3.4.4 Received: (qmail 29490 invoked from network); 16 Dec 2022 20:06:10 -0000 Received: from zero.zsh.org (2a02:898:31:0:48:4558:7a:7368) by inbox.vuxu.org with ESMTPUTF8; 16 Dec 2022 20:06:10 -0000 ARC-Seal: i=1; cv=none; a=rsa-sha256; d=zsh.org; s=rsa-20210803; t=1671221170; b=rPMGddsMCaWEaVcEQlPbCZVmHbvEzyq9Z7BqVTMalT6dFhNGsXUjKVri271wIXwG43Ek6YSs8+ vxIJPjk6J7AmUXCzUAhTbnxJLZr0l+WsPNgv3sQUCAS/tUN0gWDfqLrbxA0sVQslQV3rtGvqnK aBMWdtA25V6O6VascBrHXkvaJFDGL0JEkob9jasdxe1cgUwLA7M9oNNNERkNqlUJDpg6WvzOpZ l4kbkBGRbOeHpewmV2YT4fGgHN/j3UJPvKnSo5MOV7kMnF7AeFxMQoytRUEo+gqfSelQtKR8t9 WO08WmNBL38EdMQcZN8wH+KAtP3FRkzUIxBnhypq3qUjDw==; ARC-Authentication-Results: i=1; zsh.org; iprev=pass (wout2-smtp.messagingengine.com) smtp.remote-ip=64.147.123.25; dkim=pass header.d=daniel.shahaf.name header.s=fm1 header.a=rsa-sha256; dkim=pass header.d=messagingengine.com header.s=fm2 header.a=rsa-sha256; dmarc=none header.from=daniel.shahaf.name; arc=none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed; d=zsh.org; s=rsa-20210803; t=1671221170; bh=5lDKltTjHka4BJrl5tnUTidY7LnpbAnyDiqftL3u4o0=; h=List-Archive:List-Owner:List-Post:List-Unsubscribe:List-Subscribe:List-Help: List-Id:Sender:Content-Transfer-Encoding:Content-Type:Subject:To:From:Date: References:In-Reply-To:Message-ID:MIME-Version:DKIM-Signature: DKIM-Signature:DKIM-Signature; b=YtTs3K0fMusHvdb1K8SPtnWabuFcvWoyymSg9+mkl+TW/5yI9kCGJcafYbnYfJUoa+X8vC6JlD bXz4xQfMq18Y0TE9mDQYShzDOyZZ1VZgVOh+xn3kJMNSNkNnsimHXpc1nWFg10sH3QSX+UFCLV Y1sHe0vHacUDheDR6/XtUZHF49qeL84BpC4NHNNMdoTVEM/79BicjQrgzzDaMoECbpMKvclfFm qcguoyimwUI0illTQENfA7Ul5zeuoZwnXEoMkWhcYURUit91EcCwgz8yxf70hJjqYr8IySC391 LOEm8iYsisP6b8vBm+tFk6tenjBNrI/ZzRkRF9gxqD7BZw==; DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=zsh.org; s=rsa-20210803; h=List-Archive:List-Owner:List-Post:List-Unsubscribe: List-Subscribe:List-Help:List-Id:Sender:Content-Transfer-Encoding: Content-Type:Subject:To:From:Date:References:In-Reply-To:Message-Id: Mime-Version:Reply-To:Cc:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID; bh=6VvSJe4weGB0iETStDH/P4xEAqtlYOQCLmxCpvT7viE=; b=IJS8kosIPAt4nUvhXs4HQr44Bq y5nBrCSjojjEofSIgHlQ9V8LUuWmNO2EsdmgGDeQ24VC79v0tPWARdy8DLLzUjffPpYn44JQ84KRg LQgiTlb0x18yllz9k4nS7BarG1onb/VbIO8Q1X+TKYdsGYDTBcr5k1CMu2Uj6uw1k/p7COSH+++gI dZwyhRKxc3DnvIa5WhhxKbGGTjXALRNmkIcOgXzVyyxjhtjMEUMK6clgvPsiAqf3IlQBThXtuHtjg KVgQCgtJACONBCl5B0De13t9GoX1LA43fcBeZeqqWRELZLV798L7MiF90jTOZUSOFCbBZck2Z0EGA WXQFWloA==; Received: by zero.zsh.org with local id 1p6Gy9-000NlB-Ho; Fri, 16 Dec 2022 20:06:09 +0000 Authentication-Results: zsh.org; iprev=pass (wout2-smtp.messagingengine.com) smtp.remote-ip=64.147.123.25; dkim=pass header.d=daniel.shahaf.name header.s=fm1 header.a=rsa-sha256; dkim=pass header.d=messagingengine.com header.s=fm2 header.a=rsa-sha256; dmarc=none header.from=daniel.shahaf.name; arc=none Received: from wout2-smtp.messagingengine.com ([64.147.123.25]:59393) by zero.zsh.org with esmtps (TLS1.3:TLS_AES_256_GCM_SHA384:256) id 1p6Gxw-000NUh-Ef; Fri, 16 Dec 2022 20:05:58 +0000 Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.west.internal (Postfix) with ESMTP id 724DD3200947 for ; Fri, 16 Dec 2022 15:05:51 -0500 (EST) Received: from imap46 ([10.202.2.96]) by compute4.internal (MEProxy); Fri, 16 Dec 2022 15:05:51 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= daniel.shahaf.name; h=cc:content-transfer-encoding:content-type :date:date:from:from:in-reply-to:in-reply-to:message-id :mime-version:references:reply-to:sender:subject:subject:to:to; s=fm1; t=1671221150; x=1671307550; bh=6VvSJe4weGB0iETStDH/P4xEA qtlYOQCLmxCpvT7viE=; b=ZgdXUkwtr8JkHgDZ+o/FcrQ7jIDyrQbT2q763BbJG CslwLjP0YDuBAjRtrvBWU39k097onFnw5sfmS/lPgDwg9yV46iSQ67EiX2fvqAuW RRG0nnUilwbDemT7HlcdiDIVQkdtgLeAQS+A6NoYMRgLEUdS+d1nTmAjfl3OvGyK eZnDdzUa4In4k/T1jloY03abqETua3WA0uAV+TzXuWuX8/vCIC3ExEbu/DStx18E hXgtjWjESENCtL+lA4/TswBaCXvO8lct66Z4Tyj7A0gZH07jer2l5YtzPlMEODHK 4QCPz5HtbcvqSNp9TF2v+d6YoISvpqWh+mnbEIFj/LsTQ== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:content-type :date:date:feedback-id:feedback-id:from:from:in-reply-to :in-reply-to:message-id:mime-version:references:reply-to:sender :subject:subject:to:to:x-me-proxy:x-me-proxy:x-me-sender :x-me-sender:x-sasl-enc; s=fm2; t=1671221150; x=1671307550; bh=6 VvSJe4weGB0iETStDH/P4xEAqtlYOQCLmxCpvT7viE=; b=KoF7FOqwlqOgN3wEU 44uhrTYIM+nj76H13J30pD3joh2MkaF5U0X7lLpffxvKCNdzQ6W9w3u3AnzqEb73 4rR2b2sgU1av/F2mvV5En/AMFGyAuhIJQyPhd0WCMvmWKS4Z0eVzgo0DarcpIJWu 25Zdj4oa7E6aOKP9Id24iV3ZABZ1/e9GkrG649ev95DUUZhbQ+Vmey3s/IK3c3dY dEeUIW9rnvi9KTfS0f5U3q+TceoRlaf3zRbDersX0HB64PrK7Cwo392OqG6ZOyTC U0zcG+gaMlZ8o3xRHyMFKFydarOIk4973JBfMEESXMh2setFGUCkerrqjKrQalUD vU63g== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvhedrfeejgddufedtucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucenucfjughrpefofgggkfgjfhffhffvufgtgfesth hqredtreerjeenucfhrhhomhepfdffrghnihgvlhcuufhhrghhrghffdcuoegurdhssegu rghnihgvlhdrshhhrghhrghfrdhnrghmvgeqnecuggftrfgrthhtvghrnhephfdvgeekud ehgeefheekkeegleehfeekveduuefhfedtfeffjeelfedvteduvddvnecuffhomhgrihhn pegrphgrtghhvgdrohhrghdphhhtthhpugguohgvshhnthhhrghvvggrshhinhhglhgvfh hilhgvrhgvghhishhtrhihohhfrghllhgvrhhrohhrnhhumhgsvghrshhithhhrghsrghs shhighhnvggurdhsohenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrih hlfhhrohhmpegurdhssegurghnihgvlhdrshhhrghhrghfrdhnrghmvg X-ME-Proxy: Feedback-ID: i425e4195:Fastmail Received: by mailuser.nyi.internal (Postfix, from userid 501) id 9A3D52A20080; Fri, 16 Dec 2022 15:05:50 -0500 (EST) X-Mailer: MessagingEngine.com Webmail Interface User-Agent: Cyrus-JMAP/3.7.0-alpha0-1185-g841157300a-fm-20221208.002-g84115730 Mime-Version: 1.0 Message-Id: <8c519aca-6b02-4bad-a6c5-729ba57c620a@app.fastmail.com> In-Reply-To: <7029e4b9dd41e95b61a8cb3ab78aaf4bc254e3ab.camel@ntlworld.com> References: <527664940.183302.1671208973242@mail.virginmedia.com> <20221216174605.GE8411@tarpaulin.shahaf.local2> <7029e4b9dd41e95b61a8cb3ab78aaf4bc254e3ab.camel@ntlworld.com> Date: Fri, 16 Dec 2022 20:05:30 +0000 From: "Daniel Shahaf" To: zsh-workers@zsh.org Subject: Re: zsh_error_db --- hash-based database of error messages Content-Type: text/plain;charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Seq: 51228 Archived-At: X-Loop: zsh-workers@zsh.org Errors-To: zsh-workers-owner@zsh.org Precedence: list Precedence: bulk Sender: zsh-workers-request@zsh.org X-no-archive: yes List-Id: List-Help: , List-Subscribe: , List-Unsubscribe: , List-Post: List-Owner: List-Archive: Peter Stephenson wrote on Fri, 16 Dec 2022 18:05 +00:00: > On Fri, 2022-12-16 at 17:46 +0000, Daniel Shahaf wrote: >> Peter Stephenson wrote on Fri, Dec 16, 2022 at 16:42:53 +0000: >> > Following on from the retread of the discussion on error messages, >> > here's a very simply proof of concept for a hash-based database of >> > error messages. Even if it's adopted I don't intend the C code >> > to get much larger as the point is to allow it to be able to do >> > everything in shell code. >> >=20 >>=20 >> So, tl;dr: >>=20 >> - Every error message would get an E42 identifier in the source strin= g. >>=20 >> - The "E42" will be looked up as a string key in a well-known assoc, >> where the value will be a more elaborate error message. >>=20 >> - The more elaborate message, if there is one, will be used instead of >> the default message. > FWIW, I'm not sure whether I would prefer for the elaborate message to be shown /instead of/ the default message or /in addition/ to it. > Yes, that's it in a nutshell; any further complexity would ideally > be in shell code. How some other projects do this: - Apache httpd: a APLOGNO(00042) macro in the C sources expands to "AH00042: ". See https://svn.apache.org/repos/asf/httpd/httpd/trunk/docs/log-message-ta= gs/README for details, including why they use a macro (their reasoning seems to apply to our case too). They have a script for use before commit that assigns new error message numbers to newly-added APLOGNO() calls. - Vim: E. I don't know what they do when they add new errors, but every E42 code has an entry in the manual's tags file (=E2=89=88 a= n index entry), so something like `< runtime/doc/tags grep -E '^E[0-9]' | sort -n | tail -n1` would programmatically determine the highest unused E-number. - Subversion: E where the number is taken from a particular .h file in the project's sources. The numbers are assigned non-consecuti= vely and grouped by module (e.g., all CLI parse error codes are numerically next to each other). > I think at least we need something better than E to try to avoid > duplicates, for example E . It's easy to search > the file for a duplicate, a bit more of a pain to search the entire > codebase. Maybe a two letter code, so we can have ZW for zle_word.c? I don't think grepping all of Src/ is that much of a problem. I do that regularly. It's also what httpd's aforementioned script does, since htt= pd doesn't have a single file registry of all error numbers it has assigned. So, perhaps E would suffice for us, too. Where it might fall short is with third-party modules. Therefore, I guess should invent some scheme for third-party modules to use, say, =C2=ABX-:E=C2=BB where matches /[A-Za-z_][A-Za-z0- 9_]+/. Conversely, if we want per-file error numbers: - "A single .c source file" seems like the wrong level of abstraction to expose in a user-facing error message. - Two-letter codes would effect a risk of collisions between different files. I suppose we could use ${__file__#**/Src/} instead of the acronym of __file__'s basename, but see the previous bullet. Or we could have a single file registry of assigned two-letter codes, but th= en why don't we amend that and have a single file registry of assigned global numeric codes? - How'd we implement a script that automatically determines the highest error number already in use in a particular file? (If we adopt the AP= LOGNO() idea this will be easy, but I'm not assuming either way.) Cheers, Daniel