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.4 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED,UNPARSEABLE_RELAY autolearn=ham autolearn_force=no version=3.4.4 Received: (qmail 16208 invoked from network); 30 Apr 2021 21:16:51 -0000 Received: from zero.zsh.org (2a02:898:31:0:48:4558:7a:7368) by inbox.vuxu.org with ESMTPUTF8; 30 Apr 2021 21:16:51 -0000 ARC-Seal: i=1; cv=none; a=rsa-sha256; d=zsh.org; s=rsa-20200801; t=1619817411; b=0h1BYgCTKv5P5KmC+rg6y6pVnv/l6ftQ5Uh1qZz/8EMu858LcOkopG9FwE1jMZYwEwWroqsdJy PMbygTgVOoBKS98cdCViGaCtJrUf9fOranD+dbNEIq+eCMtjkIMaDWTWKmslLu6DNc2ZNtysZZ oZRXRD82BRl89xKb8Wk0BqjPvcplmLo2X7bcFfUWkP2wb62QCIaGZ2KX2bAQclf1Er/fQTR/qV PvlNfeIIoNJhITOcjqBjHpjHLyEFMfb/zWIcII7PCg39JGzBRAdzBqshmksgVKAV0C7KWGL2PS CZgQ4Vxt27hoRBD70/1DO6Dw27Wo7Va9lD46FBSJPAX0hA==; ARC-Authentication-Results: i=1; zsh.org; iprev=pass (out1-smtp.messagingengine.com) smtp.remote-ip=66.111.4.25; dkim=pass header.d=daniel.shahaf.name header.s=fm3 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-20200801; t=1619817411; bh=hQfA9fOSFCa3Qcdecp1QWQvksr/ugJqy4de6jdcWZ1A=; h=List-Archive:List-Owner:List-Post:List-Unsubscribe:List-Subscribe:List-Help: List-Id:Sender:Content-Transfer-Encoding:Content-Type:Subject:Cc:To:From: Date:References:In-Reply-To:Message-ID:MIME-Version:DKIM-Signature: DKIM-Signature:DKIM-Signature; b=vjnN31zOzKT8cFnDdHkf1cQftHBUvwyCA6D2OshQM63lZlvPsAfOyjQ+FwjafvEDInh2jFo6n7 dXgwFBgYHDRnw76m6yxXYX0LRZMvudyDNq78ZIChPr8ZIKw7cyhshAPWS3XvCpJcIha9dyYopT 9eRUxYmfjqoCQ9aSNSQuZtPr62en9aLpOzlcKjFsLR+v/bg/YqNnaNoQGdByxNxJfv8liDAH0G 7aWqjfJbBjfHKiaRTKHh7uizVPit5wSx+no/MoWBtLOKko9WfQnh/BjjLfWrpXFpUBN3uNAcVM 0Zm9488yBIaTe5cc5c487PhF6YkgQsh/xhT5vb5MeMsD/A==; DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=zsh.org; s=rsa-20200801; h=List-Archive:List-Owner:List-Post:List-Unsubscribe: List-Subscribe:List-Help:List-Id:Sender:Content-Transfer-Encoding: Content-Type:Subject:Cc:To:From:Date:References:In-Reply-To:Message-Id: Mime-Version:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID; bh=jITLcrJffgA1PKBXq2C+wGXNOAkInoeYGEAq6VdseSQ=; b=cRUi6fCBrQH2Jorv6TGaVAHrs/ Ojolr2v1RXqfLy9MzcDlgWtqBWtIiwBFD2zdbNyH8zuje74zxnAPm58IZPIhDOmVUQ4sM6UxXIqKw a05EoDqVHnXGrMSUfFNxiaSYCDOUJAJ5S4jXRsSiovv3iNMxOJrMDsQ/wAfnCKvh/t5ONJdMS1jPa rXXhUPkRRP/sHl7nY2AvzNUfYPWIwq4tbBPQNnexCFp7S0L1oBHFyR8MAVJmSYzkCTd1UI29PiguJ d4JoD1EvJ3YJlMM8Tln+Lw4rE9E4DDtOJ5R4XgRUJPcPWKC+7cwwTlROFy+dbxu/+Vz1AXieo1wRv tobQBZtw==; Received: from authenticated user by zero.zsh.org with local id 1lcaVH-000AFX-2z; Fri, 30 Apr 2021 21:16:51 +0000 Authentication-Results: zsh.org; iprev=pass (out1-smtp.messagingengine.com) smtp.remote-ip=66.111.4.25; dkim=pass header.d=daniel.shahaf.name header.s=fm3 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 out1-smtp.messagingengine.com ([66.111.4.25]:48011) by zero.zsh.org with esmtps (TLS1.3:TLS_AES_256_GCM_SHA384:256) id 1lcaUx-0009zt-Ap; Fri, 30 Apr 2021 21:16:33 +0000 Received: from compute3.internal (compute3.nyi.internal [10.202.2.43]) by mailout.nyi.internal (Postfix) with ESMTP id DE5DE5C0101; Fri, 30 Apr 2021 17:16:29 -0400 (EDT) Received: from imap37 ([10.202.2.87]) by compute3.internal (MEProxy); Fri, 30 Apr 2021 17:16:29 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= daniel.shahaf.name; h=mime-version:message-id:in-reply-to :references:date:from:to:cc:subject:content-type :content-transfer-encoding; s=fm3; bh=jITLcrJffgA1PKBXq2C+wGXNOA kInoeYGEAq6VdseSQ=; b=brnRrnEOX72PyHyIkJc1r5xiKUp8c/fifVfPJcmQ93 jYyfZFQP44EoyBBSQ4m4Bg2haTLWF5egWo94qUPKKjXOptfLckYph6revphvbzO2 1xvNbYrV4bf3KfU4sE3zgvjmwjav9Q+scVfcvaqNVAU5rm0s9N3Te594l7ySCZyq JQx93L2UBJ5L0iF3r6SaC2tlE1UT/9X/vE+SgBVjKZE/0kxvAhTRl/yye8EzyC4Z 0adb8aMn0yCrS1XAUdHwrrL9++9z1dvm8QqBtOsQznL1QJ77I4rMe5A93/ynisSs aC/va9FGjwx1JONToog3zDH7mA45ZpMnSSVMMcPlraBg== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:content-type :date:from:in-reply-to:message-id:mime-version:references :subject:to:x-me-proxy:x-me-proxy:x-me-sender:x-me-sender :x-sasl-enc; s=fm2; bh=jITLcrJffgA1PKBXq2C+wGXNOAkInoeYGEAq6Vdse SQ=; b=bWlHF4MIGtWqUZ/nn1VcH6gjy9oKwM3UH4HH99GYIUy0tYUOmq8jtZm48 AOgxNEBvvy5/IFRyMT1cYAAEc6nkXX4ria+Ut0Kxcp0uIF1PGe80PnXvWev6Midv N0lPbrprt+S2FzNzpO2nlN/uvtJLrcUOz7IegY6KZeMb7T8XrqxEc7SR7VAajHZ8 dgJmI7pFm184ZZXO4lSVwMsno1IBjxmzhqdiguchzkDYzrjgc+xAul4apfr2dvgr //TW5tQEZMswI9M9tWx00Zjgaov3he+dQ3VE1oq2ywWZCJuP6YCBFJZBHXdY4Scd 8vmwQWAUzSv/+Nm1eXWlU0K3X6jQg== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeduledrvddviedgudeitdcutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfgh necuuegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmd enucfjughrpefofgggkfgjfhffhffvufgtgfesthhqredtreerjeenucfhrhhomhepfdff rghnihgvlhcuufhhrghhrghffdcuoegurdhssegurghnihgvlhdrshhhrghhrghfrdhnrg hmvgeqnecuggftrfgrthhtvghrnhepveeuuedtveetveduieelffdvkeeltdeuvdekuefg lefhveekieehkeefudelffejnecuffhomhgrihhnpeiishhhrdhorhhgnecuvehluhhsth gvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomhepugdrshesuggrnhhivghl rdhshhgrhhgrfhdrnhgrmhgv X-ME-Proxy: Received: by mailuser.nyi.internal (Postfix, from userid 501) id 87B946B40067; Fri, 30 Apr 2021 17:16:29 -0400 (EDT) X-Mailer: MessagingEngine.com Webmail Interface User-Agent: Cyrus-JMAP/3.5.0-alpha0-403-gbc3c488b23-fm-20210419.005-gbc3c488b Mime-Version: 1.0 Message-Id: <0be2a280-9f0e-4762-87cb-aa6af32a813c@www.fastmail.com> In-Reply-To: References: <7E71FA83-356E-448B-9726-02DF3FF5BD14@gmail.com> <873D08A9-F321-474A-8440-CCE7DCCBA529@gmail.com> <20210414120551.GA3882@tarpaulin.shahaf.local2> <6CEA4F3E-9A64-44E1-9121-FA9D5E053AB5@gmail.com> <20210414140950.GH3882@tarpaulin.shahaf.local2> Date: Fri, 30 Apr 2021 21:16:09 +0000 From: "Daniel Shahaf" To: "Marlon Richert" Cc: "Zsh hackers list" Subject: Re: sysexits.h codes? (was: Re: [RFC][PATCH] `newuser` prompt theme) Content-Type: text/plain;charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Seq: 48759 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: Marlon Richert wrote on Fri, 30 Apr 2021 19:40 +00:00: > On Wed, Apr 14, 2021 at 5:09 PM Daniel Shahaf = wrote: > > > >> @@ -0,0 +1,197 @@ > > > >> +readonly -ga sysexits=3D( > > > >> + USAGE > > > > =E2=8B=AE > > > >> + CONFIG > > > > > > > > Two interrelated scripts on zsh.org hardcode these constants too= . > > > > I wonder if we should provide these constants in a standard auto= loaded > > > > function or preset variable. > > > > > > A preset variable would be great. In C code, you can get the names= and values from `sysexits.h`, which is available in both GNU and BSD. > > > > An associative array mapping symbolic names to integers? >=20 > I think we could settle for just an array of names, to be consistent > with $signals. With $signals there's the annoyance that there's an off-by-one between the signals' value and its array index. With a $sysexits that's just an array of names there'd be an off-by-64. That'd be a magic number. Not a deal breaker, but not ideal either. >=20 > > Just those available on the target system, or? >=20 > sysexits.h tries to standardize exit codes. Having different $sysexits= > on different target systems would defeat its purpose. >=20 That's two separate issues: one, whether sysexits.h should define the same numeric values everywhere; two, whether $sysexits should reflect the local sysexits.h or a "well-known" one, in case they're different. > > > It would be great if, besides printing the name, it could also add= a > > > short description of what the exit code actually means. Something = like > > > =E2=80=9CSIGPIPE (140): write on a pipe with no reader=E2=80=9D. > > > > There's precedent to work with: > > > > % =3Dpwd | true > > zsh: broken pipe =3Dpwd > > > > I suppose the default should be about this level of verbosity. > > > > Other degrees of verbosity could be considered. >=20 > Having an option to make error messages more verbose would be great > for new users. "broken pipe", for example, sounds a lot worse than it > really is. :) >=20 "broken pipe" is just what libc gives, so, shouldn't such an option be implemented in libc itself? Besides, libc's message may be localized, and there's no reason to require users to choose between a verbose message and a localized one. > Verbose descriptions could be copied from BSD's signal.h or man 2 > sigaction. I think those are pretty decent. >=20 > Speaking of which, this reminds me of what Paul wrote in workers/48236= : >=20 > On Wed, Mar 24, 2021 at 4:29 PM Paul wrote= : > > - I half-agree with not unsetting clobber. noclobber is better defau= lt > > behavior (it prevents much more damaging surprises), but just seei= ng > > "file exists" or "no such file or directory" without any '>|' or '= >>|' > > suggestion is frustrating. >=20 > That could use a more helpful message, too. Yeah. The code should say what it was trying to do when it called the syscall which returned that error; i.e., =C2=ABzerrnam(foo, "while doing= bar: %e", errno)=C2=BB rather than =C2=ABzerrnam(foo, "%e", errno)=C2=BB. Daniel (replying out of order)