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 15856 invoked from network); 4 May 2021 11:15:18 -0000 Received: from zero.zsh.org (2a02:898:31:0:48:4558:7a:7368) by inbox.vuxu.org with ESMTPUTF8; 4 May 2021 11:15:18 -0000 ARC-Seal: i=1; cv=none; a=rsa-sha256; d=zsh.org; s=rsa-20200801; t=1620126918; b=WQMPkB53rmPfhjdhBxj302x67BofevOiF/azanoAoLgjhs2UMW0OW2ttUDaYvvIjgbVZIBn/6I W2Z+Hy06+JXJxdK/djU+f3SzSuZiJRVadxPc+UHJWkGnVoaRqYcne/Rp0Ia5JExkzUi0TP89s4 4NBXsPEM2tt6oZu6zdDDgZ+PDnEvVIRZgFFdjkHAls22lnl+WncHQimY0V9d3BnA4N9NWkwzVV v5jcr/vnofi1x3HzsZXoQ0axzB4/vT5HLcJbXH9Aa8BLgvCgcuNUGmq0NgxwB7xg2y8jawuKE1 uQEU1i1yTI3Lmb641Z3AnAJukdH/0OEMH0trCm4EbuutVQ==; ARC-Authentication-Results: i=1; zsh.org; iprev=pass (mail-lf1-f43.google.com) smtp.remote-ip=209.85.167.43; 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=1620126918; bh=OOMS8CED5H8XzMCEpnQoSJlpfu9jajNT9MJuhVdKdv0=; 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=p+mDpVqD0sIxIBOJxo2Y5I9mnIe8Do6HNGwYYoSOw/bTusbH4AthsFocumLRcd49XbE0h1pTGn cxOMPhZ5q1dbMK/ZOZtN82CT0p6bcNZTvZBf+sgTeaOa9GEIkyXGRrc6IMTSYTLC4GIF31XgQy cmdLKxSvHWPDcYoqilwKUnOUKQBm7RpmSSEvL58vk145tzOmpa+6ScFtI8QjGufJwf4456Mg5L 6cGVosQuFVx2pHUR4yqpTthZ0dH5tlp/4LTXP7Pi7D/QKKzN7HCzdYENVwd8Oo/M+WsQypB9RN c7YWsdKqYIt9/6oyTRtUr7iML1Dy2my2az0i/NLyyRcqbA==; 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=zU5g/8t143Im+rJEEvRZxeuMfpQBFTzR+mb0vW6+UBU=; b=hhi9XWj/M0d5XvNkCzrvMXv/R4 g72Q0S5jXXA5ZVtCEZPxVM34Ghguc5sXPpseX1W8Xkt4ksz0+5BBg2svh6o6ZFAXWYtv3zTBRziaf kag/fH3Io4e6tldWRHzO0dsQIvBJlr53Meyk37X8a/rQWbt6vStzmyL+cIPvoJmiHg1XiHDvQ637P ToFZRDnPOxpLOFgkoHZWYQr0oKcAn4dQsPxGPhjNrPLG7jSX2x4zZtj3dbG7AxoyOtYfzDZTW7Cgs boVI+Img5k6I2PHR0x13rlfvlO/Mhx9zdSbRdlfmjd9Pg85qgBM33sgMVt4vYnILX/eShQrvEDDJQ 10sMdctg==; Received: from authenticated user by zero.zsh.org with local id 1ldt1J-000OLr-6i; Tue, 04 May 2021 11:15:17 +0000 Authentication-Results: zsh.org; iprev=pass (mail-lf1-f43.google.com) smtp.remote-ip=209.85.167.43; 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-f43.google.com ([209.85.167.43]:40852) by zero.zsh.org with esmtps (TLS1.3:TLS_AES_128_GCM_SHA256:128) id 1ldt0e-000O4U-Eb; Tue, 04 May 2021 11:14:36 +0000 Received: by mail-lf1-f43.google.com with SMTP id c3so8663836lfs.7 for ; Tue, 04 May 2021 04:14:36 -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=zU5g/8t143Im+rJEEvRZxeuMfpQBFTzR+mb0vW6+UBU=; b=bzItcsZGchgGG7LExySj8gNGF7pbqSTcGooyTHX3m6hPaj8M8Af0fXJEXCNQ8uEoEl rVzY2ej1J0c8U9Bw2qOBgfix+AkWdROUvxiPCuNYt1zt7VePzHNEwYcmZ/7xzA3SSm77 bdl1TqYfYPHqd70mGlhFkoze2vu80U3OBrNjcCtRx3qXON+5Fe+ONrzyDOYXw/QlWP7S JE/cV57e3DDZ8q+7T8Xn6g/eUP7ErgAs1Cuw2WvDW03mr9W4N1x/u62zT+iu5ovcyOsT +LoASGtp5tNx5QJWekN8LEh5nbGsN2w/Y5nnhGRuaergTtHp4E+2p5usk4aKEm3sWvAO PnDQ== 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=zU5g/8t143Im+rJEEvRZxeuMfpQBFTzR+mb0vW6+UBU=; b=R4IsIIhFGqNeE+kkYSHo6PDCt3WK5LJMlmPBkTdFprQQ4L/ZJRNkVx66pkwG+Er0uR iW9yV2O3WjPT3/QpMPF9xaERhzmZu3ZHthU2sa7k41s0rdlAuWj+WK7TlJMkDeR/f+xP 1yJmVJ7gp2zmKqeJUUu8yM1METsX1SrGZnFiQT/E0dB3JBt92gJ9Wgwp5ANhJoxxgDDg jlH0JekLX/kzvHfP1tuEitoEeWTW52CJsjp904mW73nKSpXY6oaqeKOIa3ejI20JF2xa oyZ9XIO0uoH6UxYjzi9rzNj2WT4etiruUgfGatY+S8amE4MUsQx4Q+0Z1n9ziDI3Lfg+ kEpw== X-Gm-Message-State: AOAM531z94SPAn7mir60D+GEPsZ1ApsVMzUP7u7tIoe8x/lp2Bo0mxMR bqNLQB1DX204/QLnfPJsvzwfu86bzFJdBHnHQm8Kb2ZfYgktgg== X-Google-Smtp-Source: ABdhPJzWuDyGJ5qiSqaiKtCCqDW31i+5PmrQIHiKs4fflBP4YvSk94JsFlxRQcZxqAYwUAub2CsiPL/w8XHN4y7L9hw= X-Received: by 2002:a05:6512:2351:: with SMTP id p17mr11441412lfu.319.1620126875519; Tue, 04 May 2021 04:14:35 -0700 (PDT) MIME-Version: 1.0 References: <873D08A9-F321-474A-8440-CCE7DCCBA529@gmail.com> <20210414120551.GA3882@tarpaulin.shahaf.local2> <6CEA4F3E-9A64-44E1-9121-FA9D5E053AB5@gmail.com> <20210414140950.GH3882@tarpaulin.shahaf.local2> <0be2a280-9f0e-4762-87cb-aa6af32a813c@www.fastmail.com> <20210501144344.GA4080@tarpaulin.shahaf.local2> <20210503160445.GD16336@tarpaulin.shahaf.local2> In-Reply-To: <20210503160445.GD16336@tarpaulin.shahaf.local2> From: Marlon Richert Date: Tue, 4 May 2021 14:13:59 +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: 48782 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 Mon, May 3, 2021 at 7:04 PM Daniel Shahaf wrote= : > > Marlon Richert wrote on Mon, May 03, 2021 at 14:36:01 +0300: > > > > zsh: NO_CLOBBER: file exists; use >| to override > > > > It would give you the right keywords to use in a web search. > > +1 on putting the option name first. > > Not sure whether putting the strerror(3) string in the middle would > work well in all cases. Convention =E2=80=94 codified in errx(3) and fri= ends, > and compare Perl's =C2=ABdie "foo"=C2=BB without a trailing newline =E2= =80=94 is that > extra information is appended, rather than surrounded. The latter could > also lead to ambiguous or unclear grammatical structures. > > Furthermore, the extra advice in the error wouldn't always be > appropriate =E2=80=94 for instance, when the error is EACCES ("Permission > denied"). Well, of course not. The advice above is specific to NO_CLOBBER. ;) In all seriousness, though: I'm fine with not providing advice for errors like EACCES, because those are not specific to the shell. For all errors specific to shell features, though, (such as NO_CLOBBER,) having a short, error-specific piece of advice would be a tremendous help in making the shell's features easier to discover and easier to understand. > Well, suit yourself, Tweet or plaid? ;) > but unless someone else shows up to drive the discussion, it'll likely be= left at that. All right, if you insist=E2=80=A6 :) I've given it some more thought and the best option, I think, would be as follows: * Have an associative array $sysexits. * Let the keys be the return codes and the values be the exact descriptions that PRINT_EXIT_VALUE shows (minus the 'zsh: ' prefix and command suffix, of course). * Include all of 0 (success), 1 (failure), 2 (error), 64 - 78 (sysexits.h), 126 (command not executable), 127 (command not found), and 129 - 159 (signal.h). (Anything else I'm forgetting?) * $sysexits could either be built in, like $signals, or be available through a module. Additional features for consideration: * Make $sysexits editable, so that you can modify what PRINT_EXIT_VALUE out= puts. * Let PRINT_EXIT_VALUE support formatting in the form of prompt escape sequences.