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,FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED, UNPARSEABLE_RELAY autolearn=ham autolearn_force=no version=3.4.4 Received: (qmail 5511 invoked from network); 30 Apr 2021 19:41:20 -0000 Received: from zero.zsh.org (2a02:898:31:0:48:4558:7a:7368) by inbox.vuxu.org with ESMTPUTF8; 30 Apr 2021 19:41:20 -0000 ARC-Seal: i=1; cv=none; a=rsa-sha256; d=zsh.org; s=rsa-20200801; t=1619811680; b=hpcZ7UreAgkyavN0kdPaYqPhAkEmvWlI9/Wh2TkI8QwwZ4MLZ5m+unpUg2qyWPJ11MXzsIGl59 A3BUSQiJCGxhiwur82JYBZMnaxhNp+tJ8cibxeAVrnQwJYIBxCjRmuaTSqHYsn1/Wru3ZOpHnV qrMtj1CEg4uIbPUnGn1s4NB3EsxwD/A3lzsJzgNWKdrqJHn6DySKs2yP7DFhSy7wDcVm9gys77 9Irvq+ao+dWqmCsBilVMsVJ8Q4vVJvWyIKgga1mOoP1P8TWFZ+Ofpy0Q9Q8wl695eaFkJkfwdd ZL+ZGLms7/gigHS5awcAiDddF5azyDrdQSQFCJrbfz/RGQ==; ARC-Authentication-Results: i=1; zsh.org; iprev=pass (mail-lf1-f53.google.com) smtp.remote-ip=209.85.167.53; dkim=pass header.d=gmail.com header.s=20161025 header.a=rsa-sha256; dmarc=pass header.from=gmail.com; arc=none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed; d=zsh.org; s=rsa-20200801; t=1619811680; bh=VGs4eglg+OYXTgXvphZqPSqwQieNBzOjW0Ap2A945Ys=; h=List-Archive:List-Owner:List-Post:List-Unsubscribe:List-Subscribe:List-Help: List-Id:Sender:Content-Transfer-Encoding:Content-Type:Cc:To:Subject: Message-ID:Date:From:In-Reply-To:References:MIME-Version:DKIM-Signature: DKIM-Signature; b=Pmv1gGbD1xDoyS1UBGWct2AY0pZkfWwEuO2A1cIbps05PI08PxPQzn9OO1lathoV9bcqVTV/Pd 4EI64n1Lwo/HsLeZVjUIwT4NSObmXXI5SwTc04u0saoVyhBMkIOzwu1DHG/DTF84iF3Ioe1k19 Am3eXrsvttR4lWeFcZ/qhRfflcfYrpgGeX8QGYbwwDRmNQJUg+qjKBLQX7HRxcjOXPY32Aa26l ULkiEFiCQS2HDT5m6QEt4P84quWtdy0yWsyxvEA5NVIwCymu8ONMCd5V5UvMrG4XVBz3NUOted 5AgQ/Od6XfK87N1iZGgUf2SRRW3S/JgUkRSC+40LEGx6Rg==; 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:Cc:To:Subject:Message-ID:Date:From:In-Reply-To:References: MIME-Version:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID; bh=hr28g+bzUwd4NGn41FkZgfLJEk+XIQ2lYAfaPiw8qDI=; b=v4jFzzcPR43EHEnLIkdA0RoDQ1 CeeyMu6muFkvdouTmkLFl+ky9zgvbvRVE3pw7OHcD3CG5yN99DKxf3gCQIRg3Qe2hlysIVmNxRjkI f+dO8/0PKaaQQ9R2/9WmbJetbu3lbm1+Hqf5Ub/hZyFI5HVHaWzIgrYC9CtnUOu2YRVbBzFi9e1Vb c0udKSW1U69GKIc+zzQ2wgVzA9LeVPNzuoOAelVRoxgMz/Vkm1YJm36Ph01xCANL8JWvCelsFC+bG NRIiIjdCR/7dVx3NWT7ByCKQpSzjLJ1Ck9WwJ8B+dXJFu5cSqBWTxVPoBNs3jJA5C9TFlkzqLX0Qk fBudpGUA==; Received: from authenticated user by zero.zsh.org with local id 1lcZ0q-0006Kz-7x; Fri, 30 Apr 2021 19:41:20 +0000 Authentication-Results: zsh.org; iprev=pass (mail-lf1-f53.google.com) smtp.remote-ip=209.85.167.53; dkim=pass header.d=gmail.com header.s=20161025 header.a=rsa-sha256; dmarc=pass header.from=gmail.com; arc=none Received: from mail-lf1-f53.google.com ([209.85.167.53]:36725) by zero.zsh.org with esmtps (TLS1.3:TLS_AES_128_GCM_SHA256:128) id 1lcZ0S-00064D-O7; Fri, 30 Apr 2021 19:40:57 +0000 Received: by mail-lf1-f53.google.com with SMTP id n138so111922139lfa.3 for ; Fri, 30 Apr 2021 12:40:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc:content-transfer-encoding; bh=hr28g+bzUwd4NGn41FkZgfLJEk+XIQ2lYAfaPiw8qDI=; b=iucjQEbBZABXSaIiZNh1VLerYNOMFBZ3u36O09zuiPVD0g3vkJmE68qUF28y2nZMSx oTGx2g/uYMseNURgWpeah0LdWAjx0r1VmSSt+vT0qm1RNVQsSUNmhFFDFo2oY/IsSc5o f+7y96mhSe0dF2OSBBJ4CB6fqS3x21SW78kpBaCWqU1H6ii6cf8ufnPPKSi6NXDAjhgU NZTkTwebe2zSXwd+SLq2dS/17RacflCc+2t7CT5to/TivWC9K2KCvMEDfNnTS3CyVfr8 C66D26W/vUnghRtZG5Q3Hzce5282r3zsZ54yPyjbQu5OB6DfV6HC/tYzEw1VDGBqy9/A AxTw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc:content-transfer-encoding; bh=hr28g+bzUwd4NGn41FkZgfLJEk+XIQ2lYAfaPiw8qDI=; b=nOqvVU+8R3Q7O2KBTK+JYpG42YfAfctn6h11tWt8+McUZufGGumFbnaBIKeI2LEhuz cOvUX3CINIihubMXhAS9M4WY1L1wzdsCDM2OfzpiUEN9g7TFhCfKqtWnXqGevSK0jTAB rR5LgzcEjhlF6ipqyGRYuEmlC3nbEhd1y9ak+dG5aefSSaRwiNDT9tNm0pLPXfcoL4b0 DFgAlKxz46NSas7Qnd1MsYSJPE2da75XA+qSJhPtUMhQg+ic7kW6Pry3IbNgBAd9UTr8 pnzxRMqj6ud5lk92SaN1Yv1tXk5pnDtkWb5aWcsufL1vIVNAySLmmWXTz0G4lffyzvVW IpAw== X-Gm-Message-State: AOAM530izsQCP4eF+onfcjzfYmt0wNEEtvk9rHcCoEr9eqdOBK+9YgH5 XDrHCJNg31+NduIrPPzpRx/ibFg47PzaYPsLQwM/L1dzI4PKFQ== X-Google-Smtp-Source: ABdhPJyNTt3kbWZS9B/zbjqeJ6TMpT6mgMoAJl3YD9OR+iTBqG9Ixu7utMFEExUAAJkQ+omEe8wKtAJ8Gxs0TW1l3Ts= X-Received: by 2002:ac2:548b:: with SMTP id t11mr1722363lfk.605.1619811656085; Fri, 30 Apr 2021 12:40:56 -0700 (PDT) MIME-Version: 1.0 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> In-Reply-To: <20210414140950.GH3882@tarpaulin.shahaf.local2> From: Marlon Richert Date: Fri, 30 Apr 2021 22:40:19 +0300 Message-ID: Subject: Re: sysexits.h codes? (was: Re: [RFC][PATCH] `newuser` prompt theme) To: Daniel Shahaf Cc: Zsh hackers list Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Seq: 48755 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: On Wed, Apr 14, 2021 at 5:09 PM Daniel Shahaf wrot= e: > > >> @@ -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 autoloade= d > > > 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? I think we could settle for just an array of names, to be consistent with $signals. > Just those available on the target system, or? sysexits.h tries to standardize exit codes. Having different $sysexits on different target systems would defeat its purpose. > > 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. 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. :) Verbose descriptions could be copied from BSD's signal.h or man 2 sigaction. I think those are pretty decent. Speaking of which, this reminds me of what Paul wrote in workers/48236: On Wed, Mar 24, 2021 at 4:29 PM Paul wrote: > - I half-agree with not unsetting clobber. noclobber is better default > behavior (it prevents much more damaging surprises), but just seeing > "file exists" or "no such file or directory" without any '>|' or '>>|' > suggestion is frustrating. That could use a more helpful message, too.